summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2011-09-23 14:43:46 +0300
committerSamuel Ortiz <sameo@linux.intel.com>2011-09-29 17:52:59 +0200
commit35eacc1b475ddd6b257015bb9877c3fd06e50930 (patch)
treead7bad842d9c187fad53b563cf0f135bc753a44f
parent43942edac97ce210bdd58ca105e1c19cbe5238d7 (diff)
downloadconnman-35eacc1b475ddd6b257015bb9877c3fd06e50930.tar.gz
connman-35eacc1b475ddd6b257015bb9877c3fd06e50930.tar.bz2
connman-35eacc1b475ddd6b257015bb9877c3fd06e50930.zip
iptables: Adding capability to load necessary modules
-rw-r--r--src/iptables.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/iptables.c b/src/iptables.c
index d97efea7..142d277a 100644
--- a/src/iptables.c
+++ b/src/iptables.c
@@ -1138,11 +1138,25 @@ static void table_cleanup(struct connman_iptables *table)
static struct connman_iptables *iptables_init(char *table_name)
{
- struct connman_iptables *table;
+ struct connman_iptables *table = NULL;
+ char *module = NULL;
socklen_t s;
DBG("%s", table_name);
+ if (xtables_insmod("ip_tables", NULL, TRUE) != 0)
+ goto err;
+
+ module = g_strconcat("iptable_", table_name, NULL);
+ if (module == NULL)
+ goto err;
+
+ if (xtables_insmod(module, NULL, TRUE) != 0)
+ goto err;
+
+ g_free(module);
+ module = NULL;
+
table = g_hash_table_lookup(table_hash, table_name);
if (table != NULL)
return table;
@@ -1194,6 +1208,7 @@ static struct connman_iptables *iptables_init(char *table_name)
return table;
err:
+ g_free(module);
table_cleanup(table);