ip{,6}tables-restore: Fix wait-interval parsing
Phil Sutter
reviewercover ip{,6}tables-restore: Fix wait-interval parsing
This series fixes two problems with parsing of --wait-interval (-W) option.
Phil Sutter (2):
ip{,6}tables-restore: Don't ignore missing wait-interval value ip{,6}tables-restore: Don't accept wait-interval without wait
iptables/ip6tables-restore.c | 5 +++++ iptables/iptables-restore.c | 5 +++++ iptables/xshared.c | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-)
Signature · 1 line
2.13.1
Phil Sutter
reviewerPATCH 1/2 ip{,6}tables-restore: Don't ignore missing wait-interval value
Passing -W without a value doesn't make sense so bail out if none was given.
Signed-off-by Phil Sutter <[email protected]>
--- iptables/xshared.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
iptables/xshared.c +1 -1
@@ -343,7 +343,7 @@ void parse_wait_interval(int argc, char *argv[], struct timeval *wait_interval)else if (xs_has_arg (argc, argv)) arg = argv[optind++];else -return ; +xtables_error (PARAMETER_PROBLEM ,"wait interval value required" ); ret =sscanf (arg,"%u" , &usec);if (ret ==1 ) {
Signature · 1 line
2.13.1
Phil Sutter
reviewerPATCH 2/2 ip{,6}tables-restore: Don't accept wait-interval without wait
In reply to Phil SutterIf -W <val> was given, error out if -w wasn't since that doesn't make sense.
Signed-off-by Phil Sutter <[email protected]>
--- iptables/ip6tables-restore.c | 5 +++++ iptables/iptables-restore.c | 5 +++++ 2 files changed, 10 insertions(+)
iptables/ip6tables-restore.c +5 -0
@@ -273,6 +273,11 @@ int ip6tables_restore_main(int argc, char *argv[]) }else in = stdin; +if (!wait_interval.tv_sec && !wait) { +fprintf (stderr,"Option --wait-interval requires option --wait\n" ); +exit (1 ); + } +/* Grab standard input. */ while (fgets (buffer,sizeof (buffer), in)) {int ret =0 ;
iptables/iptables-restore.c +5 -0
@@ -271,6 +271,11 @@ iptables_restore_main(int argc, char *argv[]) }else in = stdin; +if (!wait_interval.tv_sec && !wait) { +fprintf (stderr,"Option --wait-interval requires option --wait\n" ); +exit (1 ); + } +/* Grab standard input. */ while (fgets (buffer,sizeof (buffer), in)) {int ret =0 ;
Signature · 1 line
2.13.1
Quoted 1 line · Phil Sutter
This series fixes two problems with parsing of --wait-interval (-W) option.
Applied, thanks.