From 7f070caa750df224137287eac3d356bc3fab9f92 Mon Sep 17 00:00:00 2001 From: itojun Date: Fri, 20 Jul 2001 20:26:35 +0000 Subject: [PATCH] sync rt_ifp check with IPv4 counterpart (see sys/net/if_ethersubr.c 1.27). sync with kame --- sys/netinet6/nd6.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index d78c8c2d9f67..243cc13f2657 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $NetBSD: nd6.c,v 1.49 2001/06/29 16:01:47 itojun Exp $ */ +/* $NetBSD: nd6.c,v 1.50 2001/07/20 20:26:35 itojun Exp $ */ /* $KAME: nd6.c,v 1.151 2001/06/19 14:24:41 sumikawa Exp $ */ /* @@ -1887,9 +1887,17 @@ nd6_output(ifp, origifp, m0, dst, rt0) goto lookup; if (((rt = rt->rt_gwroute)->rt_flags & RTF_UP) == 0) { rtfree(rt); rt = rt0; - lookup: rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1); + lookup: + rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1); if ((rt = rt->rt_gwroute) == 0) senderr(EHOSTUNREACH); + /* the "G" test below also prevents rt == rt0 */ + if ((rt->rt_flags & RTF_GATEWAY) || + (rt->rt_ifp != ifp)) { + rt->rt_refcnt--; + rt0->rt_gwroute = 0; + senderr(EHOSTUNREACH); + } } } }