summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2010-10-25 16:15:17 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2010-10-25 16:15:56 +0200
commit09bbe2bde426efe3608cd72cdaf3d7414e434c3c (patch)
treef8a9a330dcc64df850c72b7242d5a0b7de6cc7d7
parentd9ccd472903ec7b46bf88571961c35d5d3489dab (diff)
downloadconnman-09bbe2bde426efe3608cd72cdaf3d7414e434c3c.tar.gz
connman-09bbe2bde426efe3608cd72cdaf3d7414e434c3c.tar.bz2
connman-09bbe2bde426efe3608cd72cdaf3d7414e434c3c.zip
iptables-test: Add -t option support
This will be needed for masquerading support.
-rw-r--r--tools/iptables-test.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/tools/iptables-test.c b/tools/iptables-test.c
index 891d219b..c4796185 100644
--- a/tools/iptables-test.c
+++ b/tools/iptables-test.c
@@ -692,28 +692,25 @@ static struct option connman_iptables_opts[] = {
{.name = "jump", .has_arg = 1, .val = 'j'},
{.name = "match", .has_arg = 1, .val = 'm'},
{.name = "out-interface", .has_arg = 1, .val = 'o'},
+ {.name = "table", .has_arg = 1, .val = 't'},
{NULL},
};
int main(int argc, char *argv[])
{
struct connman_iptables *table;
- char *chain, *new_chain, *match_name, *target_name;
+ char *table_name, *chain, *new_chain, *match_name, *target_name;
int c;
gboolean dump;
xtables_init();
xtables_set_nfproto(NFPROTO_IPV4);
- table = connman_iptables_init("filter");
- if (table == NULL)
- return -1;
-
dump = FALSE;
- chain = new_chain = match_name = target_name = NULL;
+ table_name = chain = new_chain = match_name = target_name = NULL;
while ((c = getopt_long(argc, argv,
- "-A:L::N:j:i:m:o:", connman_iptables_opts, NULL)) != -1) {
+ "-A:L::N:j:i:m:o:t:", connman_iptables_opts, NULL)) != -1) {
switch (c) {
case 'A':
chain = optarg;
@@ -741,12 +738,23 @@ int main(int argc, char *argv[])
case 'o':
break;
+ case 't':
+ table_name = optarg;
+ break;
+
default:
printf("default %s\n", optarg);
}
}
+ if (table_name == NULL)
+ table_name = "filter";
+
+ table = connman_iptables_init(table_name);
+ if (table == NULL)
+ return -1;
+
if (dump) {
connman_iptables_dump(table);