Skip to contentSkip to conversation

iptables: fix the dead loop when meeting unknown options

PATCH In review Changli Gao 2 participants 3 messages Mar 14, 2011 – Apr 14, 2011 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iptables: fix the dead loop when meeting unknown options

---
 xshared.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xshared.c +1 -1
index 404a9f5..87402b4 100644
@@ -92,7 +92,7 @@ static bool should_load_proto(struct iptables_command_state *cs)
 	if (find_proto(cs->protocol, XTF_DONT_LOAD,
 	    cs->options & OPT_NUMERIC, NULL) == NULL)
 		return true;
-	return cs->proto_used;
+	return !cs->proto_used;
 }
 
 struct xtables_match *load_proto(struct iptables_command_state *cs)
#1 lore raw
Quoted 9 lines · Changli Gao

---
xshared.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
xshared.c +0 -0
index 404a9f5..87402b4 100644

xshared.c static bool should_load_proto(struct iptables_command_state *cs) · line 96

Quoted 6 lines
xshared.c +1 -1
@@ -92,7 +92,7 @@ static bool should_load_proto(struct iptables_command_state *cs)
 	if (find_proto(cs->protocol, XTF_DONT_LOAD,
 	    cs->options & OPT_NUMERIC, NULL) == NULL)
 		return true;
-	return cs->proto_used;
+	return !cs->proto_used;
 }

Could you, for completeness, give the command that causes the infinite loop?

thanks,
Jan

#2 lore raw
Quoted 12 lines · Jan Engelhardt
Quoted 10 lines · Changli Gao

---
xshared.c |    2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
xshared.c +0 -0
index 404a9f5..87402b4 100644
@@ -92,7 +92,7 @@ static bool should_load_proto(struct iptables_command_state *cs)
       if (find_proto(cs->protocol, XTF_DONT_LOAD,
Quoted 9 lines

xshared.c static bool should_load_proto(struct iptables_command_state *cs) · line 96

Quoted 5 lines
xshared.c +1 -1
           cs->options & OPT_NUMERIC, NULL) == NULL)
               return true;
-      return cs->proto_used;
+      return !cs->proto_used;
 }

Could you, for completeness, give the command that causes the infinite loop?

I can't remember it clearly. At that time, I was testing connlimit. Maybe a spell mistake in the option list for connlimit. You can refer to the comment above the code, and the code isn't consistent with the comment. This bug maybe just a typo by you. :)

Signature · 6 lines
Regards,
Changli Gao([email protected])
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html