]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
extensions: libxt_IDLETIMER: use xtables_param_act when checking options
authorLuciano Coelho <luciano.coelho@nokia.com>
Thu, 15 Jul 2010 15:12:56 +0000 (17:12 +0200)
committerPatrick McHardy <kaber@trash.net>
Thu, 15 Jul 2010 15:12:56 +0000 (17:12 +0200)
This patch changes custom error messages for illegal options into the
default iptables messages, by using xtables_param_act().

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
extensions/libxt_IDLETIMER.c
extensions/libxt_IDLETIMER.man

index 565f8e390b91c00bf0027093d9176a2092e9401d..c931d0eeea0361d390c76271c9b40a1b993d008c 100644 (file)
@@ -60,23 +60,20 @@ static int idletimer_tg_parse(int c, char **argv, int invert,
 
        switch (c) {
        case 't':
-               if (*flags & IDLETIMER_TG_OPT_TIMEOUT)
-                       xtables_error(PARAMETER_PROBLEM,
-                                     "Cannot specify timeout more than once");
+               xtables_param_act(XTF_ONLY_ONCE, "IDLETIMER", "--timeout",
+                                 *flags & IDLETIMER_TG_OPT_TIMEOUT);
 
                info->timeout = atoi(optarg);
                *flags |= IDLETIMER_TG_OPT_TIMEOUT;
                break;
 
        case 'l':
-               if (*flags & IDLETIMER_TG_OPT_LABEL)
-                       xtables_error(PARAMETER_PROBLEM,
-                                     "Cannot specify label more than once");
+               xtables_param_act(XTF_ONLY_ONCE, "IDLETIMER", "--label",
+                                 *flags & IDLETIMER_TG_OPT_TIMEOUT);
 
                if (strlen(optarg) > MAX_IDLETIMER_LABEL_SIZE - 1)
-                       xtables_error(PARAMETER_PROBLEM,
-                                     "Maximum label length is %u for --label",
-                                     MAX_IDLETIMER_LABEL_SIZE - 1);
+                       xtables_param_act(XTF_BAD_VALUE, "IDLETIMER", "--label",
+                                        optarg);
 
                strcpy(info->label, optarg);
                *flags |= IDLETIMER_TG_OPT_LABEL;
index 3266a448d85dce03afb99c388c06a0ad76fb2690..e3c91cea09304d2c312fb5fd80a30eb64fb59712 100644 (file)
@@ -16,4 +16,5 @@ userspace, which can then decide what to do (eg. disconnect to save power).
 This is the time in seconds that will trigger the notification.
 .TP
 \fB\-\-label\fP \fIstring\fP
-This is a unique identifier for the timer.
+This is a unique identifier for the timer.  The maximum length for the
+label string is 27 characters.