diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2013-02-12 10:19:55 +0100 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2013-02-12 12:35:14 +0200 |
commit | bd7abd9c3f5c8c971e453da9ecdfdea77f5ba7bf (patch) | |
tree | 3233d927e168e2ccde4fd68581348e5ecb46a595 /src/iptables.c | |
parent | 3e95870df42bc69c8a7afae8860fc23a00fba7b4 (diff) | |
download | connman-bd7abd9c3f5c8c971e453da9ecdfdea77f5ba7bf.tar.gz connman-bd7abd9c3f5c8c971e453da9ecdfdea77f5ba7bf.tar.bz2 connman-bd7abd9c3f5c8c971e453da9ecdfdea77f5ba7bf.zip |
iptables: Update the hook entries correctly in iptables_delete_rule()
The builtin value is only valid in the chain head entry and not
in any other entry. That means we need to lookup the head entry
and use that builtin value (== hook id) and then update all
references which follow that chain.
Diffstat (limited to 'src/iptables.c')
-rw-r--r-- | src/iptables.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/iptables.c b/src/iptables.c index 97b9539b..83612b9e 100644 --- a/src/iptables.c +++ b/src/iptables.c @@ -970,11 +970,15 @@ static int iptables_delete_rule(struct connman_iptables *table, struct xtables_rule_match *xt_rm) { struct connman_iptables_entry *entry; - GList *chain_tail, *list; + GList *chain_head, *chain_tail, *list; int builtin, removed; removed = 0; + chain_head = find_chain_head(table, chain_name); + if (chain_head == NULL) + return -EINVAL; + chain_tail = find_chain_tail(table, chain_name); if (chain_tail == NULL) return -EINVAL; @@ -984,12 +988,13 @@ static int iptables_delete_rule(struct connman_iptables *table, if (list == NULL) return -EINVAL; + entry = chain_head->data; + builtin = entry->builtin; + entry = list->data; if (entry == NULL) return -EINVAL; - builtin = entry->builtin; - /* We have deleted a rule, * all references should be bumped accordingly */ if (list->next != NULL) |