diff options
author | Bart De Schuymer <bdschuym@pandora.be> | 2005-07-24 09:46:09 +0000 |
---|---|---|
committer | Bart De Schuymer <bdschuym@pandora.be> | 2005-07-24 09:46:09 +0000 |
commit | bb164972f9a8d967c486904371e4410a09b4e6a1 (patch) | |
tree | fef5561ebf9f79a382474c36d05c12f7e43ce514 | |
parent | baa2ada77c0c1d98acbf3127bf7beefb651e788e (diff) |
allow -I without rule number
-rw-r--r-- | userspace/ebtables2/ebtables.8 | 10 | ||||
-rw-r--r-- | userspace/ebtables2/ebtables.c | 12 |
2 files changed, 14 insertions, 8 deletions
diff --git a/userspace/ebtables2/ebtables.8 b/userspace/ebtables2/ebtables.8 index 44c12e3..a4c0461 100644 --- a/userspace/ebtables2/ebtables.8 +++ b/userspace/ebtables2/ebtables.8 @@ -87,6 +87,9 @@ This file can be read later, e.g. with .BR "" "The " quit " command lets ebtablesd finish gracefully." All commands, options and extensions that ebtables uses can be used with ebtablesu, except for .BR --init-table ", " --atomic-file ", " --atomic-commit ", " --atomic-init ", " --atomic-save " and " -h . +When using ebtablesd, don't use spaces in string arguments +(like the +.BR --log-prefix " argument)." .br Example usage: .br @@ -117,7 +120,6 @@ Example usage: # echo "ebtablesu commit filter" >> $PIPE .br # echo "ebtablesu quit" >> $PIPE - .SS CHAINS There are three ebtables tables with built-in chains in the Linux kernel. These tables are used to divide functionality into @@ -268,10 +270,12 @@ First the packet counter is specified, then the byte counter. If the specified c with a '+', the counter values are added to the respective current counter values. If the specified counters start with a '-', the counter values are decreased from the respective current counter values. No bounds checking is done. If the counters don't start with '+' or '-', -the current counters are changed to the specified counters. +the current counters are changed to the specified counters. In daemon mode, using '+' or '-' is not +allowed (due to technical reasons). .TP .B "-I, --insert" -Insert the specified rule into the selected chain at the specified rule number. +Insert the specified rule into the selected chain at the specified rule number. If the +rule number is not specified, the rule is added at the head of the chain. If the current number of rules equals .IR N , then the specified number can be diff --git a/userspace/ebtables2/ebtables.c b/userspace/ebtables2/ebtables.c index 2b0807f..08a9e57 100644 --- a/userspace/ebtables2/ebtables.c +++ b/userspace/ebtables2/ebtables.c @@ -712,11 +712,13 @@ int do_command(int argc, char *argv[], int exec_style, return -1; } else if (c == 'I') { if (optind >= argc || (argv[optind][0] == '-' && (argv[optind][1] < '0' || argv[optind][1] > '9'))) - ebt_print_error2("No rulenr for -I specified"); - rule_nr = strtol(argv[optind], &buffer, 10); - if (*buffer != '\0') - ebt_print_error2("Problem with the specified rule number '%s'", argv[optind]); - optind++; + rule_nr = 1; + else { + rule_nr = strtol(argv[optind], &buffer, 10); + if (*buffer != '\0') + ebt_print_error2("Problem with the specified rule number '%s'", argv[optind]); + optind++; + } } else if (c == 'P') { handle_P: if (optind >= argc) |