projects
/
framework
/
connectivity
/
connman.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
da35161
)
iptables: Added helper function to remove table entry
author
Tomasz Bursztyka
<tomasz.bursztyka@linux.intel.com>
Fri, 23 Sep 2011 11:43:35 +0000
(14:43 +0300)
committer
Samuel Ortiz
<sameo@linux.intel.com>
Thu, 29 Sep 2011 15:52:59 +0000
(17:52 +0200)
src/iptables.c
patch
|
blob
|
history
diff --git
a/src/iptables.c
b/src/iptables.c
index
45c71cd
..
fec4fb8
100644
(file)
--- a/
src/iptables.c
+++ b/
src/iptables.c
@@
-335,6
+335,22
@@
static int iptables_add_entry(struct connman_iptables *table,
return 0;
}
return 0;
}
+static int remove_table_entry(struct connman_iptables *table,
+ struct connman_iptables_entry *entry)
+{
+ int removed = 0;
+
+ table->num_entries--;
+ table->size -= entry->entry->next_offset;
+ removed = entry->entry->next_offset;
+
+ g_free(entry->entry);
+
+ table->entries = g_list_remove(table->entries, entry);
+
+ return removed;
+}
+
static int iptables_flush_chain(struct connman_iptables *table,
char *name)
{
static int iptables_flush_chain(struct connman_iptables *table,
char *name)
{
@@
-365,13
+381,7
@@
static int iptables_flush_chain(struct connman_iptables *table,
entry = list->data;
next = g_list_next(list);
entry = list->data;
next = g_list_next(list);
- table->num_entries--;
- table->size -= entry->entry->next_offset;
- removed += entry->entry->next_offset;
-
- g_free(entry->entry);
-
- table->entries = g_list_remove(table->entries, list->data);
+ removed += remove_table_entry(table, entry);
list = next;
}
list = next;
}