diff options
author | 2011-07-07 00:36:13 +0000 | |
---|---|---|
committer | 2011-07-07 00:36:13 +0000 | |
commit | 6ccc0b943c4671bf445d0e6e8d309e37f9f86566 (patch) | |
tree | a2590126c9b4269665f7d97b5b8b41be2e8177df | |
parent | Fix bit twiddling routines on ARM; where floating-point word order (diff) | |
download | wireguard-openbsd-6ccc0b943c4671bf445d0e6e8d309e37f9f86566.tar.xz wireguard-openbsd-6ccc0b943c4671bf445d0e6e8d309e37f9f86566.zip |
Kill nh_reachable. Link state checking is so easy now that it does not
matter anymore to cache this value for ospf6d.
-rw-r--r-- | usr.sbin/ospf6d/kroute.c | 24 | ||||
-rw-r--r-- | usr.sbin/ospf6d/ospf6d.h | 3 | ||||
-rw-r--r-- | usr.sbin/ospf6d/ospfe.c | 6 | ||||
-rw-r--r-- | usr.sbin/ospf6d/rde.c | 3 |
4 files changed, 15 insertions, 21 deletions
diff --git a/usr.sbin/ospf6d/kroute.c b/usr.sbin/ospf6d/kroute.c index 6ea5b4e7181..feef9084eaa 100644 --- a/usr.sbin/ospf6d/kroute.c +++ b/usr.sbin/ospf6d/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.31 2011/07/04 04:34:14 claudio Exp $ */ +/* $OpenBSD: kroute.c,v 1.32 2011/07/07 00:36:13 claudio Exp $ */ /* * Copyright (c) 2004 Esben Norby <norby@openbsd.org> @@ -648,7 +648,7 @@ kif_validate(u_short ifindex) return (1); } - return (iface->nh_reachable); + return ((iface->flags & IFF_UP) && LINK_STATE_IS_UP(iface->linkstate)); } struct kroute_node * @@ -797,20 +797,20 @@ if_change(u_short ifindex, int flags, struct if_data *ifd) { struct kroute_node *kr, *tkr; struct iface *iface; - u_int8_t reachable; + u_int8_t wasvalid, isvalid; + + wasvalid = kif_validate(ifindex); if ((iface = kif_update(ifindex, flags, ifd, NULL)) == NULL) { log_warn("if_change: kif_update(%u)", ifindex); return; } - reachable = (iface->flags & IFF_UP) && + isvalid = (iface->flags & IFF_UP) && LINK_STATE_IS_UP(iface->linkstate); - if (reachable == iface->nh_reachable) - return; /* nothing changed wrt nexthop validity */ - - iface->nh_reachable = reachable; + if (wasvalid == isvalid) + return; /* nothing changed wrt validity */ /* notify ospfe about interface link state */ if (iface->cflags & F_IFACE_CONFIGURED) @@ -821,7 +821,7 @@ if_change(u_short ifindex, int flags, struct if_data *ifd) RB_FOREACH(kr, kroute_tree, &krt) { for (tkr = kr; tkr != NULL; tkr = tkr->next) { if (tkr->r.ifindex == ifindex) { - if (reachable) + if (isvalid) tkr->r.flags &= ~F_DOWN; else tkr->r.flags |= F_DOWN; @@ -1065,7 +1065,7 @@ send_rtmsg(int fd, int action, struct kroute *kroute) */ bzero(&ifp, sizeof(ifp)); ifp.addr.sdl_len = sizeof(struct sockaddr_dl); - ifp.addr.sdl_family = AF_LINK; + ifp.addr.sdl_index = kroute->ifindex; /* adjust header */ hdr.rtm_flags |= RTF_CLONING; @@ -1288,10 +1288,6 @@ fetchifs(u_short ifindex) if ((iface = kif_update(ifm.ifm_index, ifm.ifm_flags, &ifm.ifm_data, (struct sockaddr_dl *)rti_info[RTAX_IFP])) == NULL) - fatal("fetchifs"); - - iface->nh_reachable = (iface->flags & IFF_UP) && - 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/ospf6d.h b/usr.sbin/ospf6d/ospf6d.h index 6c117c67a8a..803b16e5132 100644 --- a/usr.sbin/ospf6d/ospf6d.h +++ b/usr.sbin/ospf6d/ospf6d.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospf6d.h,v 1.22 2010/08/22 21:15:25 bluhm Exp $ */ +/* $OpenBSD: ospf6d.h,v 1.23 2011/07/07 00:36:13 claudio Exp $ */ /* * Copyright (c) 2004, 2007 Esben Norby <norby@openbsd.org> @@ -316,7 +316,6 @@ struct iface { u_int8_t media_type; u_int8_t linkstate; u_int8_t priority; - u_int8_t nh_reachable; u_int8_t cflags; #define F_IFACE_PASSIVE 0x01 #define F_IFACE_CONFIGURED 0x02 diff --git a/usr.sbin/ospf6d/ospfe.c b/usr.sbin/ospf6d/ospfe.c index a8ef62dedc0..ca4c286e526 100644 --- a/usr.sbin/ospf6d/ospfe.c +++ b/usr.sbin/ospf6d/ospfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfe.c,v 1.34 2011/05/02 09:24:00 claudio Exp $ */ +/* $OpenBSD: ospfe.c,v 1.35 2011/07/07 00:36:13 claudio Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -288,9 +288,9 @@ ospfe_dispatch_main(int fd, short event, void *bula) fatalx("interface lost in ospfe"); iface->flags = ifp->flags; iface->linkstate = ifp->linkstate; - iface->nh_reachable = ifp->nh_reachable; - if (iface->nh_reachable) { + if ((iface->flags & IFF_UP) && + LINK_STATE_IS_UP(iface->linkstate)) { if_fsm(iface, IF_EVT_UP); log_warnx("interface %s up", iface->name); } else { diff --git a/usr.sbin/ospf6d/rde.c b/usr.sbin/ospf6d/rde.c index 61306b0b201..88e103c9522 100644 --- a/usr.sbin/ospf6d/rde.c +++ b/usr.sbin/ospf6d/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.54 2011/07/04 04:34:14 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.55 2011/07/07 00:36:13 claudio Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -586,7 +586,6 @@ rde_dispatch_imsg(int fd, short event, void *bula) iface = if_find(ifp->ifindex); if (iface == NULL) fatalx("interface lost in rde"); - iface->nh_reachable = ifp->nh_reachable; /* * Resend LSAs if interface flags change - |