diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2011-07-07 00:36:14 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2011-07-07 00:36:14 +0000 |
commit | 3b38931fab76090e9341e81b18fb9e8171e53aa5 (patch) | |
tree | 7e780b23e3162771963d11961e04adef3a99a476 /usr.sbin/ospf6d/kroute.c | |
parent | 0e93ab9e6dae884da2aad37310d4c776092bad9a (diff) |
Kill nh_reachable. Link state checking is so easy now that it does not
matter anymore to cache this value for ospf6d.
Diffstat (limited to 'usr.sbin/ospf6d/kroute.c')
-rw-r--r-- | usr.sbin/ospf6d/kroute.c | 24 |
1 files changed, 10 insertions, 14 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; |