diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2013-02-12 10:19:52 +0100 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2013-02-12 12:34:51 +0200 |
commit | 65abac44bf5498ca5565835671226bb6ca45a7d1 (patch) | |
tree | 061c8bb01509c167e1632fa514b0d6a0fb2ba94a /src/iptables.c | |
parent | 836854599db7b31aeab6a72bf1c28e444e8c858a (diff) | |
download | connman-65abac44bf5498ca5565835671226bb6ca45a7d1.tar.gz connman-65abac44bf5498ca5565835671226bb6ca45a7d1.tar.bz2 connman-65abac44bf5498ca5565835671226bb6ca45a7d1.zip |
iptables: Fix fallthrough rules
Diffstat (limited to 'src/iptables.c')
-rw-r--r-- | src/iptables.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/iptables.c b/src/iptables.c index e395af71..c0c96947 100644 --- a/src/iptables.c +++ b/src/iptables.c @@ -295,6 +295,17 @@ static gboolean is_jump(struct connman_iptables_entry *e) return false; } +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; + + return false; +} + static gboolean is_chain(struct connman_iptables *table, struct connman_iptables_entry *e) { @@ -413,6 +424,16 @@ static void update_targets_reference(struct connman_iptables *table, t->verdict += offset; } } + + if (is_fallthrough(modified_entry)) { + t = (struct xt_standard_target *) ipt_get_target(modified_entry->entry); + + t->verdict = entry_before->offset + + modified_entry->entry->target_offset + + ALIGN(sizeof(struct xt_standard_target)); + t->target.u.target_size = + ALIGN(sizeof(struct xt_standard_target)); + } } static int iptables_add_entry(struct connman_iptables *table, |