Sync rtisvalid(9) check for local route entries with r1.257 of
authormpi <mpi@openbsd.org>
Mon, 19 Oct 2015 12:02:11 +0000 (12:02 +0000)
committermpi <mpi@openbsd.org>
Mon, 19 Oct 2015 12:02:11 +0000 (12:02 +0000)
net/ip_input.c

sys/netinet/ip_icmp.c

index c44eb97..8392adf 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ip_icmp.c,v 1.141 2015/09/23 08:49:46 mpi Exp $       */
+/*     $OpenBSD: ip_icmp.c,v 1.142 2015/10/19 12:02:11 mpi Exp $       */
 /*     $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $    */
 
 /*
@@ -731,11 +731,10 @@ icmp_reflect(struct mbuf *m, struct mbuf **op, struct in_ifaddr *ia)
                sin.sin_addr = ip->ip_dst;
 
                rt = rtalloc(sintosa(&sin), 0, rtableid);
-               if (rt != NULL) {
-                       if (rt->rt_flags & (RTF_LOCAL|RTF_BROADCAST))
-                               ia = ifatoia(rt->rt_ifa);
-                       rtfree(rt);
-               }
+               if (rtisvalid(rt) &&
+                   ISSET(rt->rt_flags, RTF_LOCAL|RTF_BROADCAST))
+                       ia = ifatoia(rt->rt_ifa);
+               rtfree(rt);
        }
 
        /*