From owner-freebsd-net Tue Dec 17 9:37:38 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BADDA37B401 for ; Tue, 17 Dec 2002 09:37:36 -0800 (PST) Received: from ebb.errno.com (ebb.errno.com [66.127.85.87]) by mx1.FreeBSD.org (Postfix) with ESMTP id 483A043EA9 for ; Tue, 17 Dec 2002 09:37:36 -0800 (PST) (envelope-from sam@errno.com) Received: from melange (melange.errno.com [66.127.85.82]) (authenticated bits=0) by ebb.errno.com (8.12.5/8.12.1) with ESMTP id gBHHbY9i082600 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Tue, 17 Dec 2002 09:37:35 -0800 (PST)?g (envelope-from sam@errno.com)œ X-Authentication-Warning: ebb.errno.com: Host melange.errno.com [66.127.85.82] claimed to be melange Message-ID: <050301c2a5f2$fc52aae0$52557f42@errno.com> From: "Sam Leffler" To: "Vincent Jardin" , References: <3DF62DBD0032C2ED@mel-rta6.wanadoo.fr> (added by postmaster@wanadoo.fr) Subject: Re: Recursive encapsulation could panic the Kernel Date: Tue, 17 Dec 2002 09:37:34 -0800 Organization: Errno Consulting MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org > With FreeBSD, there are many ways to create a recursive local encapsulation > loop within the IPv4 and IPv6 stack. For example, this problem shows up when : > - Netgraph with pptp is used or Netgraph with an ng_iface over UDP or any > more complex Netgraph topologies... > - gre interfaces > - gif tunnels > - ... > > There is a simple local solution that is used by gif_output() that is not > protected by any mutex: > /* > * gif may cause infinite recursion calls when misconfigured. > * We'll prevent this by introducing upper limit. > * XXX: this mechanism may introduce another problem about > * mutual exclusion of the variable CALLED, especially if we > * use kernel thread. > */ > if (++called > max_gif_nesting) { > log(LOG_NOTICE, > "gif_output: recursively called too many times(%d)\n", > called); > m_freem(m); > error = EIO; /* is there better errno? */ > goto end; > } > > I am wondering if a more generic solution could be found, however I do not > have any idea yet ;-( > I mean, is it possible to protect the kernel against any panic that could > come from a mis-configuration of the routing tables ? In -current mbufs can be tagged (see m_tag* in sys/mbuf.h); this'll let you do what you want. I've been slow to MFC them to -stable because there are some issues with copying packet headers that I want to resolve first. Sam To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message