diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-02-05 03:01:04 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-02-05 03:01:04 +0000 |
commit | 080b5a6b01af7cfd11b9855b120a7b5005fdea01 (patch) | |
tree | f12063a46f4e194a3ab546bf21ab85cf69d58fd5 | |
parent | b3251d773860d08cf23d157c6831dc54ae9aece5 (diff) |
Convert various rtrequest1(RTM_DELETE,...) calls to rtdeletemsg(9).
This unify some code and notify userland for free.
blambert@ agrees, ok bluhm@
-rw-r--r-- | sys/netinet/if_ether.c | 12 | ||||
-rw-r--r-- | sys/netinet/ip_icmp.c | 22 | ||||
-rw-r--r-- | sys/netinet6/icmp6.c | 22 | ||||
-rw-r--r-- | sys/netinet6/in6_ifattach.c | 22 |
4 files changed, 11 insertions, 67 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 5b4630dd808..a73af42bbdc 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.143 2015/01/28 22:10:13 mpi Exp $ */ +/* $OpenBSD: if_ether.c,v 1.144 2015/02/05 03:01:03 mpi Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -832,15 +832,7 @@ arplookup(u_int32_t addr, int create, int proxy, u_int tableid) if (create) { if (rt->rt_refcnt <= 0 && (rt->rt_flags & RTF_CLONED) != 0) { - struct rt_addrinfo info; - - memset(&info, 0, sizeof(info)); - info.rti_info[RTAX_DST] = rt_key(rt); - info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; - info.rti_info[RTAX_NETMASK] = rt_mask(rt); - - rtrequest1(RTM_DELETE, &info, rt->rt_priority, - NULL, tableid); + rtdeletemsg(rt, tableid); } } return (0); diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index ac27df55014..82774bd7905 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_icmp.c,v 1.131 2015/01/28 22:10:13 mpi Exp $ */ +/* $OpenBSD: ip_icmp.c,v 1.132 2015/02/05 03:01:03 mpi Exp $ */ /* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */ /* @@ -1031,20 +1031,12 @@ icmp_mtudisc_timeout(struct rtentry *rt, struct rttimer *r) (RTF_DYNAMIC | RTF_HOST)) { void *(*ctlfunc)(int, struct sockaddr *, u_int, void *); struct sockaddr_in sa; - struct rt_addrinfo info; int s; - memset(&info, 0, sizeof(info)); - info.rti_info[RTAX_DST] = rt_key(rt); - info.rti_info[RTAX_NETMASK] = rt_mask(rt); - info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; - info.rti_flags = rt->rt_flags; - sa = *(struct sockaddr_in *)rt_key(rt); s = splsoftnet(); - rtrequest1(RTM_DELETE, &info, rt->rt_priority, NULL, - r->rtt_tableid); + rtdeletemsg(rt, r->rtt_tableid); /* Notify TCP layer of increased Path MTU estimate */ ctlfunc = inetsw[ip_protox[IPPROTO_TCP]].pr_ctlinput; @@ -1083,18 +1075,10 @@ icmp_redirect_timeout(struct rtentry *rt, struct rttimer *r) if ((rt->rt_flags & (RTF_DYNAMIC | RTF_HOST)) == (RTF_DYNAMIC | RTF_HOST)) { - struct rt_addrinfo info; int s; - memset(&info, 0, sizeof(info)); - info.rti_info[RTAX_DST] = rt_key(rt); - info.rti_info[RTAX_NETMASK] = rt_mask(rt); - info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; - info.rti_flags = rt->rt_flags; - s = splsoftnet(); - rtrequest1(RTM_DELETE, &info, rt->rt_priority, NULL, - r->rtt_tableid); + rtdeletemsg(rt, r->rtt_tableid); splx(s); } } diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 89de1731854..c1a1a422d0d 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.c,v 1.155 2015/01/28 22:10:13 mpi Exp $ */ +/* $OpenBSD: icmp6.c,v 1.156 2015/02/05 03:01:03 mpi Exp $ */ /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ /* @@ -1983,18 +1983,10 @@ icmp6_mtudisc_timeout(struct rtentry *rt, struct rttimer *r) panic("icmp6_mtudisc_timeout: bad route to timeout"); if ((rt->rt_flags & (RTF_DYNAMIC | RTF_HOST)) == (RTF_DYNAMIC | RTF_HOST)) { - struct rt_addrinfo info; int s; - bzero(&info, sizeof(info)); - info.rti_flags = rt->rt_flags; - info.rti_info[RTAX_DST] = rt_key(rt); - info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; - info.rti_info[RTAX_NETMASK] = rt_mask(rt); - s = splsoftnet(); - rtrequest1(RTM_DELETE, &info, rt->rt_priority, NULL, - r->rtt_tableid); + rtdeletemsg(rt, r->rtt_tableid); splx(s); } else { if (!(rt->rt_rmx.rmx_locks & RTV_MTU)) @@ -2009,18 +2001,10 @@ icmp6_redirect_timeout(struct rtentry *rt, struct rttimer *r) panic("icmp6_redirect_timeout: bad route to timeout"); if ((rt->rt_flags & (RTF_GATEWAY | RTF_DYNAMIC | RTF_HOST)) == (RTF_GATEWAY | RTF_DYNAMIC | RTF_HOST)) { - struct rt_addrinfo info; int s; - bzero(&info, sizeof(info)); - info.rti_flags = rt->rt_flags; - info.rti_info[RTAX_DST] = rt_key(rt); - info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; - info.rti_info[RTAX_NETMASK] = rt_mask(rt); - s = splsoftnet(); - rtrequest1(RTM_DELETE, &info, rt->rt_priority, NULL, - r->rtt_tableid); + rtdeletemsg(rt, r->rtt_tableid); splx(s); } } diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index 70fbe2a8e79..b0c88f36d21 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_ifattach.c,v 1.84 2015/01/28 22:10:13 mpi Exp $ */ +/* $OpenBSD: in6_ifattach.c,v 1.85 2015/02/05 03:01:03 mpi Exp $ */ /* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */ /* @@ -630,15 +630,7 @@ in6_ifdetach(struct ifnet *ifp) sin6.sin6_addr.s6_addr16[1] = htons(ifp->if_index); rt = rtalloc(sin6tosa(&sin6), 0, ifp->if_rdomain); if (rt && rt->rt_ifp == ifp) { - struct rt_addrinfo info; - - bzero(&info, sizeof(info)); - info.rti_flags = rt->rt_flags; - info.rti_info[RTAX_DST] = rt_key(rt); - info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; - info.rti_info[RTAX_NETMASK] = rt_mask(rt); - rtrequest1(RTM_DELETE, &info, rt->rt_priority, NULL, - ifp->if_rdomain); + rtdeletemsg(rt, ifp->if_rdomain); rtfree(rt); } @@ -650,15 +642,7 @@ in6_ifdetach(struct ifnet *ifp) sin6.sin6_addr.s6_addr16[1] = htons(ifp->if_index); rt = rtalloc(sin6tosa(&sin6), 0, ifp->if_rdomain); if (rt && rt->rt_ifp == ifp) { - struct rt_addrinfo info; - - bzero(&info, sizeof(info)); - info.rti_flags = rt->rt_flags; - info.rti_info[RTAX_DST] = rt_key(rt); - info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; - info.rti_info[RTAX_NETMASK] = rt_mask(rt); - rtrequest1(RTM_DELETE, &info, rt->rt_priority, NULL, - ifp->if_rdomain); + rtdeletemsg(rt, ifp->if_rdomain); rtfree(rt); } |