Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Apr 1996 09:26:18 +0100
From:      "Frank ten Wolde" <franky@pinewood.nl>
To:        current@FreeBSD.ORG
Subject:   src/sbin/ipfw/ipfw.c broken (2.2-960323-SNAPSHOT, fix supplied)
Message-ID:  <9604010926.ZM20722@pwood1.pinewood.nl>

next in thread | raw e-mail | index | archive | help
Hello,

I think I have found some small bugs in /usr/src/sbin/ipfw/ipfw.c
(2.2-960323-SNAPSHOT):

	1. Adding a port-range causes a SEGV:

		ipfw add accept all from any 1024-2048 to any

	   Problem is at line 366 where (*av == NULL).

	2. Listing a DST port-range when a SRC port range is in
	   effect causes the DST port range to be listed with a
	   ',' instead of a '-'.  Problem is at line 178.

	3. The usage is misleading:

	   ...
	   action: {allow|deny|reject|count}[,log]
	   ...

	   Should read:

	   action: {allow|deny|reject|count} [log]

	   (note the space and the removal of the ',')

I'm not sure who maintains this code so I post it here expecting it
to be picked up by the appropriate person(s).


--- SNIP SNIP SNIP SNIP SNIP SNIP SNIP SNIP SNIP SNIP SNIP SNIP ---
*** /usr/src/sbin/ipfw/ipfw.c.orig	Sat Feb 24 14:39:46 1996
--- /usr/src/sbin/ipfw/ipfw.c	Mon Apr  1 10:24:22 1996
***************
*** 175,181 ****
  	comma = " ";
  	for (i=0;i<chain->fw_ndp;i++) {
  		printf("%s%d",comma,chain->fw_pts[chain->fw_nsp+i]);
! 		if (i==chain->fw_nsp && (chain->fw_flg & IP_FW_F_DRNG))
  			comma = "-";
  		else
  		    comma = ",";
--- 175,181 ----
  	comma = " ";
  	for (i=0;i<chain->fw_ndp;i++) {
  		printf("%s%d",comma,chain->fw_pts[chain->fw_nsp+i]);
! 		if (i==0 && (chain->fw_flg & IP_FW_F_DRNG))
  		    comma = "-";
  		else
  		    comma = ",";
***************
*** 281,287 ****
  "\t\tlist [number]\n"
  "\t\tzero [number]\n"
  "\trule:\taction proto src dst extras...\n"
! "\t\taction: {allow|deny|reject|count}[,log]\n"
  "\t\tproto: {ip|tcp|udp|icmp}}\n"
  "\t\tsrc: {any|ip[{/bits|:mask}]} [{port|port-port},...]\n"
  "\t\tdst: {any|ip[{/bits|:mask}]} [{port|port-port},...]\n"
--- 281,287 ----
  "\t\tlist [number]\n"
  "\t\tzero [number]\n"
  "\trule:\taction proto src dst extras...\n"
! "\t\taction: {allow|deny|reject|count} [log]\n"
  "\t\tproto: {ip|tcp|udp|icmp}}\n"
  "\t\tsrc: {any|ip[{/bits|:mask}]} [{port|port-port},...]\n"
  "\t\tdst: {any|ip[{/bits|:mask}]} [{port|port-port},...]\n"
***************
*** 362,368 ****
  		sc = 0;
  		i = 1;
  	}
! 	while (1) {
  		s = strchr(*av,',');
  		if (s) {
  			sc = *s;
--- 362,368 ----
  		sc = 0;
  		i = 1;
  	}
! 	while (*av != NULL) {
  		s = strchr(*av,',');
  		if (s) {
  			sc = *s;
--- SNIP SNIP SNIP SNIP SNIP SNIP SNIP SNIP SNIP SNIP SNIP SNIP ---

-Frank

-- 
----------------------------------------------------------------------
F.W. ten Wolde (PA3FMT)                       Pinewood Automation B.V.
E-mail: franky@pinewood.nl                    Kluyverweg 2a
Phone: +31-15 2682543                         2629 HT  Delft



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