[PATCH 2/2] iptables: fixing rule insertion in a builtin chain

Tomasz Bursztyka tomasz.bursztyka at linux.intel.com
Mon Feb 6 05:24:22 PST 2012


---
 src/iptables.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/iptables.c b/src/iptables.c
index 1494216..457b1e1 100644
--- a/src/iptables.c
+++ b/src/iptables.c
@@ -696,7 +696,10 @@ static int iptables_insert_rule(struct connman_iptables *table,
 	if (new_entry == NULL)
 		return -EINVAL;
 
-	ret = iptables_add_entry(table, new_entry, chain_head->next, builtin);
+	if (builtin == -1)
+		chain_head = chain_head->next;
+
+	ret = iptables_add_entry(table, new_entry, chain_head, builtin);
 	if (ret < 0)
 		g_free(new_entry);
 
-- 
1.7.8.4




More information about the connman mailing list