diff options
author | 2015-12-02 13:29:25 +0000 | |
---|---|---|
committer | 2015-12-02 13:29:25 +0000 | |
commit | 12d3c25ce67843c3bd1fecdb30de4e5fb2cc0b91 (patch) | |
tree | 2f2bd0fc404cbf4cbfe2e6ab09733214e6bedf87 | |
parent | remove unimplemented PF_KEY algorithms; ok sthen@ mpi@ mikeb@ (diff) | |
download | wireguard-openbsd-12d3c25ce67843c3bd1fecdb30de4e5fb2cc0b91.tar.xz wireguard-openbsd-12d3c25ce67843c3bd1fecdb30de4e5fb2cc0b91.zip |
Kill the RT_REPORT flag to rtalloc() and stop sending RTM_MISS messages
for failed route lookups. This is something that was maybe useful in the
90is but in this modern times it is just annoying and nothing expect it
anyway. OK mpi@, sthen@
-rw-r--r-- | sys/net/if_mpe.c | 4 | ||||
-rw-r--r-- | sys/net/if_mpw.c | 5 | ||||
-rw-r--r-- | sys/net/pf.c | 12 | ||||
-rw-r--r-- | sys/net/route.c | 24 | ||||
-rw-r--r-- | sys/net/route.h | 7 | ||||
-rw-r--r-- | sys/netinet/if_ether.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_icmp.c | 6 | ||||
-rw-r--r-- | sys/netinet/ip_input.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_output.c | 9 | ||||
-rw-r--r-- | sys/netinet6/icmp6.c | 4 | ||||
-rw-r--r-- | sys/netinet6/in6_src.c | 4 | ||||
-rw-r--r-- | sys/netinet6/ip6_output.c | 6 | ||||
-rw-r--r-- | sys/netinet6/nd6.c | 4 |
13 files changed, 42 insertions, 51 deletions
diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c index 508a549066c..4078d3d266f 100644 --- a/sys/net/if_mpe.c +++ b/sys/net/if_mpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mpe.c,v 1.50 2015/11/06 11:45:42 mpi Exp $ */ +/* $OpenBSD: if_mpe.c,v 1.51 2015/12/02 13:29:25 claudio Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@spootnik.org> @@ -172,7 +172,7 @@ mpestart(struct ifnet *ifp0) continue; } - rt = rtalloc(sa, RT_REPORT|RT_RESOLVE, 0); + rt = rtalloc(sa, RT_RESOLVE, 0); if (!rtisvalid(rt)) { m_freem(m); rtfree(rt); diff --git a/sys/net/if_mpw.c b/sys/net/if_mpw.c index 13efcf4c208..ff174e7ea2a 100644 --- a/sys/net/if_mpw.c +++ b/sys/net/if_mpw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mpw.c,v 1.10 2015/11/06 11:45:04 mpi Exp $ */ +/* $OpenBSD: if_mpw.c,v 1.11 2015/12/02 13:29:25 claudio Exp $ */ /* * Copyright (c) 2015 Rafael Zalamena <rzalamena@openbsd.org> @@ -500,8 +500,7 @@ mpw_start(struct ifnet *ifp0) struct shim_hdr *shim; struct sockaddr_storage ss; - rt = rtalloc((struct sockaddr *) &sc->sc_nexthop, - RT_REPORT | RT_RESOLVE, 0); + rt = rtalloc((struct sockaddr *) &sc->sc_nexthop, RT_RESOLVE, 0); if (!rtisvalid(rt)) { rtfree(rt); return; diff --git a/sys/net/pf.c b/sys/net/pf.c index 6f4859cd716..c3d978ff259 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.952 2015/11/21 11:29:40 mpi Exp $ */ +/* $OpenBSD: pf.c,v 1.953 2015/12/02 13:29:25 claudio Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -2934,7 +2934,7 @@ pf_calc_mss(struct pf_addr *addr, sa_family_t af, int rtableid, u_int16_t offer) dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); dst->sin_addr = addr->v4; - rt = rtalloc(sintosa(dst), RT_REPORT, rtableid); + rt = rtalloc(sintosa(dst), 0, rtableid); break; #ifdef INET6 case AF_INET6: @@ -2943,7 +2943,7 @@ pf_calc_mss(struct pf_addr *addr, sa_family_t af, int rtableid, u_int16_t offer) dst6->sin6_family = AF_INET6; dst6->sin6_len = sizeof(*dst6); dst6->sin6_addr = addr->v6; - rt = rtalloc(sin6tosa(dst6), RT_REPORT, rtableid); + rt = rtalloc(sin6tosa(dst6), 0, rtableid); break; #endif /* INET6 */ } @@ -5384,7 +5384,7 @@ pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif, if (kif != NULL && kif->pfik_ifp->if_type == IFT_ENC) goto out; - rt0 = rtalloc((struct sockaddr *)&ss, RT_REPORT, rtableid); + rt0 = rtalloc((struct sockaddr *)&ss, 0, rtableid); if (rt0 != NULL) { /* No interface given, this is a no-route check */ if (kif == NULL) @@ -5456,7 +5456,7 @@ pf_rtlabel_match(struct pf_addr *addr, sa_family_t af, struct pf_addr_wrap *aw, #endif /* INET6 */ } - rt = rtalloc((struct sockaddr *)&ss, RT_REPORT|RT_RESOLVE, rtableid); + rt = rtalloc((struct sockaddr *)&ss, RT_RESOLVE, rtableid); if (rt != NULL) { if (rt->rt_labelid == aw->v.rtlabel) ret = 1; @@ -5515,7 +5515,7 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp, rtableid = m0->m_pkthdr.ph_rtableid; if (!r->rt) { - rt = rtalloc(sintosa(dst), RT_REPORT|RT_RESOLVE, rtableid); + rt = rtalloc(sintosa(dst), RT_RESOLVE, rtableid); if (rt == NULL) { ipstat.ips_noroute++; goto bad; diff --git a/sys/net/route.c b/sys/net/route.c index 423909af124..835b71f8c32 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.280 2015/12/02 10:33:15 blambert Exp $ */ +/* $OpenBSD: route.c,v 1.281 2015/12/02 13:29:26 claudio Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -223,10 +223,6 @@ rtisvalid(struct rtentry *rt) * "RT_RESOLVE" means that a corresponding L2 entry should * be added to the routing table and resolved (via ARP or * NDP), if it does not exist. - * - * "RT_REPORT" indicates that a message should be sent to - * userland if no matching route has been found or if an - * error occured while adding a L2 entry. */ struct rtentry * rt_match(struct sockaddr *dst, uint32_t *src, int flags, unsigned int tableid) @@ -248,19 +244,17 @@ rt_match(struct sockaddr *dst, uint32_t *src, int flags, unsigned int tableid) &rt, tableid); if (error) { rt0->rt_use++; - goto miss; + rt_missmsg(RTM_MISS, &info, 0, 0, error, + tableid); + } else { + /* Inform listeners of the new route */ + rt_sendmsg(rt, RTM_ADD, tableid); + rtfree(rt0); } - /* Inform listeners of the new route */ - rt_sendmsg(rt, RTM_ADD, tableid); - rtfree(rt0); } rt->rt_use++; - } else { + } else rtstat.rts_unreach++; -miss: - if (ISSET(flags, RT_REPORT)) - rt_missmsg(RTM_MISS, &info, 0, 0, error, tableid); - } KERNEL_UNLOCK(); splx(s); return (rt); @@ -349,7 +343,7 @@ rt_hash(struct rtentry *rt, uint32_t *src) struct rtentry * rtalloc_mpath(struct sockaddr *dst, uint32_t *src, unsigned int rtableid) { - return (_rtalloc(dst, src, RT_REPORT|RT_RESOLVE, rtableid)); + return (_rtalloc(dst, src, RT_RESOLVE, rtableid)); } #endif /* SMALL_KERNEL */ diff --git a/sys/net/route.h b/sys/net/route.h index f7893ad859b..d6d6d05f20a 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.124 2015/12/02 09:17:47 mpi Exp $ */ +/* $OpenBSD: route.h,v 1.125 2015/12/02 13:29:26 claudio Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -340,8 +340,7 @@ void rtlabel_unref(u_int16_t); /* * Values for additional argument to rtalloc() */ -#define RT_REPORT 0x1 -#define RT_RESOLVE 0x2 +#define RT_RESOLVE 1 extern struct rtstat rtstat; extern const struct sockaddr_rtin rt_defmask4; @@ -379,7 +378,7 @@ void rt_timer_timer(void *); int rtisvalid(struct rtentry *); int rt_hash(struct rtentry *, uint32_t *); #ifdef SMALL_KERNEL -#define rtalloc_mpath(dst, s, rid) rtalloc((dst), RT_REPORT|RT_RESOLVE, (rid)) +#define rtalloc_mpath(dst, s, rid) rtalloc((dst), RT_RESOLVE, (rid)) #else struct rtentry *rtalloc_mpath(struct sockaddr *, uint32_t *, u_int); #endif diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 533dcd746f7..33d71c9d6c4 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.192 2015/12/02 09:28:46 mpi Exp $ */ +/* $OpenBSD: if_ether.c,v 1.193 2015/12/02 13:29:26 claudio Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -704,7 +704,7 @@ arplookup(u_int32_t addr, int create, int proxy, u_int tableid) sin.sin_family = AF_INET; sin.sin_addr.s_addr = addr; sin.sin_other = proxy ? SIN_PROXY : 0; - flags = (create) ? (RT_REPORT|RT_RESOLVE) : 0; + flags = (create) ? RT_RESOLVE : 0; rt = rtalloc((struct sockaddr *)&sin, flags, tableid); if (!rtisvalid(rt) || ISSET(rt->rt_flags, RTF_GATEWAY) || diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index 32af2eec09d..45abcbd522f 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_icmp.c,v 1.147 2015/12/01 21:26:43 mpi Exp $ */ +/* $OpenBSD: ip_icmp.c,v 1.148 2015/12/02 13:29:26 claudio Exp $ */ /* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */ /* @@ -748,7 +748,7 @@ icmp_reflect(struct mbuf *m, struct mbuf **op, struct in_ifaddr *ia) sin.sin_addr = ip->ip_src; /* keep packet in the original virtual instance */ - rt = rtalloc(sintosa(&sin), RT_REPORT|RT_RESOLVE, rtableid); + rt = rtalloc(sintosa(&sin), RT_RESOLVE, rtableid); if (rt == NULL) { ipstat.ips_noroute++; m_freem(m); @@ -933,7 +933,7 @@ icmp_mtudisc_clone(struct in_addr dst, u_int rtableid) sin.sin_len = sizeof(sin); sin.sin_addr = dst; - rt = rtalloc(sintosa(&sin), RT_REPORT|RT_RESOLVE, rtableid); + rt = rtalloc(sintosa(&sin), RT_RESOLVE, rtableid); /* Check if the route is actually usable */ if (!rtisvalid(rt) || (rt->rt_flags & (RTF_REJECT|RTF_BLACKHOLE))) { diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 39f8e592324..4ab5ed80a8d 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.262 2015/11/23 15:54:45 mpi Exp $ */ +/* $OpenBSD: ip_input.c,v 1.263 2015/12/02 13:29:26 claudio Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -1243,7 +1243,7 @@ ip_rtaddr(struct in_addr dst, u_int rtableid) sin->sin_addr = dst; ipforward_rt.ro_rt = rtalloc(&ipforward_rt.ro_dst, - RT_REPORT|RT_RESOLVE, rtableid); + RT_RESOLVE, rtableid); } if (ipforward_rt.ro_rt == 0) return (NULL); diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 58dce03f26d..0c1c8f8f291 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.309 2015/12/01 00:49:12 mmcc Exp $ */ +/* $OpenBSD: ip_output.c,v 1.310 2015/12/02 13:29:26 claudio Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -501,7 +501,7 @@ sendit: if (ro && ro->ro_rt != NULL) { rtfree(ro->ro_rt); ro->ro_rt = rtalloc(&ro->ro_dst, - RT_REPORT|RT_RESOLVE, + RT_RESOLVE, m->m_pkthdr.ph_rtableid); } if (rt_mtucloned) @@ -1443,8 +1443,7 @@ ip_setmoptions(int optname, struct ip_moptions **imop, struct mbuf *m, sin.sin_len = sizeof(sin); sin.sin_family = AF_INET; sin.sin_addr = mreq->imr_multiaddr; - rt = rtalloc(sintosa(&sin), RT_REPORT|RT_RESOLVE, - rtableid); + rt = rtalloc(sintosa(&sin), RT_RESOLVE, rtableid); if (!rtisvalid(rt)) { rtfree(rt); error = EADDRNOTAVAIL; @@ -1455,7 +1454,7 @@ ip_setmoptions(int optname, struct ip_moptions **imop, struct mbuf *m, sin.sin_len = sizeof(sin); sin.sin_family = AF_INET; sin.sin_addr = mreq->imr_interface; - rt = rtalloc(sintosa(&sin), RT_REPORT, rtableid); + rt = rtalloc(sintosa(&sin), 0, rtableid); if (!rtisvalid(rt) || !ISSET(rt->rt_flags, RTF_LOCAL)) { rtfree(rt); error = EADDRNOTAVAIL; diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index ec25dbc1b4f..ff4ce7bf95f 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.c,v 1.179 2015/12/01 21:26:43 mpi Exp $ */ +/* $OpenBSD: icmp6.c,v 1.180 2015/12/02 13:29:26 claudio Exp $ */ /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ /* @@ -1912,7 +1912,7 @@ icmp6_mtudisc_clone(struct sockaddr *dst, u_int rdomain) struct rtentry *rt; int error; - rt = rtalloc(dst, RT_REPORT|RT_RESOLVE, rdomain); + rt = rtalloc(dst, RT_RESOLVE, rdomain); if (rt == NULL) return NULL; diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index 86c5a9d5a68..3294bf74da9 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_src.c,v 1.70 2015/10/25 14:43:06 florian Exp $ */ +/* $OpenBSD: in6_src.c,v 1.71 2015/12/02 13:29:26 claudio Exp $ */ /* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */ /* @@ -242,7 +242,7 @@ in6_selectsrc(struct in6_addr **in6src, struct sockaddr_in6 *dstsock, sa6->sin6_scope_id = dstsock->sin6_scope_id; if (IN6_IS_ADDR_MULTICAST(dst)) { ro->ro_rt = rtalloc(sin6tosa(&ro->ro_dst), - RT_REPORT|RT_RESOLVE, ro->ro_tableid); + RT_RESOLVE, ro->ro_tableid); } else { ro->ro_rt = rtalloc_mpath(sin6tosa(&ro->ro_dst), NULL, ro->ro_tableid); diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 5c1ff3b9ec6..94d60b2fe3d 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.200 2015/11/29 15:12:36 mpi Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.201 2015/12/02 13:29:26 claudio Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -1136,7 +1136,7 @@ ip6_getpmtu(struct route_in6 *ro_pmtu, struct route_in6 *ro, struct ifnet *ifp0, sa6_dst->sin6_addr = *dst; ro_pmtu->ro_rt = rtalloc(sin6tosa(&ro_pmtu->ro_dst), - RT_REPORT|RT_RESOLVE, ro_pmtu->ro_tableid); + RT_RESOLVE, ro_pmtu->ro_tableid); } } if (ro_pmtu->ro_rt) { @@ -2195,7 +2195,7 @@ ip6_setmoptions(int optname, struct ip6_moptions **im6op, struct mbuf *m) dst->sin6_family = AF_INET6; dst->sin6_addr = mreq->ipv6mr_multiaddr; ro.ro_rt = rtalloc(sin6tosa(&ro.ro_dst), - RT_REPORT|RT_RESOLVE, ro.ro_tableid); + RT_RESOLVE, ro.ro_tableid); if (ro.ro_rt == NULL) { error = EADDRNOTAVAIL; break; diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 2f92472c473..f4a216b401f 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.173 2015/12/01 12:22:18 mpi Exp $ */ +/* $OpenBSD: nd6.c,v 1.174 2015/12/02 13:29:26 claudio Exp $ */ /* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */ /* @@ -586,7 +586,7 @@ nd6_lookup(struct in6_addr *addr6, int create, struct ifnet *ifp, sin6.sin6_len = sizeof(struct sockaddr_in6); sin6.sin6_family = AF_INET6; sin6.sin6_addr = *addr6; - flags = (create) ? (RT_REPORT|RT_RESOLVE) : 0; + flags = (create) ? RT_RESOLVE : 0; rt = rtalloc(sin6tosa(&sin6), flags, rtableid); if (rt != NULL && (rt->rt_flags & RTF_LLINFO) == 0) { |