misc/178317: IPFW options need to specifed in specific order
Kirill Diduk
kirill.diduk at gmail.com
Sun May 5 11:40:01 UTC 2013
The following reply was made to PR kern/178317; it has been noted by GNATS.
From: Kirill Diduk <kirill.diduk at gmail.com>
To: bug-followup at FreeBSD.org, jens.kassel at aptilo.com
Cc: luigi at FreeBSD.org
Subject: Re: misc/178317: IPFW options need to specifed in specific order
Date: Sun, 5 May 2013 14:35:44 +0300
--047d7b6dc9a814b57404dbf6fc68
Content-Type: text/plain; charset=ISO-8859-1
Hello,
The problem is related to the command line parsing implementation in
the file "sbin/ipfw/dummynet.c" (function "ipfw_config_pipe").
Consider the example:
# ipfw pipe 3 config bw 1000000kbit/s mask src-ip 0xffffffff queue 92
When the "mask" token is encountered, it starts to parse FLOW_MASK
options ('src-ip", etc.), and skips the "queue" option. After that,
"92" is parsed as a standalone option which causes an "unrecognised
option" error.
I suggest a simple solution that fixes this problem (attached as
"patch_01.txt").
--------------------------------------------------------------------------------
--- /usr/src/sbin/ipfw/dummynet.c.orig 2013-04-21 01:39:08.000000000 +0000
+++ /usr/src/sbin/ipfw/dummynet.c 2013-05-05 08:45:58.000000000 +0000
@@ -929,6 +929,7 @@
case TOK_QUEUE:
mask->extra = ~0;
*flags |= DN_HAVE_MASK;
+ ac++; av--; /* backtrack */
goto end_mask;
case TOK_DSTIP:
--------------------------------------------------------------------------------
Also, there is a more elegant solution (attached as "patch_02.txt"),
but I'm not sure about it :
--------------------------------------------------------------------------------
--- /usr/src/sbin/ipfw/dummynet.c.orig 2013-04-21 01:39:08.000000000 +0000
+++ /usr/src/sbin/ipfw/dummynet.c 2013-05-05 10:03:40.000000000 +0000
@@ -926,11 +926,6 @@
*flags |= DN_HAVE_MASK;
goto end_mask;
- case TOK_QUEUE:
- mask->extra = ~0;
- *flags |= DN_HAVE_MASK;
- goto end_mask;
-
case TOK_DSTIP:
mask->addr_type = 4;
p32 = &mask->dst_ip;
--------------------------------------------------------------------------------
Luigi, could you help, please? Can we remove the whole case-branch
"TOK_QUEUE" here?
If no, we can apply the first solution ("patch_01.txt"): it restores
the previous behavior of the "ipfw" command line parsing.
Thanks,
Kirill
P.S. This issue is also observed on other FreeBSD releases (e.g. 9.0 and 9.1).
--047d7b6dc9a814b57404dbf6fc68
Content-Type: text/plain; charset=US-ASCII; name="patch_01.txt"
Content-Disposition: attachment; filename="patch_01.txt"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_hgc54wgp0
LS0tIC91c3Ivc3JjL3NiaW4vaXBmdy9kdW1teW5ldC5jLm9yaWcJMjAxMy0wNC0yMSAwMTozOTow
OC4wMDAwMDAwMDAgKzAwMDAKKysrIC91c3Ivc3JjL3NiaW4vaXBmdy9kdW1teW5ldC5jCTIwMTMt
MDUtMDUgMDg6NDU6NTguMDAwMDAwMDAwICswMDAwCkBAIC05MjksNiArOTI5LDcgQEAKIAkJCSAg
ICBjYXNlIFRPS19RVUVVRToKIAkJCQkgICAgbWFzay0+ZXh0cmEgPSB+MDsKIAkJCQkgICAgKmZs
YWdzIHw9IEROX0hBVkVfTUFTSzsKKwkJCQkgICAgYWMrKzsgYXYtLTsgLyogYmFja3RyYWNrICov
CiAJCQkJICAgIGdvdG8gZW5kX21hc2s7CiAKIAkJCSAgICBjYXNlIFRPS19EU1RJUDoK
--047d7b6dc9a814b57404dbf6fc68
Content-Type: text/plain; charset=US-ASCII; name="patch_02.txt"
Content-Disposition: attachment; filename="patch_02.txt"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_hgc54zqq1
LS0tIC91c3Ivc3JjL3NiaW4vaXBmdy9kdW1teW5ldC5jLm9yaWcJMjAxMy0wNC0yMSAwMTozOTow
OC4wMDAwMDAwMDAgKzAwMDAKKysrIC91c3Ivc3JjL3NiaW4vaXBmdy9kdW1teW5ldC5jCTIwMTMt
MDUtMDUgMTA6MDM6NDAuMDAwMDAwMDAwICswMDAwCkBAIC05MjYsMTEgKzkyNiw2IEBACiAJCQkJ
ICAgICpmbGFncyB8PSBETl9IQVZFX01BU0s7CiAJCQkJICAgIGdvdG8gZW5kX21hc2s7CiAKLQkJ
CSAgICBjYXNlIFRPS19RVUVVRToKLQkJCQkgICAgbWFzay0+ZXh0cmEgPSB+MDsKLQkJCQkgICAg
KmZsYWdzIHw9IEROX0hBVkVfTUFTSzsKLQkJCQkgICAgZ290byBlbmRfbWFzazsKLQogCQkJICAg
IGNhc2UgVE9LX0RTVElQOgogCQkJCSAgICBtYXNrLT5hZGRyX3R5cGUgPSA0OwogCQkJCSAgICBw
MzIgPSAmbWFzay0+ZHN0X2lwOwo=
--047d7b6dc9a814b57404dbf6fc68--
More information about the freebsd-ipfw
mailing list