From: Daniel Wagner <[email protected]>
The policy of a chain is the last element not the first one.
---
src/iptables.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/iptables.c b/src/iptables.c
index 086b8bf..aaf51e8 100644
--- a/src/iptables.c
+++ b/src/iptables.c
@@ -1077,7 +1077,7 @@ static int iptables_delete_rule(struct connman_iptables
*table,
static int iptables_change_policy(struct connman_iptables *table,
const char *chain_name, const char *policy)
{
- GList *chain_head;
+ GList *chain_tail;
struct connman_iptables_entry *entry;
struct xt_entry_target *target;
struct xt_standard_target *t;
@@ -1087,14 +1087,11 @@ static int iptables_change_policy(struct
connman_iptables *table,
if (verdict == 0)
return -EINVAL;
- chain_head = find_chain_head(table, chain_name);
- if (chain_head == NULL)
- return -EINVAL;
-
- entry = chain_head->data;
- if (entry->builtin < 0)
+ chain_tail = find_chain_tail(table, chain_name);
+ if (chain_tail == NULL)
return -EINVAL;
+ entry = chain_tail->data;
target = ipt_get_target(entry->entry);
t = (struct xt_standard_target *)target;
--
1.8.1.3.566.gaa39828
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman