summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpctl/bgpctl.c6
-rw-r--r--usr.sbin/bgpd/session.c4
-rw-r--r--usr.sbin/dvmrpctl/dvmrpctl.c6
-rw-r--r--usr.sbin/dvmrpd/kroute.c4
-rw-r--r--usr.sbin/ospfctl/ospfctl.c6
-rw-r--r--usr.sbin/ospfd/interface.c4
-rw-r--r--usr.sbin/ospfd/kroute.c6
-rw-r--r--usr.sbin/ospfd/ospfe.c6
-rw-r--r--usr.sbin/ripctl/ripctl.c6
-rw-r--r--usr.sbin/ripd/interface.c4
-rw-r--r--usr.sbin/ripd/kroute.c6
-rw-r--r--usr.sbin/ripd/ripe.c4
-rw-r--r--usr.sbin/sasyncd/carp.c4
13 files changed, 38 insertions, 28 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index 1e6c68424e1..00e4e0fe45f 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.111 2006/11/10 14:46:46 henning Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.112 2006/11/28 19:21:15 reyk Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -905,7 +905,9 @@ get_linkstate(int media_type, int link_state)
if (p->ifms_type != media_type ||
p->ifms_valid != ifm_status_valid_list[i])
continue;
- return (p->ifms_string[link_state == LINK_STATE_UP]);
+ if (LINK_STATE_IS_UP(link_state))
+ return (p->ifms_string[1]);
+ return (p->ifms_string[0]);
}
return ("unknown link state");
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index d039d227406..bab50fa616f 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.264 2006/11/06 14:07:35 henning Exp $ */
+/* $OpenBSD: session.c,v 1.265 2006/11/28 19:21:15 reyk Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
@@ -2322,7 +2322,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) &&
- (kif->link_state == LINK_STATE_UP ||
+ (LINK_STATE_IS_UP(kif->link_state) ||
(kif->link_state == LINK_STATE_UNKNOWN &&
kif->media_type != IFT_CARP));
diff --git a/usr.sbin/dvmrpctl/dvmrpctl.c b/usr.sbin/dvmrpctl/dvmrpctl.c
index 6d75de6f2fa..1940e9d55ef 100644
--- a/usr.sbin/dvmrpctl/dvmrpctl.c
+++ b/usr.sbin/dvmrpctl/dvmrpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dvmrpctl.c,v 1.1 2006/06/01 14:21:28 norby Exp $ */
+/* $OpenBSD: dvmrpctl.c,v 1.2 2006/11/28 19:21:15 reyk Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -680,7 +680,9 @@ get_linkstate(int media_type, int link_state)
if (p->ifms_type != media_type ||
p->ifms_valid != ifm_status_valid_list[i])
continue;
- return (p->ifms_string[link_state == LINK_STATE_UP]);
+ if (LINK_STATE_IS_UP(link_state))
+ return (p->ifms_string[1]);
+ return (p->ifms_string[0]);
}
return ("unknown link state");
diff --git a/usr.sbin/dvmrpd/kroute.c b/usr.sbin/dvmrpd/kroute.c
index 3abc6102151..a8f61960ab2 100644
--- a/usr.sbin/dvmrpd/kroute.c
+++ b/usr.sbin/dvmrpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.3 2006/06/17 11:39:52 norby Exp $ */
+/* $OpenBSD: kroute.c,v 1.4 2006/11/28 19:21:15 reyk Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -347,7 +347,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) &&
- (ifm.ifm_data.ifi_link_state == LINK_STATE_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));
if ((sa = rti_info[RTAX_IFP]) != NULL)
diff --git a/usr.sbin/ospfctl/ospfctl.c b/usr.sbin/ospfctl/ospfctl.c
index 47777fe638d..f8bfaaf3b2e 100644
--- a/usr.sbin/ospfctl/ospfctl.c
+++ b/usr.sbin/ospfctl/ospfctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfctl.c,v 1.35 2006/08/23 08:26:03 claudio Exp $ */
+/* $OpenBSD: ospfctl.c,v 1.36 2006/11/28 19:21:15 reyk Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -1198,7 +1198,9 @@ get_linkstate(int media_type, int link_state)
if (p->ifms_type != media_type ||
p->ifms_valid != ifm_status_valid_list[i])
continue;
- return (p->ifms_string[link_state == LINK_STATE_UP]);
+ if (LINK_STATE_IS_UP(link_state))
+ return (p->ifms_string[1]);
+ return (p->ifms_string[0]);
}
return ("unknown");
diff --git a/usr.sbin/ospfd/interface.c b/usr.sbin/ospfd/interface.c
index f2e952e137a..30662c5164d 100644
--- a/usr.sbin/ospfd/interface.c
+++ b/usr.sbin/ospfd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.54 2006/11/17 08:55:31 claudio Exp $ */
+/* $OpenBSD: interface.c,v 1.55 2006/11/28 19:21:15 reyk Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -301,7 +301,7 @@ if_act_start(struct iface *iface)
struct timeval now;
if (!((iface->flags & IFF_UP) &&
- (iface->linkstate == LINK_STATE_UP ||
+ (LINK_STATE_IS_UP(iface->linkstate) ||
(iface->linkstate == LINK_STATE_UNKNOWN &&
iface->media_type != IFT_CARP)))) {
log_debug("if_act_start: interface %s link down",
diff --git a/usr.sbin/ospfd/kroute.c b/usr.sbin/ospfd/kroute.c
index cb74def38fc..ee0ae0d9a9d 100644
--- a/usr.sbin/ospfd/kroute.c
+++ b/usr.sbin/ospfd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.36 2006/11/28 16:36:58 henning Exp $ */
+/* $OpenBSD: kroute.c,v 1.37 2006/11/28 19:21:15 reyk Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -674,7 +674,7 @@ if_change(u_short ifindex, int flags, struct if_data *ifd)
kif->k.baudrate = ifd->ifi_baudrate;
if ((reachable = (flags & IFF_UP) &&
- (ifd->ifi_link_state == LINK_STATE_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)
return; /* nothing changed wrt nexthop validity */
@@ -967,7 +967,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) &&
- (ifm->ifm_data.ifi_link_state == LINK_STATE_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));
diff --git a/usr.sbin/ospfd/ospfe.c b/usr.sbin/ospfd/ospfe.c
index 471ccf60870..0059741af55 100644
--- a/usr.sbin/ospfd/ospfe.c
+++ b/usr.sbin/ospfd/ospfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfe.c,v 1.49 2006/11/17 08:55:31 claudio Exp $ */
+/* $OpenBSD: ospfe.c,v 1.50 2006/11/28 19:21:15 reyk Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -280,7 +280,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) &&
- (kif->link_state == LINK_STATE_UP ||
+ (LINK_STATE_IS_UP(kif->link_state) ||
(kif->link_state == LINK_STATE_UNKNOWN &&
kif->media_type != IFT_CARP));
@@ -735,7 +735,7 @@ orig_rtr_lsa(struct area *area)
if ((iface->flags & IFF_UP) == 0 ||
iface->linkstate == LINK_STATE_DOWN ||
- (iface->linkstate != LINK_STATE_UP &&
+ (!LINK_STATE_IS_UP(iface->linkstate) &&
iface->media_type == IFT_CARP))
continue;
diff --git a/usr.sbin/ripctl/ripctl.c b/usr.sbin/ripctl/ripctl.c
index d4ce6d45aa2..01eb123166a 100644
--- a/usr.sbin/ripctl/ripctl.c
+++ b/usr.sbin/ripctl/ripctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ripctl.c,v 1.1 2006/10/18 16:15:25 norby Exp $
+/* $OpenBSD: ripctl.c,v 1.2 2006/11/28 19:21:15 reyk Exp $
*
* Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -519,7 +519,9 @@ get_linkstate(int media_type, int link_state)
if (p->ifms_type != media_type ||
p->ifms_valid != ifm_status_valid_list[i])
continue;
- return (p->ifms_string[link_state == LINK_STATE_UP]);
+ if (LINK_STATE_IS_UP(link_state))
+ return (p->ifms_string[1]);
+ return (p->ifms_string[0]);
}
return ("unknown link state");
diff --git a/usr.sbin/ripd/interface.c b/usr.sbin/ripd/interface.c
index be9917361ad..f5ecc524102 100644
--- a/usr.sbin/ripd/interface.c
+++ b/usr.sbin/ripd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.1 2006/10/18 16:11:58 norby Exp $ */
+/* $OpenBSD: interface.c,v 1.2 2006/11/28 19:21:15 reyk Exp $ */
/*
* Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
@@ -159,7 +159,7 @@ if_act_start(struct iface *iface)
}
if (!((iface->flags & IFF_UP) &&
- (iface->linkstate == LINK_STATE_UP ||
+ (LINK_STATE_IS_UP(iface->linkstate) ||
(iface->linkstate == LINK_STATE_UNKNOWN &&
iface->media_type != IFT_CARP)))) {
log_debug("if_act_start: interface %s link down",
diff --git a/usr.sbin/ripd/kroute.c b/usr.sbin/ripd/kroute.c
index f333186697c..a67848b4c22 100644
--- a/usr.sbin/ripd/kroute.c
+++ b/usr.sbin/ripd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.4 2006/11/28 16:36:58 henning Exp $ */
+/* $OpenBSD: kroute.c,v 1.5 2006/11/28 19:21:15 reyk Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -649,7 +649,7 @@ if_change(u_short ifindex, int flags, struct if_data *ifd)
kif->k.baudrate = ifd->ifi_baudrate;
if ((reachable = (flags & IFF_UP) &&
- (ifd->ifi_link_state == LINK_STATE_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)
return; /* nothing changed wrt nexthop validity */
@@ -942,7 +942,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) &&
- (ifm.ifm_data.ifi_link_state == LINK_STATE_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));
if ((sa = rti_info[RTAX_IFP]) != NULL)
diff --git a/usr.sbin/ripd/ripe.c b/usr.sbin/ripd/ripe.c
index 1d760bb263a..4abbb4040c2 100644
--- a/usr.sbin/ripd/ripe.c
+++ b/usr.sbin/ripd/ripe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ripe.c,v 1.3 2006/10/31 23:43:11 michele Exp $ */
+/* $OpenBSD: ripe.c,v 1.4 2006/11/28 19:21:16 reyk Exp $ */
/*
* Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
@@ -250,7 +250,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) &&
- (kif->link_state == LINK_STATE_UP ||
+ (LINK_STATE_IS_UP(kif->link_state) ||
(kif->link_state == LINK_STATE_UNKNOWN &&
kif->media_type != IFT_CARP));
diff --git a/usr.sbin/sasyncd/carp.c b/usr.sbin/sasyncd/carp.c
index 974ea923dff..de876c0ea6f 100644
--- a/usr.sbin/sasyncd/carp.c
+++ b/usr.sbin/sasyncd/carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: carp.c,v 1.7 2006/09/16 11:35:18 mpf Exp $ */
+/* $OpenBSD: carp.c,v 1.8 2006/11/28 19:21:15 reyk Exp $ */
/*
* Copyright (c) 2005 Håkan Olsson. All rights reserved.
@@ -53,6 +53,8 @@ carp_map_state(u_char link_state)
switch(link_state) {
case LINK_STATE_UP:
+ case LINK_STATE_HALF_DUPLEX:
+ case LINK_STATE_FULL_DUPLEX:
state = MASTER;
break;
case LINK_STATE_DOWN: