Skip to contentSkip to conversation

plus sign as interface value bug

PATCH Ozgur AKAN 2 participants 2 messages Apr 5, 2004 – Apr 7, 2004 netfilter

lore
Share & tools
lore

Ozgur AKAN

author
#0 lore raw

Hi,

I found a minor bug in iptables.c. Assuming that;

iptables -A INPUT -i + -j ACCEPT == iptables -A INPUT -j ACCEPT

giving "+" as interface value is same as giving no interface value. But the output of "iptables -nvL" is "+" as interface value for "-i +". If no interface value is given "iptables -nvL" prints "*". (Also iptables-save ignores single "+" as interface value, as normally it should)

This can be fixed by changing "if (vialen == 0)" in iptables.c

"if ( (vialen == 0) || (vialen == 1 && vianame[0] == '+') )"

I attached the patches for iptables.c and ip6tables.c.

regards,
Ozgur AKAN

iptables_dev/ip6tables.c renamed from iptables/ip6tables.c +1 -1
@@ -840,7 +840,7 @@ parse_interface(const char *arg, char *v
 			   " (%i)", arg, IFNAMSIZ-1);
 
 	strcpy(vianame, arg);
-	if (vialen == 0)
+	if ( (vialen == 0) || (vialen == 1 && vianame[0] == '+') )
 		memset(mask, 0, IFNAMSIZ);
 	else if (vianame[vialen - 1] == '+') {
 		memset(mask, 0xFF, vialen - 1);
iptables_dev/iptables.c renamed from iptables/iptables.c +1 -1
@@ -780,7 +780,7 @@ parse_interface(const char *arg, char *v
 			   " (%i)", arg, IFNAMSIZ-1);
 
 	strcpy(vianame, arg);
-	if (vialen == 0)
+	if ( (vialen == 0) || (vialen == 1 && vianame[0] == '+') )
 		memset(mask, 0, IFNAMSIZ);
 	else if (vianame[vialen - 1] == '+') {
 		memset(mask, 0xFF, vialen - 1);
#1 lore raw
Quoted 3 lines · Ozgur AKAN

Hi,

I found a minor bug in iptables.c. Assuming that;

thanks, patch applied.

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie