Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Jan 2002 20:20:23 -0800 (PST)
From:      Archie Cobbs <archie@dellroad.org>
To:        Archie Cobbs <archie@dellroad.org>
Cc:        Scott Lamb <slamb@slamb.org>, freebsd-net@freebsd.org
Subject:   Re: netgraph kernel panic
Message-ID:  <200201050420.g054KNx26451@arch20m.dellroad.org>
In-Reply-To: <200201050335.g053ZFo26297@arch20m.dellroad.org> "from Archie Cobbs at Jan 4, 2002 07:35:15 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Archie Cobbs writes:
> > Taking out my "set iface route" lines in mpd.conf made it no longer
> > crash and I can talk to just the VPN host.  So I tried next a "route add
> > vpnhost mygw" before starting the VPN. It worked. So that's definitely
> > the problem. It would be nice if there were a slicker way of doing this
> > (mpd automatically adding that route if this situation occurs?),
> > especially since I'm on DHCP. And it does make me nervous that mpd can
> > make the kernel crash at all. But I can at least work around this now.
> 
> You are right, kernel crashing is always bogus no matter how it
> happens. Mpd adding a host route for the remote IP is a good idea,
> I didn't think of that. I'll try to add something to that effect
> when time permits.
> 
> Really there are two things to fix: mpd as you describe, and
> ng_ksocket, which is where the crash originates.

If you have time, please try applying the patch below to your kernel.
Leave the mpd configuration as it was, and let's see if we get a
normal error instead of a kernel panic (I don't have a test setup
for this myself just now).

This is for FreeBSD-4.4, let me know if you have a different version.

Thanks,
-Archie

__________________________________________________________________________
Archie Cobbs     *     Packet Design     *     http://www.packetdesign.com

--- netgraph/ng_ksocket.c.orig	Fri Feb 16 09:37:48 2001
+++ netgraph/ng_ksocket.c	Fri Jan  4 20:18:49 2002
@@ -72,8 +72,9 @@
 
 /* Node private data */
 struct ng_ksocket_private {
-	hook_p		hook;
-	struct socket	*so;
+	hook_p		hook;			/* our hook, if any */
+	struct socket	*so;			/* our associated socket */
+	u_int		sending;		/* writing to socket */
 };
 typedef struct ng_ksocket_private *priv_p;
 
@@ -792,7 +793,13 @@
 	int error;
 
 	NG_FREE_META(meta);
+	if (priv->sending) {
+		NG_FREE_DATA(m);
+		return (EDEADLK);
+	}
+	priv->sending++;
 	error = (*so->so_proto->pr_usrreqs->pru_sosend)(so, 0, 0, m, 0, 0, p);
+	priv->sending--;
 	return (error);
 }
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201050420.g054KNx26451>