From 321a2ad3e7c32cbba74141d3996a71d00a191b36 Mon Sep 17 00:00:00 2001 From: Jonathan Matthew Date: Mon, 2 May 2016 22:15:50 +0000 Subject: 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@ --- sys/netinet6/nd6_rtr.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sys/netinet6/nd6_rtr.c') 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); } -- cgit v1.2.3