On Fri, Jul 04, 2014 at 03:50:41PM +0200, Jiri Popelka wrote: > This patch adds an optional numeric argument > to -w option (added with 93587a0) so one can > specify how long to wait for an exclusive lock. > > If the value isn't specified it works as before, > i.e. program waits indefinitely. > > If user specifies it, program exits after > the given time interval passes. > > This patch also adds the -w/--wait to nftables > compat code, so the parser doesn't complain. Applied. I had to fix iptables-compat though: # iptables-compat -I INPUT -w 3 -j ACCEPT Bad argument `3' Try `iptables -h' or 'iptables --help' for more information. I have collapsed the following patch to yours.
diff --git a/iptables/xtables.c b/iptables/xtables.c index f7b1a75..d661dd1 100644 --- a/iptables/xtables.c +++ b/iptables/xtables.c @@ -684,6 +684,7 @@ int do_commandx(struct nft_handle *h, int argc, char *argv[], char **table, { struct iptables_command_state cs; int verbose = 0; + int wait = 0; const char *chain = NULL; const char *policy = NULL, *newname = NULL; unsigned int rulenum = 0, command = 0; @@ -1008,6 +1009,15 @@ int do_commandx(struct nft_handle *h, int argc, char *argv[], char **table, "You cannot use `-w' from " "iptables-restore"); } + if (optarg) { + if (sscanf(optarg, "%i", &wait) != 1) + xtables_error(PARAMETER_PROBLEM, + "wait seconds not numeric"); + } else if (optind < argc && argv[optind][0] != '-' + && argv[optind][0] != '!') + if (sscanf(argv[optind++], "%i", &wait) != 1) + xtables_error(PARAMETER_PROBLEM, + "wait seconds not numeric"); break; case '0':