Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Mar 2004 01:58:06 +0100
From:      Max Laier <max@love2party.net>
To:        Simon Coggins <simon@uow.edu.au>, current@freebsd.org
Cc:        Bruce M Simpson <bms@freebsd.org>
Subject:   Re: Kernel panic when setting up queues via IPFW
Message-ID:  <200403030158.06151.max@love2party.net>
In-Reply-To: <20040302223305.GA12935@uow.edu.au>
References:  <20040302223305.GA12935@uow.edu.au>

next in thread | previous in thread | raw e-mail | index | archive | help

--Boundary-00=_e2SRAowAWXRIihV
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Tuesday 02 March 2004 23:33, Simon Coggins wrote:
> Hi,
>
> I've just started playing with queues and pipes and I created the
> config attached. The problem is when ever I reconfigure queue 6 (I was
> doing my numbering wrong to start with hence i found it) the kernel
> panics. I can reproduce it everytime on my machine.

it was reproducible and attached patch fixed it for me. There were some 
missing unlocks on the dummynet mutex for error cases. Can you check, 
please?

Am just lucky that it doesn't seem to be  MT_TAG related this time.

> The machine is:
> FreeBSD router 5.2-CURRENT FreeBSD 5.2-CURRENT #10: Tue Mar  2 04:31:42
> EST 2004    
> root@chaotic.chaos.oz.org:/usr/world/obj/usr/world/src/sys/Router  i386
>
> When the 2nd "queue 6 config pipe 1 ...." command
> is issued (the last line), a kernel panic occurs.
>
> I don't have the debugger currently compiled into the kernel so I
> couldn't get usful info. Hopefully someone else can reproduce this.
>
> The config is:
> ------8<------8<-------8<------
> # Default Traffic
> add queue 1 ip from any to any in recv tun10
> queue 1 config pipe 1 weight 30 queue 15kb
> pipe 1 config bw 512kb/s queue 25kb
>
> add queue 2 ip from any to any out xmit tun10
> queue 2 config pipe 2 weight 30 queue 15kb
> pipe 2 config bw 128kb/s queue 25kb
>
> # DNS/ntp etc
> add queue 3 udp from any to any src-port 53 in recv tun10
> add queue 3 tcp from any to any src-port 54 in recv tun10
> add queue 3 udp from any to any src-port 123 in recv tun10
> queue 3 config pipe 1 weight 100 queue 15kb
>
> add queue 4 udp from any to any dst-port 53 out xmit tun10
> add queue 4 tcp from any to any dst-port 53 out xmit tun10
> add queue 4 udp from any to any dst-port 123 out xmit tun10
> queue 4 config pipe 2 weight 100 queue 15kb
>
> # SSH / IRC traffic
> add queue 5 tcp from any to any dst-port 22,6667,6666 in recv tun10
> add queue 5 tcp from any to any src-port 22,6667,6666 in recv tun10
> add queue 5 tcp from 130.130.69.5 to any src-port 1 in recv tun10
> queue 5 config pipe 1 weight 90 queue 15kb
>
> add queue 6 tcp from any to any dst-port 22,6667,6666 out xmit tun10
> add queue 6 tcp from any to any src-port 22,6667,6666 out xmit tun10
> add queue 6 tcp from any to 130.130.69.5 dst-port 1 out xmit tun10
> queue 6 config pipe 2 weight 90 queue 10kb
>
> # Web Traffic
> add queue 5 tcp from any to any src-port 80 in recv tun10
> add queue 5 tcp from any to any dst-port 80 in recv tun10
> queue 5 config pipe 1 weight 40 queue 10kb
>
> add queue 6 tcp from any to any dst-port 80 out xmit tun10
> add queue 6 tcp from any to any src-port 80 out xmit tun10
> queue 6 config pipe 1 weight 40 queue 10kb
> ------8<------8<------8<-------

-- 
Best regards,				| mlaier@freebsd.org
Max Laier				| ICQ #67774661
http://pf4freebsd.love2party.net/	| mlaier@EFnet

--Boundary-00=_e2SRAowAWXRIihV
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="ip_dummynet.c.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="ip_dummynet.c.diff"

Index: ip_dummynet.c
===================================================================
RCS file: /cvsdrop/mlaier/fcvs/src/sys/netinet/ip_dummynet.c,v
retrieving revision 1.79
diff -u -r1.79 ip_dummynet.c
--- ip_dummynet.c	25 Feb 2004 19:55:28 -0000	1.79
+++ ip_dummynet.c	3 Mar 2004 00:17:17 -0000
@@ -1616,6 +1616,7 @@
 	if (b == NULL || b->pipe_nr != p->pipe_nr) { /* new pipe */
 	    x = malloc(sizeof(struct dn_pipe), M_DUMMYNET, M_NOWAIT | M_ZERO);
 	    if (x == NULL) {
+	    	DUMMYNET_UNLOCK();
 		printf("dummynet: no memory for new pipe\n");
 		return ENOSPC;
 	    }
@@ -1664,8 +1665,10 @@
 		 a = b , b = b->next) ;
 
 	if (b == NULL || b->fs_nr != pfs->fs_nr) { /* new  */
-	    if (pfs->parent_nr == 0)	/* need link to a pipe */
+	    if (pfs->parent_nr == 0) {	/* need link to a pipe */
+	    	DUMMYNET_UNLOCK();
 		return EINVAL ;
+	    }
 	    x = malloc(sizeof(struct dn_flow_set), M_DUMMYNET, M_NOWAIT|M_ZERO);
 	    if (x == NULL) {
 		DUMMYNET_UNLOCK();
@@ -1681,8 +1684,10 @@
 		x->weight = 100 ;
 	} else {
 	    /* Change parent pipe not allowed; must delete and recreate */
-	    if (pfs->parent_nr != 0 && b->parent_nr != pfs->parent_nr)
+	    if (pfs->parent_nr != 0 && b->parent_nr != pfs->parent_nr) {
+	    	DUMMYNET_UNLOCK();
 		return EINVAL ;
+	    }
 	    x = b;
 	}
 	set_fs_parms(x, pfs);

--Boundary-00=_e2SRAowAWXRIihV--



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