From e03be1c13da2627f88815c4221fd7aea1ef8f515 Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Mon, 4 Jul 2011 04:34:15 +0000 Subject: 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. --- usr.sbin/ospf6d/interface.c | 6 ++---- usr.sbin/ospf6d/kroute.c | 11 +++-------- usr.sbin/ospf6d/rde.c | 6 ++---- 3 files changed, 7 insertions(+), 16 deletions(-) (limited to 'usr.sbin/ospf6d') 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 @@ -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 @@ -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 @@ -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) && -- cgit v1.2.3