summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2011-07-04 04:34:15 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2011-07-04 04:34:15 +0000
commite03be1c13da2627f88815c4221fd7aea1ef8f515 (patch)
treea68cb661597a54bfac8799839218986aea79977e /usr.sbin
parent6558208a6b4fc7625013eefd861685b315297077 (diff)
LINK_STATE_IS_UP() cleanup userland part. There is no need to special
case carp(4) interfaces anymore. LINK_STATE_IS_UP() almost always does the right job. OK deraadt@ henning@ This needs a -current kernel or link state may be not reported correctly.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/session.c6
-rw-r--r--usr.sbin/dvmrpd/dvmrpe.c6
-rw-r--r--usr.sbin/dvmrpd/interface.c7
-rw-r--r--usr.sbin/dvmrpd/kroute.c10
-rw-r--r--usr.sbin/ifstated/ifstated.c5
-rw-r--r--usr.sbin/ldpd/interface.c6
-rw-r--r--usr.sbin/ldpd/ldpe.c11
-rw-r--r--usr.sbin/ospf6d/interface.c6
-rw-r--r--usr.sbin/ospf6d/kroute.c11
-rw-r--r--usr.sbin/ospf6d/rde.c6
-rw-r--r--usr.sbin/ospfd/interface.c6
-rw-r--r--usr.sbin/ospfd/kroute.c10
-rw-r--r--usr.sbin/ospfd/ospfe.c18
-rw-r--r--usr.sbin/ripd/interface.c6
-rw-r--r--usr.sbin/ripd/kroute.c10
-rw-r--r--usr.sbin/ripd/ripe.c6
-rw-r--r--usr.sbin/snmpd/mib.c12
17 files changed, 45 insertions, 97 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index 0d608167ae3..cfc60229532 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.317 2011/05/05 06:21:44 henning Exp $ */
+/* $OpenBSD: session.c,v 1.318 2011/07/04 04:34:14 claudio Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
@@ -2461,9 +2461,7 @@ session_dispatch_imsg(struct imsgbuf *ibuf, int idx, u_int *listener_cnt)
fatalx("IFINFO imsg with wrong len");
kif = imsg.data;
depend_ok = (kif->flags & IFF_UP) &&
- (LINK_STATE_IS_UP(kif->link_state) ||
- (kif->link_state == LINK_STATE_UNKNOWN &&
- kif->media_type != IFT_CARP));
+ LINK_STATE_IS_UP(kif->link_state);
for (p = peers; p != NULL; p = p->next)
if (!strcmp(p->conf.if_depend, kif->ifname)) {
diff --git a/usr.sbin/dvmrpd/dvmrpe.c b/usr.sbin/dvmrpd/dvmrpe.c
index f8217e46e35..a69753c0c08 100644
--- a/usr.sbin/dvmrpd/dvmrpe.c
+++ b/usr.sbin/dvmrpd/dvmrpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dvmrpe.c,v 1.9 2010/05/26 13:56:07 nicm Exp $ */
+/* $OpenBSD: dvmrpe.c,v 1.10 2011/07/04 04:34:14 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -266,9 +266,7 @@ dvmrpe_dispatch_main(int fd, short event, void *bula)
fatalx("IFINFO imsg with wrong len");
kif = imsg.data;
link_ok = (kif->flags & IFF_UP) &&
- (LINK_STATE_IS_UP(kif->link_state) ||
- (kif->link_state == LINK_STATE_UNKNOWN &&
- kif->media_type != IFT_CARP));
+ LINK_STATE_IS_UP(kif->link_state);
LIST_FOREACH(iface, &deconf->iface_list, entry) {
if (kif->ifindex == iface->ifindex) {
diff --git a/usr.sbin/dvmrpd/interface.c b/usr.sbin/dvmrpd/interface.c
index 55d00027de3..789e21cf936 100644
--- a/usr.sbin/dvmrpd/interface.c
+++ b/usr.sbin/dvmrpd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.9 2009/09/22 16:43:42 michele Exp $ */
+/* $OpenBSD: interface.c,v 1.10 2011/07/04 04:34:14 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -384,10 +384,7 @@ if_act_start(struct iface *iface)
return (-1);
}
- if (!((iface->flags & IFF_UP) &&
- (LINK_STATE_IS_UP(iface->linkstate) ||
- (iface->linkstate == LINK_STATE_UNKNOWN &&
- iface->media_type != IFT_CARP)))) {
+ if (!((iface->flags & IFF_UP) && LINK_STATE_IS_UP(iface->linkstate))) {
log_debug("if_act_start: interface %s link down",
iface->name);
return (0);
diff --git a/usr.sbin/dvmrpd/kroute.c b/usr.sbin/dvmrpd/kroute.c
index e0dcd1a391b..40699627cf6 100644
--- a/usr.sbin/dvmrpd/kroute.c
+++ b/usr.sbin/dvmrpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.6 2009/09/22 16:43:42 michele Exp $ */
+/* $OpenBSD: kroute.c,v 1.7 2011/07/04 04:34:14 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -241,9 +241,7 @@ if_change(u_short ifindex, int flags, struct if_data *ifd)
kif->k.baudrate = ifd->ifi_baudrate;
if ((reachable = (flags & IFF_UP) &&
- (LINK_STATE_IS_UP(ifd->ifi_link_state) ||
- (ifd->ifi_link_state == LINK_STATE_UNKNOWN &&
- ifd->ifi_type != IFT_CARP))) == kif->k.nh_reachable)
+ LINK_STATE_IS_UP(ifd->ifi_link_state)) == kif->k.nh_reachable)
return; /* nothing changed wrt nexthop validity */
kif->k.nh_reachable = reachable;
@@ -351,9 +349,7 @@ fetchifs(int ifindex)
kif->k.baudrate = ifm.ifm_data.ifi_baudrate;
kif->k.mtu = ifm.ifm_data.ifi_mtu;
kif->k.nh_reachable = (kif->k.flags & IFF_UP) &&
- (LINK_STATE_IS_UP(ifm.ifm_data.ifi_link_state) ||
- (ifm.ifm_data.ifi_link_state == LINK_STATE_UNKNOWN &&
- ifm.ifm_data.ifi_type != IFT_CARP));
+ LINK_STATE_IS_UP(ifm.ifm_data.ifi_link_state);
if ((sa = rti_info[RTAX_IFP]) != NULL)
if (sa->sa_family == AF_LINK) {
sdl = (struct sockaddr_dl *)sa;
diff --git a/usr.sbin/ifstated/ifstated.c b/usr.sbin/ifstated/ifstated.c
index 33353407b3e..7cf274cce06 100644
--- a/usr.sbin/ifstated/ifstated.c
+++ b/usr.sbin/ifstated/ifstated.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifstated.c,v 1.39 2011/03/15 08:38:07 okan Exp $ */
+/* $OpenBSD: ifstated.c,v 1.40 2011/07/04 04:34:14 claudio Exp $ */
/*
* Copyright (c) 2004 Marco Pfatschbacher <mpf@openbsd.org>
@@ -403,8 +403,7 @@ external_evtimer_setup(struct ifsd_state *state, int action)
}
}
-#define LINK_STATE_IS_DOWN(_s) \
- (!LINK_STATE_IS_UP((_s)) && (_s) != LINK_STATE_UNKNOWN)
+#define LINK_STATE_IS_DOWN(_s) (!LINK_STATE_IS_UP((_s)))
int
scan_ifstate_single(int ifindex, int s, struct ifsd_state *state)
diff --git a/usr.sbin/ldpd/interface.c b/usr.sbin/ldpd/interface.c
index a622e282a36..8628e65614f 100644
--- a/usr.sbin/ldpd/interface.c
+++ b/usr.sbin/ldpd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.7 2011/01/10 12:28:25 claudio Exp $ */
+/* $OpenBSD: interface.c,v 1.8 2011/07/04 04:34:14 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -229,9 +229,7 @@ if_act_start(struct iface *iface)
struct timeval now;
if (!((iface->flags & IFF_UP) &&
- (LINK_STATE_IS_UP(iface->linkstate) ||
- (iface->linkstate == LINK_STATE_UNKNOWN &&
- iface->media_type != IFT_CARP)))) {
+ LINK_STATE_IS_UP(iface->linkstate))) {
log_debug("if_act_start: interface %s link down",
iface->name);
return (0);
diff --git a/usr.sbin/ldpd/ldpe.c b/usr.sbin/ldpd/ldpe.c
index c913d6e6d19..a65d1bef376 100644
--- a/usr.sbin/ldpd/ldpe.c
+++ b/usr.sbin/ldpd/ldpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldpe.c,v 1.14 2011/01/10 12:28:25 claudio Exp $ */
+/* $OpenBSD: ldpe.c,v 1.15 2011/07/04 04:34:14 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -304,17 +304,12 @@ ldpe_dispatch_main(int fd, short event, void *bula)
fatalx("IFINFO imsg with wrong len");
kif = imsg.data;
link_new = (kif->flags & IFF_UP) &&
- (LINK_STATE_IS_UP(kif->link_state) ||
- (kif->link_state == LINK_STATE_UNKNOWN &&
- kif->media_type != IFT_CARP));
+ LINK_STATE_IS_UP(kif->link_state);
LIST_FOREACH(iface, &leconf->iface_list, entry) {
if (kif->ifindex == iface->ifindex) {
link_old = (iface->flags & IFF_UP) &&
- (LINK_STATE_IS_UP(iface->linkstate)
- || (iface->linkstate ==
- LINK_STATE_UNKNOWN &&
- iface->media_type != IFT_CARP));
+ LINK_STATE_IS_UP(iface->linkstate);
iface->flags = kif->flags;
iface->linkstate = kif->link_state;
diff --git a/usr.sbin/ospf6d/interface.c b/usr.sbin/ospf6d/interface.c
index 6779b962c65..ad86e2a0fe9 100644
--- a/usr.sbin/ospf6d/interface.c
+++ b/usr.sbin/ospf6d/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.17 2011/07/04 04:08:34 claudio Exp $ */
+/* $OpenBSD: interface.c,v 1.18 2011/07/04 04:34:14 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -370,9 +370,7 @@ if_act_start(struct iface *iface)
struct timeval now;
if (!((iface->flags & IFF_UP) &&
- (LINK_STATE_IS_UP(iface->linkstate) ||
- (iface->linkstate == LINK_STATE_UNKNOWN &&
- iface->media_type != IFT_CARP)))) {
+ LINK_STATE_IS_UP(iface->linkstate))) {
log_debug("if_act_start: interface %s link down",
iface->name);
return (0);
diff --git a/usr.sbin/ospf6d/kroute.c b/usr.sbin/ospf6d/kroute.c
index 255294557ee..6ea5b4e7181 100644
--- a/usr.sbin/ospf6d/kroute.c
+++ b/usr.sbin/ospf6d/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.30 2011/03/07 07:43:02 henning Exp $ */
+/* $OpenBSD: kroute.c,v 1.31 2011/07/04 04:34:14 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -805,9 +805,7 @@ if_change(u_short ifindex, int flags, struct if_data *ifd)
}
reachable = (iface->flags & IFF_UP) &&
- (LINK_STATE_IS_UP(iface->linkstate) ||
- (iface->linkstate == LINK_STATE_UNKNOWN &&
- iface->media_type != IFT_CARP));
+ LINK_STATE_IS_UP(iface->linkstate);
if (reachable == iface->nh_reachable)
return; /* nothing changed wrt nexthop validity */
@@ -1293,10 +1291,7 @@ fetchifs(u_short ifindex)
fatal("fetchifs");
iface->nh_reachable = (iface->flags & IFF_UP) &&
- (LINK_STATE_IS_UP(ifm.ifm_data.ifi_link_state) ||
- (ifm.ifm_data.ifi_link_state ==
- LINK_STATE_UNKNOWN &&
- ifm.ifm_data.ifi_type != IFT_CARP));
+ LINK_STATE_IS_UP(ifm.ifm_data.ifi_link_state);
break;
case RTM_NEWADDR:
ifam = (struct ifa_msghdr *)rtm;
diff --git a/usr.sbin/ospf6d/rde.c b/usr.sbin/ospf6d/rde.c
index fae779a83fa..61306b0b201 100644
--- a/usr.sbin/ospf6d/rde.c
+++ b/usr.sbin/ospf6d/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.53 2011/07/04 04:08:34 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.54 2011/07/04 04:34:14 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -1468,9 +1468,7 @@ orig_intra_lsa_rtr(struct area *area, struct vertex *old)
numprefix = 0;
LIST_FOREACH(iface, &area->iface_list, entry) {
if (!((iface->flags & IFF_UP) &&
- (LINK_STATE_IS_UP(iface->linkstate) ||
- (iface->linkstate == LINK_STATE_UNKNOWN &&
- iface->media_type != IFT_CARP))))
+ LINK_STATE_IS_UP(iface->linkstate)))
/* interface or link state down */
continue;
if ((iface->state & IF_STA_DOWN) &&
diff --git a/usr.sbin/ospfd/interface.c b/usr.sbin/ospfd/interface.c
index ea53ed06cee..9f27f3795aa 100644
--- a/usr.sbin/ospfd/interface.c
+++ b/usr.sbin/ospfd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.73 2011/06/21 17:31:07 mikeb Exp $ */
+/* $OpenBSD: interface.c,v 1.74 2011/07/04 04:34:14 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -339,9 +339,7 @@ if_act_start(struct iface *iface)
struct timeval now;
if (!((iface->flags & IFF_UP) &&
- (LINK_STATE_IS_UP(iface->linkstate) ||
- (iface->linkstate == LINK_STATE_UNKNOWN &&
- iface->media_type != IFT_CARP))))
+ LINK_STATE_IS_UP(iface->linkstate)))
return (0);
if (iface->media_type == IFT_CARP && iface->passive == 0) {
diff --git a/usr.sbin/ospfd/kroute.c b/usr.sbin/ospfd/kroute.c
index 5449ea46704..67c4414f140 100644
--- a/usr.sbin/ospfd/kroute.c
+++ b/usr.sbin/ospfd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.89 2011/01/12 15:07:46 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.90 2011/07/04 04:34:14 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -842,9 +842,7 @@ kif_update(u_short ifindex, int flags, struct if_data *ifd,
if ((kif = kif_insert(ifindex)) == NULL)
return (NULL);
kif->k.nh_reachable = (flags & IFF_UP) &&
- (LINK_STATE_IS_UP(ifd->ifi_link_state) ||
- (ifd->ifi_link_state == LINK_STATE_UNKNOWN &&
- ifd->ifi_type != IFT_CARP));
+ LINK_STATE_IS_UP(ifd->ifi_link_state);
}
kif->k.flags = flags;
@@ -986,9 +984,7 @@ if_change(u_short ifindex, int flags, struct if_data *ifd,
}
reachable = (kif->flags & IFF_UP) &&
- (LINK_STATE_IS_UP(kif->link_state) ||
- (kif->link_state == LINK_STATE_UNKNOWN &&
- kif->media_type != IFT_CARP));
+ LINK_STATE_IS_UP(kif->link_state);
if (reachable == kif->nh_reachable)
return; /* nothing changed wrt nexthop validity */
diff --git a/usr.sbin/ospfd/ospfe.c b/usr.sbin/ospfd/ospfe.c
index 969c1b0e967..81d997cb4ba 100644
--- a/usr.sbin/ospfd/ospfe.c
+++ b/usr.sbin/ospfd/ospfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfe.c,v 1.82 2011/05/09 12:24:41 claudio Exp $ */
+/* $OpenBSD: ospfe.c,v 1.83 2011/07/04 04:34:14 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -296,10 +296,7 @@ ospfe_dispatch_main(int fd, short event, void *bula)
fatalx("IFINFO imsg with wrong len");
kif = imsg.data;
link_ok = (kif->flags & IFF_UP) &&
- (LINK_STATE_IS_UP(kif->link_state) ||
- (kif->link_state == LINK_STATE_UNKNOWN &&
- kif->media_type != IFT_CARP));
-
+ LINK_STATE_IS_UP(kif->link_state);
LIST_FOREACH(area, &oeconf->area_list, entry) {
LIST_FOREACH(iface, &area->iface_list, entry) {
@@ -860,17 +857,10 @@ orig_rtr_lsa(struct area *area)
/*
* do not add a stub net LSA for interfaces that are:
* - down
- * - have a linkstate which is down and are not carp
- * - have a linkstate unknown and are carp
- * carp uses linkstate down for backup and unknown
- * in cases where a major fubar happend.
+ * - have a linkstate which is down
*/
if (!(iface->flags & IFF_UP) ||
- (iface->media_type != IFT_CARP &&
- !(LINK_STATE_IS_UP(iface->linkstate) ||
- iface->linkstate == LINK_STATE_UNKNOWN)) ||
- (iface->media_type == IFT_CARP &&
- iface->linkstate == LINK_STATE_UNKNOWN))
+ !LINK_STATE_IS_UP(iface->linkstate))
continue;
log_debug("orig_rtr_lsa: stub net, "
"interface %s", iface->name);
diff --git a/usr.sbin/ripd/interface.c b/usr.sbin/ripd/interface.c
index c1b1c66db2c..d3ae7799f14 100644
--- a/usr.sbin/ripd/interface.c
+++ b/usr.sbin/ripd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.10 2011/06/21 17:31:07 mikeb Exp $ */
+/* $OpenBSD: interface.c,v 1.11 2011/07/04 04:34:14 claudio Exp $ */
/*
* Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
@@ -180,9 +180,7 @@ if_act_start(struct iface *iface)
}
if (!((iface->flags & IFF_UP) &&
- (LINK_STATE_IS_UP(iface->linkstate) ||
- (iface->linkstate == LINK_STATE_UNKNOWN &&
- iface->media_type != IFT_CARP)))) {
+ LINK_STATE_IS_UP(iface->linkstate))) {
log_debug("if_act_start: interface %s link down",
iface->name);
return (0);
diff --git a/usr.sbin/ripd/kroute.c b/usr.sbin/ripd/kroute.c
index 3f496037015..cbe107036ee 100644
--- a/usr.sbin/ripd/kroute.c
+++ b/usr.sbin/ripd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.23 2011/06/26 19:19:23 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.24 2011/07/04 04:34:14 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -669,9 +669,7 @@ if_change(u_short ifindex, int flags, struct if_data *ifd)
kif->k.baudrate = ifd->ifi_baudrate;
if ((reachable = (flags & IFF_UP) &&
- (LINK_STATE_IS_UP(ifd->ifi_link_state) ||
- (ifd->ifi_link_state == LINK_STATE_UNKNOWN &&
- ifd->ifi_type != IFT_CARP))) == kif->k.nh_reachable)
+ LINK_STATE_IS_UP(ifd->ifi_link_state)) == kif->k.nh_reachable)
return; /* nothing changed wrt nexthop validity */
kif->k.nh_reachable = reachable;
@@ -989,9 +987,7 @@ fetchifs(int ifindex)
kif->k.baudrate = ifm.ifm_data.ifi_baudrate;
kif->k.mtu = ifm.ifm_data.ifi_mtu;
kif->k.nh_reachable = (kif->k.flags & IFF_UP) &&
- (LINK_STATE_IS_UP(ifm.ifm_data.ifi_link_state) ||
- (ifm.ifm_data.ifi_link_state == LINK_STATE_UNKNOWN &&
- ifm.ifm_data.ifi_type != IFT_CARP));
+ LINK_STATE_IS_UP(ifm.ifm_data.ifi_link_state);
if ((sa = rti_info[RTAX_IFP]) != NULL)
if (sa->sa_family == AF_LINK) {
sdl = (struct sockaddr_dl *)sa;
diff --git a/usr.sbin/ripd/ripe.c b/usr.sbin/ripd/ripe.c
index 6e0ebac7a2f..a7018c925c0 100644
--- a/usr.sbin/ripd/ripe.c
+++ b/usr.sbin/ripd/ripe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ripe.c,v 1.13 2010/05/26 13:56:08 nicm Exp $ */
+/* $OpenBSD: ripe.c,v 1.14 2011/07/04 04:34:14 claudio Exp $ */
/*
* Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
@@ -257,9 +257,7 @@ ripe_dispatch_main(int fd, short event, void *bula)
fatalx("IFINFO imsg with wrong len");
kif = imsg.data;
link_ok = (kif->flags & IFF_UP) &&
- (LINK_STATE_IS_UP(kif->link_state) ||
- (kif->link_state == LINK_STATE_UNKNOWN &&
- kif->media_type != IFT_CARP));
+ LINK_STATE_IS_UP(kif->link_state);
LIST_FOREACH(iface, &oeconf->iface_list, entry) {
if (kif->ifindex == iface->ifindex) {
diff --git a/usr.sbin/snmpd/mib.c b/usr.sbin/snmpd/mib.c
index afaaab94819..9c088a63d03 100644
--- a/usr.sbin/snmpd/mib.c
+++ b/usr.sbin/snmpd/mib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mib.c,v 1.44 2011/04/10 03:20:59 guenther Exp $ */
+/* $OpenBSD: mib.c,v 1.45 2011/07/04 04:34:14 claudio Exp $ */
/*
* Copyright (c) 2007, 2008 Reyk Floeter <reyk@vantronix.net>
@@ -958,14 +958,14 @@ mib_iftable(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
break;
case 8:
/* ifOperStatus */
- if ((kif->if_flags & IFF_UP) == 0) {
+ if ((kif->if_flags & IFF_UP) == 0)
i = 2; /* down(2) */
- } else if (LINK_STATE_IS_UP(kif->if_link_state)) {
+ else if (kif->if_link_state == LINK_STATE_UNKNOWN)
+ i = 4; /* unknown(4) */
+ else if (LINK_STATE_IS_UP(kif->if_link_state))
i = 1; /* up(1) */
- } else if (kif->if_link_state == LINK_STATE_DOWN) {
+ else
i = 7; /* lowerLayerDown(7) or dormant(5)? */
- } else
- i = 4; /* unknown(4) */
ber = ber_add_integer(ber, i);
break;
case 9: