On 02/12/15(Wed) 12:36, Claudio Jeker wrote:
> The time where route miss messages on rtalloc() where useful are long
> gone. In modern times this just produces a lot of noise with no benefit.
> Nothing in userland is using this information anyway. Because of this
> reti^Wtedu RT_REPORT.
>
> OK?
ok mpi@
> --
> :wq Claudio
>
> Index: net/if_mpe.c
> ===================================================================
> RCS file: /cvs/src/sys/net/if_mpe.c,v
> retrieving revision 1.50
> diff -u -p -r1.50 if_mpe.c
> --- net/if_mpe.c 6 Nov 2015 11:45:42 -0000 1.50
> +++ net/if_mpe.c 2 Dec 2015 11:28:50 -0000
> @@ -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);
> Index: net/if_mpw.c
> ===================================================================
> RCS file: /cvs/src/sys/net/if_mpw.c,v
> retrieving revision 1.10
> diff -u -p -r1.10 if_mpw.c
> --- net/if_mpw.c 6 Nov 2015 11:45:04 -0000 1.10
> +++ net/if_mpw.c 2 Dec 2015 11:28:50 -0000
> @@ -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;
> Index: net/pf.c
> ===================================================================
> RCS file: /cvs/src/sys/net/pf.c,v
> retrieving revision 1.952
> diff -u -p -r1.952 pf.c
> --- net/pf.c 21 Nov 2015 11:29:40 -0000 1.952
> +++ net/pf.c 2 Dec 2015 11:28:50 -0000
> @@ -2934,7 +2934,7 @@ pf_calc_mss(struct pf_addr *addr, sa_fam
> 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_fam
> 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_fam
> 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, s
> #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
> 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;
> Index: net/route.c
> ===================================================================
> RCS file: /cvs/src/sys/net/route.c,v
> retrieving revision 1.280
> diff -u -p -r1.280 route.c
> --- net/route.c 2 Dec 2015 10:33:15 -0000 1.280
> +++ net/route.c 2 Dec 2015 11:28:50 -0000
> @@ -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
> &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 *sr
> 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 */
>
> Index: net/route.h
> ===================================================================
> RCS file: /cvs/src/sys/net/route.h,v
> retrieving revision 1.124
> diff -u -p -r1.124 route.h
> --- net/route.h 2 Dec 2015 09:17:47 -0000 1.124
> +++ net/route.h 2 Dec 2015 11:28:50 -0000
> @@ -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
> Index: netinet/if_ether.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet/if_ether.c,v
> retrieving revision 1.192
> diff -u -p -r1.192 if_ether.c
> --- netinet/if_ether.c 2 Dec 2015 09:28:46 -0000 1.192
> +++ netinet/if_ether.c 2 Dec 2015 11:28:50 -0000
> @@ -704,7 +704,7 @@ arplookup(u_int32_t addr, int create, in
> 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) ||
> Index: netinet/ip_icmp.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet/ip_icmp.c,v
> retrieving revision 1.147
> diff -u -p -r1.147 ip_icmp.c
> --- netinet/ip_icmp.c 1 Dec 2015 21:26:43 -0000 1.147
> +++ netinet/ip_icmp.c 2 Dec 2015 11:28:50 -0000
> @@ -748,7 +748,7 @@ icmp_reflect(struct mbuf *m, struct mbuf
> 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
> 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))) {
> Index: netinet/ip_input.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet/ip_input.c,v
> retrieving revision 1.262
> diff -u -p -r1.262 ip_input.c
> --- netinet/ip_input.c 23 Nov 2015 15:54:45 -0000 1.262
> +++ netinet/ip_input.c 2 Dec 2015 11:28:50 -0000
> @@ -1243,7 +1243,7 @@ ip_rtaddr(struct in_addr dst, u_int rtab
> 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);
> Index: netinet/ip_output.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet/ip_output.c,v
> retrieving revision 1.309
> diff -u -p -r1.309 ip_output.c
> --- netinet/ip_output.c 1 Dec 2015 00:49:12 -0000 1.309
> +++ netinet/ip_output.c 2 Dec 2015 11:29:58 -0000
> @@ -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_mo
> 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_mo
> 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;
> Index: netinet6/icmp6.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet6/icmp6.c,v
> retrieving revision 1.179
> diff -u -p -r1.179 icmp6.c
> --- netinet6/icmp6.c 1 Dec 2015 21:26:43 -0000 1.179
> +++ netinet6/icmp6.c 2 Dec 2015 11:28:50 -0000
> @@ -1912,7 +1912,7 @@ icmp6_mtudisc_clone(struct sockaddr *dst
> struct rtentry *rt;
> int error;
>
> - rt = rtalloc(dst, RT_REPORT|RT_RESOLVE, rdomain);
> + rt = rtalloc(dst, RT_RESOLVE, rdomain);
> if (rt == NULL)
> return NULL;
>
> Index: netinet6/in6_src.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet6/in6_src.c,v
> retrieving revision 1.70
> diff -u -p -r1.70 in6_src.c
> --- netinet6/in6_src.c 25 Oct 2015 14:43:06 -0000 1.70
> +++ netinet6/in6_src.c 2 Dec 2015 11:28:50 -0000
> @@ -242,7 +242,7 @@ in6_selectsrc(struct in6_addr **in6src,
> 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);
> Index: netinet6/ip6_output.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet6/ip6_output.c,v
> retrieving revision 1.200
> diff -u -p -r1.200 ip6_output.c
> --- netinet6/ip6_output.c 29 Nov 2015 15:12:36 -0000 1.200
> +++ netinet6/ip6_output.c 2 Dec 2015 11:28:50 -0000
> @@ -1136,7 +1136,7 @@ ip6_getpmtu(struct route_in6 *ro_pmtu, s
> 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_
> 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;
> Index: netinet6/nd6.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet6/nd6.c,v
> retrieving revision 1.173
> diff -u -p -r1.173 nd6.c
> --- netinet6/nd6.c 1 Dec 2015 12:22:18 -0000 1.173
> +++ netinet6/nd6.c 2 Dec 2015 11:28:50 -0000
> @@ -586,7 +586,7 @@ nd6_lookup(struct in6_addr *addr6, int c
> 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) {
> Index: netmpls/mpls_input.c
> ===================================================================
> RCS file: /cvs/src/sys/netmpls/mpls_input.c,v
> retrieving revision 1.52
> diff -u -p -r1.52 mpls_input.c
> --- netmpls/mpls_input.c 2 Dec 2015 08:47:00 -0000 1.52
> +++ netmpls/mpls_input.c 2 Dec 2015 11:28:50 -0000
> @@ -156,7 +156,7 @@ do_v6:
> }
> }
>
> - rt = rtalloc(smplstosa(smpls), RT_REPORT|RT_RESOLVE, 0);
> + rt = rtalloc(smplstosa(smpls), RT_RESOLVE, 0);
> if (rt == NULL) {
> /* no entry for this label */
> #ifdef MPLS_DEBUG
> @@ -372,7 +372,7 @@ mpls_do_error(struct mbuf *m, int type,
> smpls->smpls_len = sizeof(*smpls);
> smpls->smpls_label = shim->shim_label & MPLS_LABEL_MASK;
>
> - rt = rtalloc(smplstosa(smpls), RT_REPORT|RT_RESOLVE, 0);
> + rt = rtalloc(smplstosa(smpls), RT_RESOLVE, 0);
> if (rt == NULL) {
> /* no entry for this label */
> m_freem(m);
>