Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 May 1999 08:20:04 -0700 (PDT)
From:      Ruslan Ermilov <ru@ucb.crimea.ua>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/10889: kernel panics during ipfw flush with dummynet pipes configured
Message-ID:  <199905181520.IAA18320@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/10889; it has been noted by GNATS.

From: Ruslan Ermilov <ru@ucb.crimea.ua>
To: freebsd-gnats-submit@freebsd.org, maxim@cris.crimea.ua,
	luigi@freebsd.org
Cc:  
Subject: Re: kern/10889: kernel panics during ipfw flush with dummynet pipes configured
Date: Tue, 18 May 1999 18:13:29 +0300

 --J2SCkAp4GZ/dPZZf
 Content-Type: text/plain; charset=us-ascii
 
 Looking into "ip_dummynet.c,v 1.7.2.5 1999/05/04 16:23:57 luigi", we can see:
 /*
  * when a firewall rule is deleted, scan all pipes and remove the flow-id
  * from packets matching this rule.
  */
 void
 dn_rule_delete(void *r)
 
 
 Looking into "ip_fw.c,v 1.103.2.3 1999/04/26 14:59:02 luigi", we see
 that dn_rule_delete() is called whenever one rule is deleted, but it
 is not called when flushing rules.  This may cause the kernel to panic.
 The ip_fw.c.patch fixes this bug.
 
 The second patch (ipfw.c.patch) does the following:
 1. Documents pipe commands
 2. Implements "pipe flush" command
 3. Fixes the "floating exception" bug for "pipe configure" command.
 
 The patches are against RELENG_3, but also suitable for CURRENT as
 well.
 
 -- 
 Ruslan Ermilov		Sysadmin and DBA of the
 ru@ucb.crimea.ua	United Commercial Bank
 +380.652.247.647	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age
 
 --J2SCkAp4GZ/dPZZf
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="ip_fw.c.patch"
 
 Index: ip_fw.c
 ===================================================================
 RCS file: /usr/FreeBSD-CVS/src/sys/netinet/ip_fw.c,v
 retrieving revision 1.103.2.3
 diff -u -r1.103.2.3 ip_fw.c
 --- ip_fw.c	1999/04/26 14:59:02	1.103.2.3
 +++ ip_fw.c	1999/05/18 14:22:30
 @@ -1169,6 +1169,9 @@
  		     fcp = ip_fw_chain.lh_first) {
  			s = splnet();
  			LIST_REMOVE(fcp, chain);
 +#ifdef DUMMYNET
 +			dn_rule_delete(fcp) ;
 +#endif
  			FREE(fcp->rule, M_IPFW);
  			FREE(fcp, M_IPFW);
  			splx(s);
 
 --J2SCkAp4GZ/dPZZf
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="ipfw.c.patch"
 
 Index: ipfw.c
 ===================================================================
 RCS file: /usr/FreeBSD-CVS/src/sbin/ipfw/ipfw.c,v
 retrieving revision 1.64.2.1
 diff -u -r1.64.2.1 ipfw.c
 --- ipfw.c	1999/01/25 19:17:07	1.64.2.1
 +++ ipfw.c	1999/05/18 13:55:14
 @@ -572,16 +572,17 @@
  		warnx("error: %s", buf);
  	}
  	fprintf(stderr, "usage: ipfw [options]\n"
 -"    flush\n"
 +"    [pipe] flush\n"
  "    add [number] rule\n"
 -"    delete number ...\n"
 -"    list [number ...]\n"
 -"    show [number ...]\n"
 +"    [pipe] delete number ...\n"
 +"    [pipe] list [number ...]\n"
 +"    [pipe] show [number ...]\n"
  "    zero [number ...]\n"
 +"    pipe number config [pipecfg]\n"
  "  rule:  action proto src dst extras...\n"
  "    action:\n"
  "      {allow|permit|accept|pass|deny|drop|reject|unreach code|\n"
 -"       reset|count|skipto num|divert port|tee port|fwd ip} [log]\n"
 +"       reset|count|skipto num|divert port|tee port|fwd ip|pipe num} [log]\n"
  "    proto: {ip|tcp|udp|icmp|<number>}\n"
  "    src: from [not] {any|ip[{/bits|:mask}]} [{port|port-port},[port],...]\n"
  "    dst: to [not] {any|ip[{/bits|:mask}]} [{port|port-port},[port],...]\n"
 @@ -593,7 +594,12 @@
  "    {established|setup}\n"
  "    tcpflags [!]{syn|fin|rst|ack|psh|urg},...\n"
  "    ipoptions [!]{ssrr|lsrr|rr|ts},...\n"
 -"    icmptypes {type[,type]}...\n");
 +"    icmptypes {type[,type]}...\n"
 +"  pipecfg:\n"
 +"    {bw|bandwidth} <number>{bit/s|Kbit/s|Mbit/s|Bytes/s|KBytes/s|MBytes/s}\n"
 +"    delay <milliseconds>\n"
 +"    queue <size>{packets|Bytes|KBytes}\n"
 +"    plr <fraction>\n");
  
  	exit(EX_USAGE);
  }
 @@ -965,6 +971,10 @@
              } else if (!strncmp(*av,"plr",strlen(*av)) ) {
                  
                  double d = strtod(av[1], NULL);
 +		if (d > 1)
 +			d = 1;
 +		else if (d < 0)
 +			d = 0;
                  pipe.plr = (int)(d*0x7fffffff) ;
                  av+=2; ac-=2;
              } else if (!strncmp(*av,"queue",strlen(*av)) ) {
 @@ -1439,10 +1449,14 @@
  				do_flush = 1;
  		}
  		if ( do_flush ) {
 -			if (setsockopt(s,IPPROTO_IP,IP_FW_FLUSH,NULL,0) < 0)
 -				err(EX_UNAVAILABLE, "setsockopt(%s)", "IP_FW_FLUSH");
 +			if (setsockopt(s, IPPROTO_IP,
 +			    do_pipe ? IP_DUMMYNET_FLUSH : IP_FW_FLUSH, NULL, 0))
 +				err(EX_UNAVAILABLE, "setsockopt(IP_%s_FLUSH)",
 +				    do_pipe ? "DUMMYNET" : "FW");
 +
  			if (!do_quiet)
 -				printf("Flushed all rules.\n");
 +				printf("Flushed all %s.\n",
 +				    do_pipe ? "pipes" : "rules");
  		}
  	} else if (!strncmp(*av, "zero", strlen(*av))) {
  		zero(ac,av);
 
 --J2SCkAp4GZ/dPZZf--
 


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




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