From owner-freebsd-net Fri Mar 9 3:37:22 2001 Delivered-To: freebsd-net@freebsd.org Received: from zibbi.icomtek.csir.co.za (zibbi.icomtek.csir.co.za [146.64.24.58]) by hub.freebsd.org (Postfix) with ESMTP id E961037B719 for ; Fri, 9 Mar 2001 03:37:08 -0800 (PST) (envelope-from jhay@zibbi.icomtek.csir.co.za) Received: (from jhay@localhost) by zibbi.icomtek.csir.co.za (8.11.1/8.11.1) id f29BZA959543; Fri, 9 Mar 2001 13:35:10 +0200 (SAT) (envelope-from jhay) From: John Hay Message-Id: <200103091135.f29BZA959543@zibbi.icomtek.csir.co.za> Subject: Re: kernel: nd6_storelladdr failed, mbuf leak In-Reply-To: <26821.984121907@coconut.itojun.org> from "itojun@iijlab.net" at "Mar 9, 2001 04:11:47 pm" To: itojun@iijlab.net Date: Fri, 9 Mar 2001 13:35:10 +0200 (SAT) Cc: bmilekic@technokratis.com, freebsd-net@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > > >I'll do it right now if itojun doesn't mind (to save him a task :-) ) > >and get authorization from Jordan to commit. > > please go ahead, i can review the diff if you want me to. > Ok, here is a patch for -current. It was taken from the kame code with minor adjustments to fit into our tree. I have tested it on -current, but not on -stable yet. Itojun will you look it over please? I'm gone for the weekend now, so I'll only be able to commit it by Sunday night. If someone wants to do it before then, you're welcome. John -- John Hay -- John.Hay@icomtek.csir.co.za Index: sys/net/if_ethersubr.c =================================================================== RCS file: /home/ncvs/src/sys/net/if_ethersubr.c,v retrieving revision 1.91 diff -u -r1.91 if_ethersubr.c --- sys/net/if_ethersubr.c 2001/02/18 17:54:52 1.91 +++ sys/net/if_ethersubr.c 2001/03/09 11:00:49 @@ -184,8 +184,7 @@ #ifdef INET6 case AF_INET6: if (!nd6_storelladdr(&ac->ac_if, rt, m, dst, (u_char *)edst)) { - /* this must be impossible, so we bark */ - printf("nd6_storelladdr failed\n"); + /* something bad happened */ return(0); } off = m->m_pkthdr.len - m->m_len; Index: sys/net/if_fddisubr.c =================================================================== RCS file: /home/ncvs/src/sys/net/if_fddisubr.c,v retrieving revision 1.49 diff -u -r1.49 if_fddisubr.c --- sys/net/if_fddisubr.c 2001/02/04 13:12:56 1.49 +++ sys/net/if_fddisubr.c 2001/03/09 11:01:18 @@ -180,8 +180,7 @@ #ifdef INET6 case AF_INET6: if (!nd6_storelladdr(&ac->ac_if, rt, m, dst, (u_char *)edst)) { - /* this must be impossible, so we bark */ - printf("nd6_storelladdr failed\n"); + /* something bad happened */ return(0); } type = htons(ETHERTYPE_IPV6); Index: sys/netinet6/nd6.c =================================================================== RCS file: /home/ncvs/src/sys/netinet6/nd6.c,v retrieving revision 1.7 diff -u -r1.7 nd6.c --- sys/netinet6/nd6.c 2001/02/26 03:41:13 1.7 +++ sys/netinet6/nd6.c 2001/03/09 10:20:04 @@ -970,6 +970,7 @@ return(1); break; default: + m_freem(m); return(0); } } @@ -1026,6 +1027,7 @@ ln, 0); } } + /* do not free mbuf here, it is queued into llinfo_nd6 */ return(0); } #endif /* OLDIP6OUTPUT */ @@ -1981,19 +1983,26 @@ *desten = 0; return(1); default: + m_freem(m); return(0); } } - if (rt == NULL || - rt->rt_gateway->sa_family != AF_LINK) { + if (rt == NULL) { + /* this could happen, if we could not allocate memory */ + m_freem(m); + return(0); + } + if (rt->rt_gateway->sa_family != AF_LINK) { printf("nd6_storelladdr: something odd happens\n"); + m_freem(m); return(0); } sdl = SDL(rt->rt_gateway); if (sdl->sdl_alen == 0) { /* this should be impossible, but we bark here for debugging */ printf("nd6_storelladdr: sdl_alen == 0\n"); + m_freem(m); return(0); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message