summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2013-03-19 13:46:27 +0100
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-03-25 13:17:57 +0200
commit4b8c92a7423ddc8e5c306e631f9025092f109284 (patch)
tree72a63d47a12335b815d51ceaf54639d43884406f /tools
parent9c4ddd222b39cb688301ef94f25eae1a1db574d1 (diff)
downloadconnman-4b8c92a7423ddc8e5c306e631f9025092f109284.tar.gz
connman-4b8c92a7423ddc8e5c306e631f9025092f109284.tar.bz2
connman-4b8c92a7423ddc8e5c306e631f9025092f109284.zip
iptables-test: Add insert support
Diffstat (limited to 'tools')
-rw-r--r--tools/iptables-test.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/iptables-test.c b/tools/iptables-test.c
index f20404b5..1d964b9a 100644
--- a/tools/iptables-test.c
+++ b/tools/iptables-test.c
@@ -30,6 +30,7 @@
enum iptables_command {
IPTABLES_COMMAND_APPEND,
+ IPTABLES_COMMAND_INSERT,
IPTABLES_COMMAND_DELETE,
IPTABLES_COMMAND_POLICY,
IPTABLES_COMMAND_CHAIN_INSERT,
@@ -48,12 +49,16 @@ int main(int argc, char *argv[])
opterr = 0;
while ((c = getopt_long(argc, argv,
- "-A:D:P:N:X:F:Lt:", NULL, NULL)) != -1) {
+ "-A:I:D:P:N:X:F:Lt:", NULL, NULL)) != -1) {
switch (c) {
case 'A':
chain = optarg;
cmd = IPTABLES_COMMAND_APPEND;
break;
+ case 'I':
+ chain = optarg;
+ cmd = IPTABLES_COMMAND_INSERT;
+ break;
case 'D':
chain = optarg;
cmd = IPTABLES_COMMAND_DELETE;
@@ -105,6 +110,9 @@ out:
case IPTABLES_COMMAND_APPEND:
err = __connman_iptables_append(table, chain, rule);
break;
+ case IPTABLES_COMMAND_INSERT:
+ err = __connman_iptables_insert(table, chain, rule);
+ break;
case IPTABLES_COMMAND_DELETE:
err = __connman_iptables_delete(table, chain, rule);
break;
@@ -127,7 +135,7 @@ out:
break;
case IPTABLES_COMMAND_UNKNOWN:
printf("Missing command\n");
- printf("usage: iptables-test [-t table] {-A|-D} chain rule\n");
+ printf("usage: iptables-test [-t table] {-A|-I|-D} chain rule\n");
printf(" iptables-test [-t table] {-N|-X|-F} chain\n");
printf(" iptables-test [-t table] -L\n");
printf(" iptables-test [-t table] -P chain target\n");