-/* $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 $ */
/*
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);
}
/*