iptables: Fix is_fallthrough() check
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Wed, 6 Mar 2013 15:08:49 +0000 (16:08 +0100)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 7 Mar 2013 08:07:06 +0000 (10:07 +0200)
A fallthrough rule is one which has the default target name,
does not have a verdict and is not a jump rule.

is_fallthrough() is called excluslive from the insert path,
thus the value of verdict will be 0 for a fallthrough rule.

src/iptables.c

index c5776b1..fe5214a 100644 (file)
@@ -301,9 +301,13 @@ static gboolean is_fallthrough(struct connman_iptables_entry *e)
        struct xt_entry_target *target;
 
        target = ipt_get_target(e->entry);
-       if (!strcmp(target->u.user.name, ""))
-               return true;
+       if (!g_strcmp0(target->u.user.name, IPT_STANDARD_TARGET)) {
+               struct xt_standard_target *t;
 
+               t = (struct xt_standard_target *)target;
+               if (t->verdict == 0)
+                       return true;
+       }
        return false;
 }