On Fri, Oct 16, 2015 at 04:24:04PM +0200, Martin Pieuchot wrote:
> --- netinet6/icmp6.c 18 Sep 2015 14:26:22 -0000 1.172
> +++ netinet6/icmp6.c 16 Oct 2015 13:48:56 -0000
> @@ -1568,7 +1568,7 @@ icmp6_redirect_output(struct mbuf *m0, s
> goto fail;
>
> /* sanity check */
> - if (!m0 || !rt || !(rt->rt_flags & RTF_UP) || !(ifp = rt->rt_ifp))
> + if (m0 == NULL || !rtisvalid(rt))
The "ifp = rt->rt_ifp" is an assignment well hidden in the if condition.
You must still set ifp or it will be used uninitialized.
> --- netinet6/in6_src.c 13 Oct 2015 10:16:17 -0000 1.63
> +++ netinet6/in6_src.c 16 Oct 2015 13:57:30 -0000
> @@ -327,9 +327,8 @@ in6_selectroute(struct sockaddr_in6 *dst
> * by that address must be a neighbor of the sending host.
> */
> ron = &opts->ip6po_nextroute;
> - if ((ron->ro_rt &&
> - (ron->ro_rt->rt_flags & (RTF_UP | RTF_GATEWAY)) !=
> - RTF_UP) ||
> + if (!rtisvalid(ron->ro_rt) ||
> + ISSET(ron->ro_rt->rt_flags, RTF_GATEWAY) ||
> !IN6_ARE_ADDR_EQUAL(&ron->ro_dst.sin6_addr,
> &sin6_next->sin6_addr)) {
I think here is a "|| ron->ro_tableid != rtableid" missing.
> --- netinet6/ip6_output.c 23 Sep 2015 08:49:46 -0000 1.189
> +++ netinet6/ip6_output.c 16 Oct 2015 13:52:44 -0000
> @@ -1151,9 +1151,8 @@ ip6_getpmtu(struct route_in6 *ro_pmtu, s
> /* The first hop and the final destination may differ. */
> struct sockaddr_in6 *sa6_dst = &ro_pmtu->ro_dst;
>
> - if (ro_pmtu->ro_rt &&
> - ((ro_pmtu->ro_rt->rt_flags & RTF_UP) == 0 ||
> - !IN6_ARE_ADDR_EQUAL(&sa6_dst->sin6_addr, dst))) {
> + if (!rtisvalid(ro_pmtu->ro_rt) ||
> + !IN6_ARE_ADDR_EQUAL(&sa6_dst->sin6_addr, dst)) {
I think a "|| ro_pmtu->ro_tableid != ifp->if_rdomain" is missing.
Of course the tableid remarks are unrelated to your diff.
bluhm