summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2013-03-12 18:16:36 +0100
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-03-18 14:31:25 +0200
commit4f385e17ccb2f05fa1b472d173ed143447090ce2 (patch)
treedbffbb38fdf6cf21ec301d30bebfda6ebd201d6c
parenta4da55c902da1c312b939cd9f6fac240559d9140 (diff)
downloadconnman-4f385e17ccb2f05fa1b472d173ed143447090ce2.tar.gz
connman-4f385e17ccb2f05fa1b472d173ed143447090ce2.tar.bz2
connman-4f385e17ccb2f05fa1b472d173ed143447090ce2.zip
iptables: Add __connman_iptables_dump()
In order to allow our test tool iptables-tests to dump a table we need an dump function. The only user will be this tool. That allows the linker to remove this code, so no additional code size.
-rw-r--r--src/connman.h1
-rw-r--r--src/iptables.c15
2 files changed, 16 insertions, 0 deletions
diff --git a/src/connman.h b/src/connman.h
index 19bca740..9a607fb1 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -790,6 +790,7 @@ int __connman_stats_get(struct connman_service *service,
connman_bool_t roaming,
struct connman_stats_data *data);
+int __connman_iptables_dump(const char *table_name);
int __connman_iptables_new_chain(const char *table_name,
const char *chain);
int __connman_iptables_delete_chain(const char *table_name,
diff --git a/src/iptables.c b/src/iptables.c
index ea2a52b0..3fa81406 100644
--- a/src/iptables.c
+++ b/src/iptables.c
@@ -2091,6 +2091,21 @@ static void cleanup_parse_context(struct parse_context *ctx)
g_free(ctx);
}
+int __connman_iptables_dump(const char *table_name)
+{
+ struct connman_iptables *table;
+
+ DBG("-t %s -L", table_name);
+
+ table = pre_load_table(table_name, NULL);
+ if (table == NULL)
+ return -EINVAL;
+
+ dump_table(table);
+
+ return 0;
+}
+
int __connman_iptables_new_chain(const char *table_name,
const char *chain)
{