diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-03-17 10:24:41 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-03-17 10:24:41 +0000 |
commit | cdfa66d33a7b79c04cd854673ce6a4504d48d422 (patch) | |
tree | 2f757026e635569ca85cc63487c279115fef0001 /sys | |
parent | e53350dae5f008f87272dc1a597b05e47b386079 (diff) |
Remove pre-rt_getifa() code to find the address descriptor (ifa) related
to a route entry, no need to do the work twice.
This chunk should have been deleted when post-4.4BSD changes from BSD/OS
4.2 were merged more than 10 years ago.
While here properly indent the following block.
tested by chris@, ok krw@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/rtsock.c | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index ae41c80424b..ed1d8e45633 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.140 2014/03/12 12:03:55 mpi Exp $ */ +/* $OpenBSD: rtsock.c,v 1.141 2014/03/17 10:24:40 mpi Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -759,32 +759,21 @@ report: error = EDQUOT; goto flush; } - if (info.rti_info[RTAX_IFP] != NULL && (ifa = - ifa_ifwithnet(info.rti_info[RTAX_IFP], tableid)) && - (ifp = ifa->ifa_ifp) && (info.rti_info[RTAX_IFA] || - info.rti_info[RTAX_GATEWAY])) - ifa = ifaof_ifpforaddr(info.rti_info[RTAX_IFA] ? - info.rti_info[RTAX_IFA] : - info.rti_info[RTAX_GATEWAY], ifp); - else if ((info.rti_info[RTAX_IFA] != NULL && (ifa = - ifa_ifwithaddr(info.rti_info[RTAX_IFA], tableid)))|| - (info.rti_info[RTAX_GATEWAY] != NULL && (ifa = - ifa_ifwithroute(rt->rt_flags, rt_key(rt), - info.rti_info[RTAX_GATEWAY], tableid)))) - ifp = ifa->ifa_ifp; + ifa = info.rti_ifa; if (ifa) { - struct ifaddr *oifa = rt->rt_ifa; - if (oifa != ifa) { - if (oifa && oifa->ifa_rtrequest) - oifa->ifa_rtrequest(RTM_DELETE, rt); - ifafree(rt->rt_ifa); - rt->rt_ifa = ifa; - ifa->ifa_refcnt++; - rt->rt_ifp = ifp; + if (rt->rt_ifa != ifa) { + if (rt->rt_ifa->ifa_rtrequest) + rt->rt_ifa->ifa_rtrequest( + RTM_DELETE, rt); + ifafree(rt->rt_ifa); + rt->rt_ifa = ifa; + ifa->ifa_refcnt++; + rt->rt_ifp = info.rti_ifp; #ifndef SMALL_KERNEL - /* recheck link state after ifp change */ - rt_if_linkstate_change( - (struct radix_node *)rt, ifp, tableid); + /* recheck link state after ifp change*/ + rt_if_linkstate_change( + (struct radix_node *)rt, rt->rt_ifp, + tableid); #endif } } |