diff options
author | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2016-05-02 22:15:50 +0000 |
---|---|---|
committer | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2016-05-02 22:15:50 +0000 |
commit | 321a2ad3e7c32cbba74141d3996a71d00a191b36 (patch) | |
tree | 2b45265ec4593b84be8f0404dbc6aca28b30d7da /sys/netinet6/nd6_rtr.c | |
parent | 8f0b9406f0380cff6b0b14588a4a51eaaf887dea (diff) |
Simplify life for routing table implementations by requiring that rtable_walk
callbacks return EAGAIN if they modify the routing table. While we're here,
simplify life for rtable_walk callers by moving the loop that restarts the
walk on EAGAIN into rtable_walk itself.
Flushing cloned routes on interface state changes becomes a bit more
inefficient, but this can be improved later.
ok mpi@ dlg@
Diffstat (limited to 'sys/netinet6/nd6_rtr.c')
-rw-r--r-- | sys/netinet6/nd6_rtr.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 17babf2c472..0058711a2cd 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_rtr.c,v 1.138 2016/01/12 09:37:44 mpi Exp $ */ +/* $OpenBSD: nd6_rtr.c,v 1.139 2016/05/02 22:15:49 jmatthew Exp $ */ /* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */ /* @@ -2056,6 +2056,7 @@ rt6_deleteroute(struct rtentry *rt, void *arg, unsigned int id) struct rt_addrinfo info; struct in6_addr *gate = (struct in6_addr *)arg; struct sockaddr_in6 sa_mask; + int error; if (rt->rt_gateway == NULL || rt->rt_gateway->sa_family != AF_INET6) return (0); @@ -2083,5 +2084,9 @@ rt6_deleteroute(struct rtentry *rt, void *arg, unsigned int id) info.rti_info[RTAX_DST] = rt_key(rt); info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; info.rti_info[RTAX_NETMASK] = rt_plen2mask(rt, &sa_mask); - return (rtrequest(RTM_DELETE, &info, RTP_ANY, NULL, id)); + error = rtrequest(RTM_DELETE, &info, RTP_ANY, NULL, id); + if (error != 0) + return (error); + + return (EAGAIN); } |