Subject: Re: gif(4) problems
To: Thomas Hertz <thomas@hz.se>
From: Hajimu UMEMOTO <ume@mahoroba.org>
List: current-users
Date: 10/10/2003 04:05:57
--Multipart_Fri_Oct_10_04:05:57_2003-1
Content-Type: text/plain; charset=US-ASCII

Hi,

>>>>> On Thu, 09 Oct 2003 17:24:21 +0200
>>>>> Thomas Hertz <thomas@hz.se> said:

thomas> Recently I've experienced several kernel panics when executing "ifconfig 
thomas> gif0 destroy". Is this just my system, or can anyone else reproduce 
thomas> this? Currently I cannot test this myself on a "clean" setup until next 
thomas> week.

Please try attached patch.  Though I don't use NetBSD actually, I met
same problem on KAME/FreeBSD5.  I think around here is same, and the
patch should fix your problem, too.

Sincerely,


--Multipart_Fri_Oct_10_04:05:57_2003-1
Content-Type: text/x-patch; type=patch; charset=US-ASCII
Content-Disposition: attachment; filename="nd6_rtr.c.diff"
Content-Transfer-Encoding: 7bit

Index: sys/netinet6/nd6_rtr.c
diff -u sys/netinet6/nd6_rtr.c.orig sys/netinet6/nd6_rtr.c
--- sys/netinet6/nd6_rtr.c.orig	Fri Oct 10 03:50:58 2003
+++ sys/netinet6/nd6_rtr.c	Fri Oct 10 03:55:23 2003
@@ -428,16 +428,17 @@
 	struct rtentry *rt;
 {
 	struct rt_addrinfo info;
+	struct ifaddr *ifa;
 
 	bzero((caddr_t)&info, sizeof(info));
 	info.rti_info[RTAX_DST] = rt_key(rt);
 	info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
 	info.rti_info[RTAX_NETMASK] = rt_mask(rt);
-	if (rt->rt_ifp) {
-		info.rti_info[RTAX_IFP] =
-		    TAILQ_FIRST(&rt->rt_ifp->if_addrlist)->ifa_addr;
+	if (rt->rt_ifp &&
+	    (ifa = TAILQ_FIRST(&rt->rt_ifp->if_addrlist)) != NULL)
+		info.rti_info[RTAX_IFP] = ifa->ifa_addr;
+	if (rt->rt_ifa)
 		info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
-	}
 
 	rt_missmsg(cmd, &info, rt->rt_flags, 0);
 }

--Multipart_Fri_Oct_10_04:05:57_2003-1
Content-Type: text/plain; charset=US-ASCII

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume@mahoroba.org  ume@bisd.hitachi.co.jp  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/

--Multipart_Fri_Oct_10_04:05:57_2003-1--