diff options
author | Andrew J. Schorr <ajschorr@alumni.princeton.edu> | 2008-01-11 15:57:13 +0000 |
---|---|---|
committer | Andrew J. Schorr <ajschorr@alumni.princeton.edu> | 2008-01-11 15:57:13 +0000 |
commit | 55edb0d446a272907715b0825ff008557174d34a (patch) | |
tree | 17d46ab705b0b229b8795d0d809fddd18e1d9078 | |
parent | c543a1737173fb438f1d8c06f650b2d0d479f45c (diff) |
[link-detect] Improve BSD support.
2008-01-11 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* lib/zebra.h: Revert previous change, no need to include
<net/if_media.h> here.
* zebra/ioctl.c: If HAVE_BSD_LINK_DETECT is defined, include
<net/if_media.h>
(if_get_flags) Remove debug messages about BSD link state.
* zebra/kernel_socket.c: (bsd_linkdetect_translate) If link state
is unknown, we should set the IFF_RUNNING flag.
-rw-r--r-- | lib/ChangeLog | 5 | ||||
-rw-r--r-- | lib/zebra.h | 3 | ||||
-rw-r--r-- | zebra/ChangeLog | 7 | ||||
-rw-r--r-- | zebra/ioctl.c | 22 | ||||
-rw-r--r-- | zebra/kernel_socket.c | 3 |
5 files changed, 21 insertions, 19 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog index 21d08dd0..2263c03c 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2008-01-11 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * zebra.h: Revert previous change, no need to include <net/if_media.h> + here. + 2008-01-10 Ingo Flaschberger <if@xip.at> * zebra.h: If HAVE_BSD_LINK_DETECT is defined, include <net/if_media.h>. diff --git a/lib/zebra.h b/lib/zebra.h index 1c9eb39f..150aa2c5 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -116,9 +116,6 @@ typedef int socklen_t; #endif /* !va_copy */ #endif /* !C99 */ -#ifdef HAVE_BSD_LINK_DETECT -#include <net/if_media.h> -#endif /* HAVE_BSD_LINK_DETECT*/ #ifdef HAVE_LCAPS #include <sys/capability.h> diff --git a/zebra/ChangeLog b/zebra/ChangeLog index ba6d3070..0aabc3c2 100644 --- a/zebra/ChangeLog +++ b/zebra/ChangeLog @@ -1,3 +1,10 @@ +2008-01-11 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * ioctl.c: If HAVE_BSD_LINK_DETECT is defined, include <net/if_media.h> + (if_get_flags) Remove debug messages about BSD link state. + * kernel_socket.c: (bsd_linkdetect_translate) If link state + is unknown, we should set the IFF_RUNNING flag. + 2008-01-10 Ingo Flaschberger <if@xip.at> * ioctl.c: (if_get_flags) If HAVE_BSD_LINK_DETECT, use the SIOCGIFMEDIA diff --git a/zebra/ioctl.c b/zebra/ioctl.c index 4f99a6cd..7bb4da1f 100644 --- a/zebra/ioctl.c +++ b/zebra/ioctl.c @@ -33,6 +33,10 @@ #include "zebra/rt.h" #include "zebra/interface.h" +#ifdef HAVE_BSD_LINK_DETECT +#include <net/if_media.h> +#endif /* HAVE_BSD_LINK_DETECT*/ + extern struct zebra_privs_t zserv_privs; /* clear and set interface name string */ @@ -367,24 +371,12 @@ if_get_flags (struct interface *ifp) if (ifmr.ifm_status & IFM_AVALID) /* Link state is valid */ { if (ifmr.ifm_status & IFM_ACTIVE) - { - SET_FLAG(ifreq.ifr_flags, IFF_RUNNING); - zlog_debug("%s: BSD link state to up at interface %s, ifindex %d", - __func__, ifp->name, ifp->ifindex); - } + SET_FLAG(ifreq.ifr_flags, IFF_RUNNING); else - { - UNSET_FLAG(ifreq.ifr_flags, IFF_RUNNING); - zlog_debug("%s: BSD link state to down at interface %s, ifindex %d", - __func__, ifp->name, ifp->ifindex); - } + UNSET_FLAG(ifreq.ifr_flags, IFF_RUNNING); } else /* Force always up */ - { - SET_FLAG(ifreq.ifr_flags, IFF_RUNNING); - zlog_debug("%s: BSD link state invalid, forced up at interface %s, ifindex %d", - __func__, ifp->name, ifp->ifindex); - } + SET_FLAG(ifreq.ifr_flags, IFF_RUNNING); #endif /* HAVE_BSD_LINK_DETECT */ if_flags_update (ifp, (ifreq.ifr_flags & 0x0000ffff)); diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index cd30631b..2e04b031 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -300,7 +300,8 @@ ifan_read (struct if_announcemsghdr *ifan) static void bsd_linkdetect_translate (struct if_msghdr *ifm) { - if (ifm->ifm_data.ifi_link_state >= LINK_STATE_UP) + if ((ifm->ifm_data.ifi_link_state >= LINK_STATE_UP) || + (ifm->ifm_data.ifi_link_state == LINK_STATE_UNKNOWN)) SET_FLAG(ifm->ifm_flags, IFF_RUNNING); else UNSET_FLAG(ifm->ifm_flags, IFF_RUNNING); |