]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
libxtables: prefix/order - param_act
authorJan Engelhardt <jengelh@medozas.de>
Tue, 27 Jan 2009 20:27:19 +0000 (21:27 +0100)
committerJan Engelhardt <jengelh@medozas.de>
Fri, 30 Jan 2009 02:27:53 +0000 (03:27 +0100)
Changes:
exittype -> xtables_exittype
P_* -> XTF_* flags

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 files changed:
extensions/libxt_CONNMARK.c
extensions/libxt_MARK.c
extensions/libxt_TOS.c
extensions/libxt_TPROXY.c
extensions/libxt_connmark.c
extensions/libxt_conntrack.c
extensions/libxt_hashlimit.c
extensions/libxt_iprange.c
extensions/libxt_mark.c
extensions/libxt_owner.c
extensions/libxt_tos.c
include/xtables.h.in
ip6tables.c
iptables-xml.c
iptables.c
xtables.c

index f979f282d5a69a1320b50d2e62704d9411b29d52..e426e4f1fa2d12ae6afdd034dcbd42c49d00436c 100644 (file)
@@ -158,14 +158,14 @@ static int connmark_tg_parse(int c, char **argv, int invert,
        switch (c) {
        case '=': /* --set-xmark */
        case '-': /* --set-mark */
-               param_act(P_ONE_ACTION, "CONNMARK", *flags & F_MARK);
+               xtables_param_act(XTF_ONE_ACTION, "CONNMARK", *flags & F_MARK);
                if (!xtables_strtoui(optarg, &end, &value, 0, UINT32_MAX))
-                       param_act(P_BAD_VALUE, "CONNMARK", "--set-xmark/--set-mark", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "CONNMARK", "--set-xmark/--set-mark", optarg);
                if (*end == '/')
                        if (!xtables_strtoui(end + 1, &end, &mask, 0, UINT32_MAX))
-                               param_act(P_BAD_VALUE, "CONNMARK", "--set-xmark/--set-mark", optarg);
+                               xtables_param_act(XTF_BAD_VALUE, "CONNMARK", "--set-xmark/--set-mark", optarg);
                if (*end != '\0')
-                       param_act(P_BAD_VALUE, "CONNMARK", "--set-xmark/--set-mark", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "CONNMARK", "--set-xmark/--set-mark", optarg);
                info->mode   = XT_CONNMARK_SET;
                info->ctmark = value;
                info->ctmask = mask;
@@ -175,9 +175,9 @@ static int connmark_tg_parse(int c, char **argv, int invert,
                return true;
 
        case '&': /* --and-mark */
-               param_act(P_ONE_ACTION, "CONNMARK", *flags & F_MARK);
+               xtables_param_act(XTF_ONE_ACTION, "CONNMARK", *flags & F_MARK);
                if (!xtables_strtoui(optarg, NULL, &mask, 0, UINT32_MAX))
-                       param_act(P_BAD_VALUE, "CONNMARK", "--and-mark", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "CONNMARK", "--and-mark", optarg);
                info->mode   = XT_CONNMARK_SET;
                info->ctmark = 0;
                info->ctmask = ~mask;
@@ -185,9 +185,9 @@ static int connmark_tg_parse(int c, char **argv, int invert,
                return true;
 
        case '|': /* --or-mark */
-               param_act(P_ONE_ACTION, "CONNMARK", *flags & F_MARK);
+               xtables_param_act(XTF_ONE_ACTION, "CONNMARK", *flags & F_MARK);
                if (!xtables_strtoui(optarg, NULL, &value, 0, UINT32_MAX))
-                       param_act(P_BAD_VALUE, "CONNMARK", "--or-mark", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "CONNMARK", "--or-mark", optarg);
                info->mode   = XT_CONNMARK_SET;
                info->ctmark = value;
                info->ctmask = value;
@@ -195,9 +195,9 @@ static int connmark_tg_parse(int c, char **argv, int invert,
                return true;
 
        case '^': /* --xor-mark */
-               param_act(P_ONE_ACTION, "CONNMARK", *flags & F_MARK);
+               xtables_param_act(XTF_ONE_ACTION, "CONNMARK", *flags & F_MARK);
                if (!xtables_strtoui(optarg, NULL, &value, 0, UINT32_MAX))
-                       param_act(P_BAD_VALUE, "CONNMARK", "--xor-mark", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "CONNMARK", "--xor-mark", optarg);
                info->mode   = XT_CONNMARK_SET;
                info->ctmark = value;
                info->ctmask = 0;
@@ -205,13 +205,13 @@ static int connmark_tg_parse(int c, char **argv, int invert,
                return true;
 
        case 'S': /* --save-mark */
-               param_act(P_ONE_ACTION, "CONNMARK", *flags & F_MARK);
+               xtables_param_act(XTF_ONE_ACTION, "CONNMARK", *flags & F_MARK);
                info->mode = XT_CONNMARK_SAVE;
                *flags |= F_MARK | F_SR_MARK;
                return true;
 
        case 'R': /* --restore-mark */
-               param_act(P_ONE_ACTION, "CONNMARK", *flags & F_MARK);
+               xtables_param_act(XTF_ONE_ACTION, "CONNMARK", *flags & F_MARK);
                info->mode = XT_CONNMARK_RESTORE;
                *flags |= F_MARK | F_SR_MARK;
                return true;
@@ -222,7 +222,7 @@ static int connmark_tg_parse(int c, char **argv, int invert,
                                   "or --restore-mark is required for "
                                   "--nfmask");
                if (!xtables_strtoui(optarg, NULL, &value, 0, UINT32_MAX))
-                       param_act(P_BAD_VALUE, "CONNMARK", "--nfmask", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "CONNMARK", "--nfmask", optarg);
                info->nfmask = value;
                return true;
 
@@ -232,7 +232,7 @@ static int connmark_tg_parse(int c, char **argv, int invert,
                                   "or --restore-mark is required for "
                                   "--ctmask");
                if (!xtables_strtoui(optarg, NULL, &value, 0, UINT32_MAX))
-                       param_act(P_BAD_VALUE, "CONNMARK", "--ctmask", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "CONNMARK", "--ctmask", optarg);
                info->ctmask = value;
                return true;
 
@@ -242,7 +242,7 @@ static int connmark_tg_parse(int c, char **argv, int invert,
                                   "or --restore-mark is required for "
                                   "--mask");
                if (!xtables_strtoui(optarg, NULL, &value, 0, UINT32_MAX))
-                       param_act(P_BAD_VALUE, "CONNMARK", "--mask", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "CONNMARK", "--mask", optarg);
                info->nfmask = info->ctmask = value;
                return true;
        }
index fd28196eb2bd5193565e712b72dc3301ecf5da33..8f04e8e7f332aba6762186b33b3c87ad56e1e765 100644 (file)
@@ -134,15 +134,15 @@ static int mark_tg_parse(int c, char **argv, int invert, unsigned int *flags,
        switch (c) {
        case 'X': /* --set-xmark */
        case '=': /* --set-mark */
-               param_act(P_ONE_ACTION, "MARK", *flags & F_MARK);
-               param_act(P_NO_INVERT, "MARK", "--set-xmark/--set-mark", invert);
+               xtables_param_act(XTF_ONE_ACTION, "MARK", *flags & F_MARK);
+               xtables_param_act(XTF_NO_INVERT, "MARK", "--set-xmark/--set-mark", invert);
                if (!xtables_strtoui(optarg, &end, &value, 0, UINT32_MAX))
-                       param_act(P_BAD_VALUE, "MARK", "--set-xmark/--set-mark", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "MARK", "--set-xmark/--set-mark", optarg);
                if (*end == '/')
                        if (!xtables_strtoui(end + 1, &end, &mask, 0, UINT32_MAX))
-                               param_act(P_BAD_VALUE, "MARK", "--set-xmark/--set-mark", optarg);
+                               xtables_param_act(XTF_BAD_VALUE, "MARK", "--set-xmark/--set-mark", optarg);
                if (*end != '\0')
-                       param_act(P_BAD_VALUE, "MARK", "--set-xmark/--set-mark", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "MARK", "--set-xmark/--set-mark", optarg);
                info->mark = value;
                info->mask = mask;
 
@@ -151,28 +151,28 @@ static int mark_tg_parse(int c, char **argv, int invert, unsigned int *flags,
                break;
 
        case '&': /* --and-mark */
-               param_act(P_ONE_ACTION, "MARK", *flags & F_MARK);
-               param_act(P_NO_INVERT, "MARK", "--and-mark", invert);
+               xtables_param_act(XTF_ONE_ACTION, "MARK", *flags & F_MARK);
+               xtables_param_act(XTF_NO_INVERT, "MARK", "--and-mark", invert);
                if (!xtables_strtoui(optarg, NULL, &mask, 0, UINT32_MAX))
-                       param_act(P_BAD_VALUE, "MARK", "--and-mark", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "MARK", "--and-mark", optarg);
                info->mark = 0;
                info->mask = ~mask;
                break;
 
        case '|': /* --or-mark */
-               param_act(P_ONE_ACTION, "MARK", *flags & F_MARK);
-               param_act(P_NO_INVERT, "MARK", "--or-mark", invert);
+               xtables_param_act(XTF_ONE_ACTION, "MARK", *flags & F_MARK);
+               xtables_param_act(XTF_NO_INVERT, "MARK", "--or-mark", invert);
                if (!xtables_strtoui(optarg, NULL, &value, 0, UINT32_MAX))
-                       param_act(P_BAD_VALUE, "MARK", "--or-mark", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "MARK", "--or-mark", optarg);
                info->mark = value;
                info->mask = value;
                break;
 
        case '^': /* --xor-mark */
-               param_act(P_ONE_ACTION, "MARK", *flags & F_MARK);
-               param_act(P_NO_INVERT, "MARK", "--xor-mark", invert);
+               xtables_param_act(XTF_ONE_ACTION, "MARK", *flags & F_MARK);
+               xtables_param_act(XTF_NO_INVERT, "MARK", "--xor-mark", invert);
                if (!xtables_strtoui(optarg, NULL, &value, 0, UINT32_MAX))
-                       param_act(P_BAD_VALUE, "MARK", "--xor-mark", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "MARK", "--xor-mark", optarg);
                info->mark = value;
                info->mask = 0;
                break;
index 96eb4201f4fab22b20920d2d83a6434c133b7f83..7b1f7f831c88bbd570e47faff5650096f6b260b4 100644 (file)
@@ -82,10 +82,10 @@ static int tos_tg_parse_v0(int c, char **argv, int invert, unsigned int *flags,
 
        switch (c) {
        case '=':
-               param_act(P_ONLY_ONCE, "TOS", "--set-tos", *flags & FLAG_TOS);
-               param_act(P_NO_INVERT, "TOS", "--set-tos", invert);
+               xtables_param_act(XTF_ONLY_ONCE, "TOS", "--set-tos", *flags & FLAG_TOS);
+               xtables_param_act(XTF_NO_INVERT, "TOS", "--set-tos", invert);
                if (!tos_parse_symbolic(optarg, &tvm, 0xFF))
-                       param_act(P_BAD_VALUE, "TOS", "--set-tos", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "TOS", "--set-tos", optarg);
                if (tvm.mask != 0xFF)
                        exit_error(PARAMETER_PROBLEM, "tos match: Your kernel "
                                   "is too old to support anything besides "
@@ -107,37 +107,37 @@ static int tos_tg_parse(int c, char **argv, int invert, unsigned int *flags,
 
        switch (c) {
        case '=': /* --set-tos */
-               param_act(P_ONLY_ONCE, "TOS", "--set-tos", *flags & FLAG_TOS);
-               param_act(P_NO_INVERT, "TOS", "--set-tos", invert);
+               xtables_param_act(XTF_ONLY_ONCE, "TOS", "--set-tos", *flags & FLAG_TOS);
+               xtables_param_act(XTF_NO_INVERT, "TOS", "--set-tos", invert);
                if (!tos_parse_symbolic(optarg, &tvm, 0x3F))
-                       param_act(P_BAD_VALUE, "TOS", "--set-tos", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "TOS", "--set-tos", optarg);
                info->tos_value = tvm.value;
                info->tos_mask  = tvm.mask;
                break;
 
        case '&': /* --and-tos */
-               param_act(P_ONLY_ONCE, "TOS", "--and-tos", *flags & FLAG_TOS);
-               param_act(P_NO_INVERT, "TOS", "--and-tos", invert);
+               xtables_param_act(XTF_ONLY_ONCE, "TOS", "--and-tos", *flags & FLAG_TOS);
+               xtables_param_act(XTF_NO_INVERT, "TOS", "--and-tos", invert);
                if (!xtables_strtoui(optarg, NULL, &bits, 0, UINT8_MAX))
-                       param_act(P_BAD_VALUE, "TOS", "--and-tos", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "TOS", "--and-tos", optarg);
                info->tos_value = 0;
                info->tos_mask  = ~bits;
                break;
 
        case '|': /* --or-tos */
-               param_act(P_ONLY_ONCE, "TOS", "--or-tos", *flags & FLAG_TOS);
-               param_act(P_NO_INVERT, "TOS", "--or-tos", invert);
+               xtables_param_act(XTF_ONLY_ONCE, "TOS", "--or-tos", *flags & FLAG_TOS);
+               xtables_param_act(XTF_NO_INVERT, "TOS", "--or-tos", invert);
                if (!xtables_strtoui(optarg, NULL, &bits, 0, UINT8_MAX))
-                       param_act(P_BAD_VALUE, "TOS", "--or-tos", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "TOS", "--or-tos", optarg);
                info->tos_value = bits;
                info->tos_mask  = bits;
                break;
 
        case '^': /* --xor-tos */
-               param_act(P_ONLY_ONCE, "TOS", "--xor-tos", *flags & FLAG_TOS);
-               param_act(P_NO_INVERT, "TOS", "--xor-tos", invert);
+               xtables_param_act(XTF_ONLY_ONCE, "TOS", "--xor-tos", *flags & FLAG_TOS);
+               xtables_param_act(XTF_NO_INVERT, "TOS", "--xor-tos", invert);
                if (!xtables_strtoui(optarg, NULL, &bits, 0, UINT8_MAX))
-                       param_act(P_BAD_VALUE, "TOS", "--xor-tos", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "TOS", "--xor-tos", optarg);
                info->tos_value = bits;
                info->tos_mask  = 0;
                break;
index 6c5c6b7db517831c58ffe5f339ebad8370849c37..d0933aef5117b77fcc9d1458d4a874fd08627dec 100644 (file)
@@ -43,7 +43,7 @@ static void parse_tproxy_lport(const char *s, struct xt_tproxy_target_info *info
        if (xtables_strtoui(s, NULL, &lport, 0, UINT16_MAX))
                info->lport = htons(lport);
        else
-               param_act(P_BAD_VALUE, "TPROXY", "--on-port", s);
+               xtables_param_act(XTF_BAD_VALUE, "TPROXY", "--on-port", s);
 }
 
 static void parse_tproxy_laddr(const char *s, struct xt_tproxy_target_info *info)
@@ -51,7 +51,7 @@ static void parse_tproxy_laddr(const char *s, struct xt_tproxy_target_info *info
        struct in_addr *laddr;
 
        if ((laddr = numeric_to_ipaddr(s)) == NULL)
-               param_act(P_BAD_VALUE, "TPROXY", "--on-ip", s);
+               xtables_param_act(XTF_BAD_VALUE, "TPROXY", "--on-ip", s);
 
        info->laddr = laddr->s_addr;
 }
@@ -62,12 +62,12 @@ static void parse_tproxy_mark(char *s, struct xt_tproxy_target_info *info)
        char *end;
 
        if (!xtables_strtoui(s, &end, &value, 0, UINT32_MAX))
-               param_act(P_BAD_VALUE, "TPROXY", "--tproxy-mark", s);
+               xtables_param_act(XTF_BAD_VALUE, "TPROXY", "--tproxy-mark", s);
        if (*end == '/')
                if (!xtables_strtoui(end + 1, &end, &mask, 0, UINT32_MAX))
-                       param_act(P_BAD_VALUE, "TPROXY", "--tproxy-mark", s);
+                       xtables_param_act(XTF_BAD_VALUE, "TPROXY", "--tproxy-mark", s);
        if (*end != '\0')
-               param_act(P_BAD_VALUE, "TPROXY", "--tproxy-mark", s);
+               xtables_param_act(XTF_BAD_VALUE, "TPROXY", "--tproxy-mark", s);
 
        info->mark_mask = mask;
        info->mark_value = value;
@@ -80,20 +80,20 @@ static int tproxy_tg_parse(int c, char **argv, int invert, unsigned int *flags,
 
        switch (c) {
        case '1':
-               param_act(P_ONLY_ONCE, "TPROXY", "--on-port", *flags & PARAM_ONPORT);
-               param_act(P_NO_INVERT, "TPROXY", "--on-port", invert);
+               xtables_param_act(XTF_ONLY_ONCE, "TPROXY", "--on-port", *flags & PARAM_ONPORT);
+               xtables_param_act(XTF_NO_INVERT, "TPROXY", "--on-port", invert);
                parse_tproxy_lport(optarg, tproxyinfo);
                *flags |= PARAM_ONPORT;
                return 1;
        case '2':
-               param_act(P_ONLY_ONCE, "TPROXY", "--on-ip", *flags & PARAM_ONIP);
-               param_act(P_NO_INVERT, "TPROXY", "--on-ip", invert);
+               xtables_param_act(XTF_ONLY_ONCE, "TPROXY", "--on-ip", *flags & PARAM_ONIP);
+               xtables_param_act(XTF_NO_INVERT, "TPROXY", "--on-ip", invert);
                parse_tproxy_laddr(optarg, tproxyinfo);
                *flags |= PARAM_ONIP;
                return 1;
        case '3':
-               param_act(P_ONLY_ONCE, "TPROXY", "--tproxy-mark", *flags & PARAM_MARK);
-               param_act(P_NO_INVERT, "TPROXY", "--tproxy-mark", invert);
+               xtables_param_act(XTF_ONLY_ONCE, "TPROXY", "--tproxy-mark", *flags & PARAM_MARK);
+               xtables_param_act(XTF_NO_INVERT, "TPROXY", "--tproxy-mark", invert);
                parse_tproxy_mark(optarg, tproxyinfo);
                *flags |= PARAM_MARK;
                return 1;
index afa63e39a8c84cb681ad5a28f5375943b81f9b59..0f47a8f48c3fc76bd715b981c087e498920b33a6 100644 (file)
@@ -54,14 +54,14 @@ connmark_mt_parse(int c, char **argv, int invert, unsigned int *flags,
 
        switch (c) {
        case '1': /* --mark */
-               param_act(P_ONLY_ONCE, "connmark", "--mark", *flags & F_MARK);
+               xtables_param_act(XTF_ONLY_ONCE, "connmark", "--mark", *flags & F_MARK);
                if (!xtables_strtoui(optarg, &end, &mark, 0, UINT32_MAX))
-                       param_act(P_BAD_VALUE, "connmark", "--mark", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "connmark", "--mark", optarg);
                if (*end == '/')
                        if (!xtables_strtoui(end + 1, &end, &mask, 0, UINT32_MAX))
-                               param_act(P_BAD_VALUE, "connmark", "--mark", optarg);
+                               xtables_param_act(XTF_BAD_VALUE, "connmark", "--mark", optarg);
                if (*end != '\0')
-                       param_act(P_BAD_VALUE, "connmark", "--mark", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "connmark", "--mark", optarg);
 
                if (invert)
                        info->invert = true;
index 2b98ab02671bad6948a21153b1b5460f574193f6..facd0fc280b515174f1f8dc5204cf18c6a444cee 100644 (file)
@@ -269,13 +269,13 @@ conntrack_ps_expires(struct xt_conntrack_mtinfo1 *info, const char *s)
        char *end;
 
        if (!xtables_strtoui(s, &end, &min, 0, UINT32_MAX))
-               param_act(P_BAD_VALUE, "conntrack", "--expires", s);
+               xtables_param_act(XTF_BAD_VALUE, "conntrack", "--expires", s);
        max = min;
        if (*end == ':')
                if (!xtables_strtoui(s, &end, &max, 0, UINT32_MAX))
-                       param_act(P_BAD_VALUE, "conntrack", "--expires", s);
+                       xtables_param_act(XTF_BAD_VALUE, "conntrack", "--expires", s);
        if (*end != '\0')
-               param_act(P_BAD_VALUE, "conntrack", "--expires", s);
+               xtables_param_act(XTF_BAD_VALUE, "conntrack", "--expires", s);
 
        if (min > max)
                exit_error(PARAMETER_PROBLEM,
@@ -482,7 +482,7 @@ conntrack_mt_parse(int c, char **argv, int invert, unsigned int *flags,
 
        case 'a': /* --ctorigsrcport */
                if (!xtables_strtoui(optarg, NULL, &port, 0, UINT16_MAX))
-                       param_act(P_BAD_VALUE, "conntrack",
+                       xtables_param_act(XTF_BAD_VALUE, "conntrack",
                                  "--ctorigsrcport", optarg);
                info->match_flags |= XT_CONNTRACK_ORIGSRC_PORT;
                info->origsrc_port = htons(port);
@@ -492,7 +492,7 @@ conntrack_mt_parse(int c, char **argv, int invert, unsigned int *flags,
 
        case 'b': /* --ctorigdstport */
                if (!xtables_strtoui(optarg, NULL, &port, 0, UINT16_MAX))
-                       param_act(P_BAD_VALUE, "conntrack",
+                       xtables_param_act(XTF_BAD_VALUE, "conntrack",
                                  "--ctorigdstport", optarg);
                info->match_flags |= XT_CONNTRACK_ORIGDST_PORT;
                info->origdst_port = htons(port);
@@ -502,7 +502,7 @@ conntrack_mt_parse(int c, char **argv, int invert, unsigned int *flags,
 
        case 'c': /* --ctreplsrcport */
                if (!xtables_strtoui(optarg, NULL, &port, 0, UINT16_MAX))
-                       param_act(P_BAD_VALUE, "conntrack",
+                       xtables_param_act(XTF_BAD_VALUE, "conntrack",
                                  "--ctreplsrcport", optarg);
                info->match_flags |= XT_CONNTRACK_REPLSRC_PORT;
                info->replsrc_port = htons(port);
@@ -512,7 +512,7 @@ conntrack_mt_parse(int c, char **argv, int invert, unsigned int *flags,
 
        case 'd': /* --ctrepldstport */
                if (!xtables_strtoui(optarg, NULL, &port, 0, UINT16_MAX))
-                       param_act(P_BAD_VALUE, "conntrack",
+                       xtables_param_act(XTF_BAD_VALUE, "conntrack",
                                  "--ctrepldstport", optarg);
                info->match_flags |= XT_CONNTRACK_REPLDST_PORT;
                info->repldst_port = htons(port);
@@ -521,7 +521,7 @@ conntrack_mt_parse(int c, char **argv, int invert, unsigned int *flags,
                break;
 
        case 'e': /* --ctdir */
-               param_act(P_NO_INVERT, "conntrack", "--ctdir", invert);
+               xtables_param_act(XTF_NO_INVERT, "conntrack", "--ctdir", invert);
                if (strcasecmp(optarg, "ORIGINAL") == 0) {
                        info->match_flags  |= XT_CONNTRACK_DIRECTION;
                        info->invert_flags &= ~XT_CONNTRACK_DIRECTION;
@@ -529,7 +529,7 @@ conntrack_mt_parse(int c, char **argv, int invert, unsigned int *flags,
                        info->match_flags  |= XT_CONNTRACK_DIRECTION;
                        info->invert_flags |= XT_CONNTRACK_DIRECTION;
                } else {
-                       param_act(P_BAD_VALUE, "conntrack", "--ctdir", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "conntrack", "--ctdir", optarg);
                }
                break;
 
index 06d026a28c9dac912d5721389da216547f708e34..f63db64e26f51ea652b530a66fe9aa7b6413f4c5 100644 (file)
@@ -217,7 +217,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags,
 
        switch(c) {
        case '%':
-               param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit",
+               xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit",
                          *flags & PARAM_LIMIT);
                if (check_inverse(argv[optind-1], &invert, &optind, 0)) break;
                if (!parse_rate(optarg, &r->cfg.avg))
@@ -227,7 +227,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags,
                break;
 
        case '$':
-               param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-burst",
+               xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-burst",
                          *flags & PARAM_BURST);
                if (check_inverse(argv[optind-1], &invert, &optind, 0)) break;
                if (!xtables_strtoui(optarg, NULL, &num, 0, 10000))
@@ -237,7 +237,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags,
                *flags |= PARAM_BURST;
                break;
        case '&':
-               param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-size",
+               xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-htable-size",
                          *flags & PARAM_SIZE);
                if (check_inverse(argv[optind-1], &invert, &optind, 0)) break;
                if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX))
@@ -247,7 +247,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags,
                *flags |= PARAM_SIZE;
                break;
        case '*':
-               param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-max",
+               xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-htable-max",
                          *flags & PARAM_MAX);
                if (check_inverse(argv[optind-1], &invert, &optind, 0)) break;
                if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX))
@@ -257,7 +257,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags,
                *flags |= PARAM_MAX;
                break;
        case '(':
-               param_act(P_ONLY_ONCE, "hashlimit",
+               xtables_param_act(XTF_ONLY_ONCE, "hashlimit",
                          "--hashlimit-htable-gcinterval",
                          *flags & PARAM_GCINTERVAL);
                if (check_inverse(argv[optind-1], &invert, &optind, 0)) break;
@@ -270,7 +270,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags,
                *flags |= PARAM_GCINTERVAL;
                break;
        case ')':
-               param_act(P_ONLY_ONCE, "hashlimit",
+               xtables_param_act(XTF_ONLY_ONCE, "hashlimit",
                          "--hashlimit-htable-expire", *flags & PARAM_EXPIRE);
                if (check_inverse(argv[optind-1], &invert, &optind, 0)) break;
                if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX))
@@ -281,7 +281,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags,
                *flags |= PARAM_EXPIRE;
                break;
        case '_':
-               param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-mode",
+               xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-mode",
                          *flags & PARAM_MODE);
                if (check_inverse(argv[optind-1], &invert, &optind, 0)) break;
                if (parse_mode(&r->cfg.mode, optarg) < 0)
@@ -290,7 +290,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags,
                *flags |= PARAM_MODE;
                break;
        case '"':
-               param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-name",
+               xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-name",
                          *flags & PARAM_NAME);
                if (check_inverse(argv[optind-1], &invert, &optind, 0)) break;
                if (strlen(optarg) == 0)
@@ -317,63 +317,63 @@ hashlimit_mt_parse(struct xt_hashlimit_mtinfo1 *info, unsigned int *flags,
 
        switch(c) {
        case '%': /* --hashlimit / --hashlimit-below */
-               param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-upto",
+               xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-upto",
                          *flags & PARAM_LIMIT);
                if (invert)
                        info->cfg.mode |= XT_HASHLIMIT_INVERT;
                if (!parse_rate(optarg, &info->cfg.avg))
-                       param_act(P_BAD_VALUE, "hashlimit",
+                       xtables_param_act(XTF_BAD_VALUE, "hashlimit",
                                  "--hashlimit-upto", optarg);
                *flags |= PARAM_LIMIT;
                return true;
 
        case '^': /* --hashlimit-above == !--hashlimit-below */
-               param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-above",
+               xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-above",
                          *flags & PARAM_LIMIT);
                if (!invert)
                        info->cfg.mode |= XT_HASHLIMIT_INVERT;
                if (!parse_rate(optarg, &info->cfg.avg))
-                       param_act(P_BAD_VALUE, "hashlimit",
+                       xtables_param_act(XTF_BAD_VALUE, "hashlimit",
                                  "--hashlimit-above", optarg);
                *flags |= PARAM_LIMIT;
                return true;
 
        case '$': /* --hashlimit-burst */
-               param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-burst",
+               xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-burst",
                          *flags & PARAM_BURST);
                if (!xtables_strtoui(optarg, NULL, &num, 0, 10000))
-                       param_act(P_BAD_VALUE, "hashlimit",
+                       xtables_param_act(XTF_BAD_VALUE, "hashlimit",
                                  "--hashlimit-burst", optarg);
                info->cfg.burst = num;
                *flags |= PARAM_BURST;
                return true;
 
        case '&': /* --hashlimit-htable-size */
-               param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-size",
+               xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-htable-size",
                          *flags & PARAM_SIZE);
                if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX))
-                       param_act(P_BAD_VALUE, "hashlimit",
+                       xtables_param_act(XTF_BAD_VALUE, "hashlimit",
                                  "--hashlimit-htable-size", optarg);
                info->cfg.size = num;
                *flags |= PARAM_SIZE;
                return true;
 
        case '*': /* --hashlimit-htable-max */
-               param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-max",
+               xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-htable-max",
                          *flags & PARAM_MAX);
                if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX))
-                       param_act(P_BAD_VALUE, "hashlimit",
+                       xtables_param_act(XTF_BAD_VALUE, "hashlimit",
                                  "--hashlimit-htable-max", optarg);
                info->cfg.max = num;
                *flags |= PARAM_MAX;
                return true;
 
        case '(': /* --hashlimit-htable-gcinterval */
-               param_act(P_ONLY_ONCE, "hashlimit",
+               xtables_param_act(XTF_ONLY_ONCE, "hashlimit",
                          "--hashlimit-htable-gcinterval",
                          *flags & PARAM_GCINTERVAL);
                if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX))
-                       param_act(P_BAD_VALUE, "hashlimit",
+                       xtables_param_act(XTF_BAD_VALUE, "hashlimit",
                                  "--hashlimit-htable-gcinterval", optarg);
                /* FIXME: not HZ dependent!! */
                info->cfg.gc_interval = num;
@@ -381,10 +381,10 @@ hashlimit_mt_parse(struct xt_hashlimit_mtinfo1 *info, unsigned int *flags,
                return true;
 
        case ')': /* --hashlimit-htable-expire */
-               param_act(P_ONLY_ONCE, "hashlimit",
+               xtables_param_act(XTF_ONLY_ONCE, "hashlimit",
                          "--hashlimit-htable-expire", *flags & PARAM_EXPIRE);
                if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX))
-                       param_act(P_BAD_VALUE, "hashlimit",
+                       xtables_param_act(XTF_BAD_VALUE, "hashlimit",
                                  "--hashlimit-htable-expire", optarg);
                /* FIXME: not HZ dependent */
                info->cfg.expire = num;
@@ -392,16 +392,16 @@ hashlimit_mt_parse(struct xt_hashlimit_mtinfo1 *info, unsigned int *flags,
                return true;
 
        case '_':
-               param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-mode",
+               xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-mode",
                          *flags & PARAM_MODE);
                if (parse_mode(&info->cfg.mode, optarg) < 0)
-                       param_act(P_BAD_VALUE, "hashlimit",
+                       xtables_param_act(XTF_BAD_VALUE, "hashlimit",
                                  "--hashlimit-mode", optarg);
                *flags |= PARAM_MODE;
                return true;
 
        case '"': /* --hashlimit-name */
-               param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-name",
+               xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-name",
                          *flags & PARAM_NAME);
                if (strlen(optarg) == 0)
                        exit_error(PARAMETER_PROBLEM, "Zero-length name?");
@@ -411,20 +411,20 @@ hashlimit_mt_parse(struct xt_hashlimit_mtinfo1 *info, unsigned int *flags,
                return true;
 
        case '<': /* --hashlimit-srcmask */
-               param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-srcmask",
+               xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-srcmask",
                          *flags & PARAM_SRCMASK);
                if (!xtables_strtoui(optarg, NULL, &num, 0, maxmask))
-                       param_act(P_BAD_VALUE, "hashlimit",
+                       xtables_param_act(XTF_BAD_VALUE, "hashlimit",
                                  "--hashlimit-srcmask", optarg);
                info->cfg.srcmask = num;
                *flags |= PARAM_SRCMASK;
                return true;
 
        case '>': /* --hashlimit-dstmask */
-               param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-dstmask",
+               xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-dstmask",
                          *flags & PARAM_DSTMASK);
                if (!xtables_strtoui(optarg, NULL, &num, 0, maxmask))
-                       param_act(P_BAD_VALUE, "hashlimit",
+                       xtables_param_act(XTF_BAD_VALUE, "hashlimit",
                                  "--hashlimit-dstmask", optarg);
                info->cfg.dstmask = num;
                *flags |= PARAM_DSTMASK;
index 09e9fb7f01f1e4efb26efa511286fda9a6ff9a25..0fe2b4f040a6dd6b9c03f8084a9256fdff16c494 100644 (file)
@@ -110,15 +110,15 @@ iprange_mt4_parse(int c, char **argv, int invert, unsigned int *flags,
        case '1': /* --src-range */
                end = strchr(optarg, '-');
                if (end == NULL)
-                       param_act(P_BAD_VALUE, "iprange", "--src-range", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "iprange", "--src-range", optarg);
                *end = '\0';
                ia = numeric_to_ipaddr(optarg);
                if (ia == NULL)
-                       param_act(P_BAD_VALUE, "iprange", "--src-range", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "iprange", "--src-range", optarg);
                memcpy(&info->src_min.in, ia, sizeof(*ia));
                ia = numeric_to_ipaddr(end+1);
                if (ia == NULL)
-                       param_act(P_BAD_VALUE, "iprange", "--src-range", end + 1);
+                       xtables_param_act(XTF_BAD_VALUE, "iprange", "--src-range", end + 1);
                memcpy(&info->src_max.in, ia, sizeof(*ia));
                info->flags |= IPRANGE_SRC;
                if (invert)
@@ -129,15 +129,15 @@ iprange_mt4_parse(int c, char **argv, int invert, unsigned int *flags,
        case '2': /* --dst-range */
                end = strchr(optarg, '-');
                if (end == NULL)
-                       param_act(P_BAD_VALUE, "iprange", "--dst-range", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "iprange", "--dst-range", optarg);
                *end = '\0';
                ia = numeric_to_ipaddr(optarg);
                if (ia == NULL)
-                       param_act(P_BAD_VALUE, "iprange", "--dst-range", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "iprange", "--dst-range", optarg);
                memcpy(&info->dst_min.in, ia, sizeof(*ia));
                ia = numeric_to_ipaddr(end + 1);
                if (ia == NULL)
-                       param_act(P_BAD_VALUE, "iprange", "--dst-range", end + 1);
+                       xtables_param_act(XTF_BAD_VALUE, "iprange", "--dst-range", end + 1);
                memcpy(&info->dst_max.in, ia, sizeof(*ia));
                info->flags |= IPRANGE_DST;
                if (invert)
@@ -160,15 +160,15 @@ iprange_mt6_parse(int c, char **argv, int invert, unsigned int *flags,
        case '1': /* --src-range */
                end = strchr(optarg, '-');
                if (end == NULL)
-                       param_act(P_BAD_VALUE, "iprange", "--src-range", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "iprange", "--src-range", optarg);
                *end = '\0';
                ia = numeric_to_ip6addr(optarg);
                if (ia == NULL)
-                       param_act(P_BAD_VALUE, "iprange", "--src-range", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "iprange", "--src-range", optarg);
                memcpy(&info->src_min.in, ia, sizeof(*ia));
                ia = numeric_to_ip6addr(end+1);
                if (ia == NULL)
-                       param_act(P_BAD_VALUE, "iprange", "--src-range", end + 1);
+                       xtables_param_act(XTF_BAD_VALUE, "iprange", "--src-range", end + 1);
                memcpy(&info->src_max.in, ia, sizeof(*ia));
                info->flags |= IPRANGE_SRC;
                if (invert)
@@ -179,15 +179,15 @@ iprange_mt6_parse(int c, char **argv, int invert, unsigned int *flags,
        case '2': /* --dst-range */
                end = strchr(optarg, '-');
                if (end == NULL)
-                       param_act(P_BAD_VALUE, "iprange", "--dst-range", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "iprange", "--dst-range", optarg);
                *end = '\0';
                ia = numeric_to_ip6addr(optarg);
                if (ia == NULL)
-                       param_act(P_BAD_VALUE, "iprange", "--dst-range", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "iprange", "--dst-range", optarg);
                memcpy(&info->dst_min.in, ia, sizeof(*ia));
                ia = numeric_to_ip6addr(end + 1);
                if (ia == NULL)
-                       param_act(P_BAD_VALUE, "iprange", "--dst-range", end + 1);
+                       xtables_param_act(XTF_BAD_VALUE, "iprange", "--dst-range", end + 1);
                memcpy(&info->dst_max.in, ia, sizeof(*ia));
                info->flags |= IPRANGE_DST;
                if (invert)
index 31957e7d443a9590012d07c49cfccef0a8494285..08bc9d95872f7d32d1fa9f1aa8b87fb44dba29c5 100644 (file)
@@ -34,14 +34,14 @@ static int mark_mt_parse(int c, char **argv, int invert, unsigned int *flags,
 
        switch (c) {
        case '1': /* --mark */
-               param_act(P_ONLY_ONCE, "mark", "--mark", *flags & F_MARK);
+               xtables_param_act(XTF_ONLY_ONCE, "mark", "--mark", *flags & F_MARK);
                if (!xtables_strtoui(optarg, &end, &mark, 0, UINT32_MAX))
-                       param_act(P_BAD_VALUE, "mark", "--mark", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "mark", "--mark", optarg);
                if (*end == '/')
                        if (!xtables_strtoui(end + 1, &end, &mask, 0, UINT32_MAX))
-                               param_act(P_BAD_VALUE, "mark", "--mark", optarg);
+                               xtables_param_act(XTF_BAD_VALUE, "mark", "--mark", optarg);
                if (*end != '\0')
-                       param_act(P_BAD_VALUE, "mark", "--mark", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "mark", "--mark", optarg);
 
                if (invert)
                        info->invert = true;
index 54d841c6a2523d87a1dc5ddca0c6fd058ffd9aab..bf26f35cfbe8c15b83a082239488c38a1f17d891 100644 (file)
@@ -112,11 +112,11 @@ owner_mt_parse_v0(int c, char **argv, int invert, unsigned int *flags,
 
        switch (c) {
        case 'u':
-               param_act(P_ONLY_ONCE, "owner", "--uid-owner", *flags & FLAG_UID_OWNER);
+               xtables_param_act(XTF_ONLY_ONCE, "owner", "--uid-owner", *flags & FLAG_UID_OWNER);
                if ((pwd = getpwnam(optarg)) != NULL)
                        id = pwd->pw_uid;
                else if (!xtables_strtoui(optarg, NULL, &id, 0, UINT32_MAX - 1))
-                       param_act(P_BAD_VALUE, "owner", "--uid-owner", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "owner", "--uid-owner", optarg);
                if (invert)
                        info->invert |= IPT_OWNER_UID;
                info->match |= IPT_OWNER_UID;
@@ -125,11 +125,11 @@ owner_mt_parse_v0(int c, char **argv, int invert, unsigned int *flags,
                return true;
 
        case 'g':
-               param_act(P_ONLY_ONCE, "owner", "--gid-owner", *flags & FLAG_GID_OWNER);
+               xtables_param_act(XTF_ONLY_ONCE, "owner", "--gid-owner", *flags & FLAG_GID_OWNER);
                if ((grp = getgrnam(optarg)) != NULL)
                        id = grp->gr_gid;
                else if (!xtables_strtoui(optarg, NULL, &id, 0, UINT32_MAX - 1))
-                       param_act(P_BAD_VALUE, "owner", "--gid-owner", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "owner", "--gid-owner", optarg);
                if (invert)
                        info->invert |= IPT_OWNER_GID;
                info->match |= IPT_OWNER_GID;
@@ -138,9 +138,9 @@ owner_mt_parse_v0(int c, char **argv, int invert, unsigned int *flags,
                return true;
 
        case 'p':
-               param_act(P_ONLY_ONCE, "owner", "--pid-owner", *flags & FLAG_PID_OWNER);
+               xtables_param_act(XTF_ONLY_ONCE, "owner", "--pid-owner", *flags & FLAG_PID_OWNER);
                if (!xtables_strtoui(optarg, NULL, &id, 0, INT_MAX))
-                       param_act(P_BAD_VALUE, "owner", "--pid-owner", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "owner", "--pid-owner", optarg);
                if (invert)
                        info->invert |= IPT_OWNER_PID;
                info->match |= IPT_OWNER_PID;
@@ -149,9 +149,9 @@ owner_mt_parse_v0(int c, char **argv, int invert, unsigned int *flags,
                return true;
 
        case 's':
-               param_act(P_ONLY_ONCE, "owner", "--sid-owner", *flags & FLAG_SID_OWNER);
+               xtables_param_act(XTF_ONLY_ONCE, "owner", "--sid-owner", *flags & FLAG_SID_OWNER);
                if (!xtables_strtoui(optarg, NULL, &id, 0, INT_MAX))
-                       param_act(P_BAD_VALUE, "owner", "--sid-value", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "owner", "--sid-value", optarg);
                if (invert)
                        info->invert |= IPT_OWNER_SID;
                info->match |= IPT_OWNER_SID;
@@ -161,7 +161,7 @@ owner_mt_parse_v0(int c, char **argv, int invert, unsigned int *flags,
 
 #ifdef IPT_OWNER_COMM
        case 'c':
-               param_act(P_ONLY_ONCE, "owner", "--cmd-owner", *flags & FLAG_COMM);
+               xtables_param_act(XTF_ONLY_ONCE, "owner", "--cmd-owner", *flags & FLAG_COMM);
                if (strlen(optarg) > sizeof(info->comm))
                        exit_error(PARAMETER_PROBLEM, "owner match: command "
                                   "\"%s\" too long, max. %zu characters",
@@ -191,12 +191,12 @@ owner_mt6_parse_v0(int c, char **argv, int invert, unsigned int *flags,
 
        switch (c) {
        case 'u':
-               param_act(P_ONLY_ONCE, "owner", "--uid-owner",
+               xtables_param_act(XTF_ONLY_ONCE, "owner", "--uid-owner",
                          *flags & FLAG_UID_OWNER);
                if ((pwd = getpwnam(optarg)) != NULL)
                        id = pwd->pw_uid;
                else if (!xtables_strtoui(optarg, NULL, &id, 0, UINT32_MAX - 1))
-                       param_act(P_BAD_VALUE, "owner", "--uid-owner", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "owner", "--uid-owner", optarg);
                if (invert)
                        info->invert |= IP6T_OWNER_UID;
                info->match |= IP6T_OWNER_UID;
@@ -205,12 +205,12 @@ owner_mt6_parse_v0(int c, char **argv, int invert, unsigned int *flags,
                return true;
 
        case 'g':
-               param_act(P_ONLY_ONCE, "owner", "--gid-owner",
+               xtables_param_act(XTF_ONLY_ONCE, "owner", "--gid-owner",
                          *flags & FLAG_GID_OWNER);
                if ((grp = getgrnam(optarg)) != NULL)
                        id = grp->gr_gid;
                else if (!xtables_strtoui(optarg, NULL, &id, 0, UINT32_MAX - 1))
-                       param_act(P_BAD_VALUE, "owner", "--gid-owner", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "owner", "--gid-owner", optarg);
                if (invert)
                        info->invert |= IP6T_OWNER_GID;
                info->match |= IP6T_OWNER_GID;
@@ -219,10 +219,10 @@ owner_mt6_parse_v0(int c, char **argv, int invert, unsigned int *flags,
                return true;
 
        case 'p':
-               param_act(P_ONLY_ONCE, "owner", "--pid-owner",
+               xtables_param_act(XTF_ONLY_ONCE, "owner", "--pid-owner",
                          *flags & FLAG_PID_OWNER);
                if (!xtables_strtoui(optarg, NULL, &id, 0, INT_MAX))
-                       param_act(P_BAD_VALUE, "owner", "--pid-owner", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "owner", "--pid-owner", optarg);
                if (invert)
                        info->invert |= IP6T_OWNER_PID;
                info->match |= IP6T_OWNER_PID;
@@ -231,10 +231,10 @@ owner_mt6_parse_v0(int c, char **argv, int invert, unsigned int *flags,
                return true;
 
        case 's':
-               param_act(P_ONLY_ONCE, "owner", "--sid-owner",
+               xtables_param_act(XTF_ONLY_ONCE, "owner", "--sid-owner",
                          *flags & FLAG_SID_OWNER);
                if (!xtables_strtoui(optarg, NULL, &id, 0, INT_MAX))
-                       param_act(P_BAD_VALUE, "owner", "--sid-owner", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "owner", "--sid-owner", optarg);
                if (invert)
                        info->invert |= IP6T_OWNER_SID;
                info->match |= IP6T_OWNER_SID;
@@ -252,13 +252,13 @@ static void owner_parse_range(const char *s, unsigned int *from,
 
        /* -1 is reversed, so the max is one less than that. */
        if (!xtables_strtoui(s, &end, from, 0, UINT32_MAX - 1))
-               param_act(P_BAD_VALUE, "owner", opt, s);
+               xtables_param_act(XTF_BAD_VALUE, "owner", opt, s);
        *to = *from;
        if (*end == '-' || *end == ':')
                if (!xtables_strtoui(end + 1, &end, to, 0, UINT32_MAX - 1))
-                       param_act(P_BAD_VALUE, "owner", opt, s);
+                       xtables_param_act(XTF_BAD_VALUE, "owner", opt, s);
        if (*end != '\0')
-               param_act(P_BAD_VALUE, "owner", opt, s);
+               xtables_param_act(XTF_BAD_VALUE, "owner", opt, s);
 }
 
 static int owner_mt_parse(int c, char **argv, int invert, unsigned int *flags,
@@ -271,7 +271,7 @@ static int owner_mt_parse(int c, char **argv, int invert, unsigned int *flags,
 
        switch (c) {
        case 'u':
-               param_act(P_ONLY_ONCE, "owner", "--uid-owner",
+               xtables_param_act(XTF_ONLY_ONCE, "owner", "--uid-owner",
                          *flags & FLAG_UID_OWNER);
                if ((pwd = getpwnam(optarg)) != NULL)
                        from = to = pwd->pw_uid;
@@ -286,7 +286,7 @@ static int owner_mt_parse(int c, char **argv, int invert, unsigned int *flags,
                return true;
 
        case 'g':
-               param_act(P_ONLY_ONCE, "owner", "--gid-owner",
+               xtables_param_act(XTF_ONLY_ONCE, "owner", "--gid-owner",
                          *flags & FLAG_GID_OWNER);
                if ((grp = getgrnam(optarg)) != NULL)
                        from = to = grp->gr_gid;
@@ -301,7 +301,7 @@ static int owner_mt_parse(int c, char **argv, int invert, unsigned int *flags,
                return true;
 
        case 'k':
-               param_act(P_ONLY_ONCE, "owner", "--socket-exists",
+               xtables_param_act(XTF_ONLY_ONCE, "owner", "--socket-exists",
                          *flags & FLAG_SOCKET_EXISTS);
                if (invert)
                        info->invert |= XT_OWNER_SOCKET;
index 9f8d6fa35635ea292cbc9cbafcda9a8184b76e7f..a61184004fce25e82324bdb35d10f52748b2370c 100644 (file)
@@ -50,9 +50,9 @@ static int tos_mt_parse_v0(int c, char **argv, int invert, unsigned int *flags,
 
        switch (c) {
        case 't':
-               param_act(P_ONLY_ONCE, "tos", "--tos", *flags & FLAG_TOS);
+               xtables_param_act(XTF_ONLY_ONCE, "tos", "--tos", *flags & FLAG_TOS);
                if (!tos_parse_symbolic(optarg, &tvm, 0xFF))
-                       param_act(P_BAD_VALUE, "tos", "--tos", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "tos", "--tos", optarg);
                if (tvm.mask != 0xFF)
                        exit_error(PARAMETER_PROBLEM, "tos: Your kernel is "
                                   "too old to support anything besides /0xFF "
@@ -74,9 +74,9 @@ static int tos_mt_parse(int c, char **argv, int invert, unsigned int *flags,
 
        switch (c) {
        case 't':
-               param_act(P_ONLY_ONCE, "tos", "--tos", *flags & FLAG_TOS);
+               xtables_param_act(XTF_ONLY_ONCE, "tos", "--tos", *flags & FLAG_TOS);
                if (!tos_parse_symbolic(optarg, &tvm, 0x3F))
-                       param_act(P_BAD_VALUE, "tos", "--tos", optarg);
+                       xtables_param_act(XTF_BAD_VALUE, "tos", "--tos", optarg);
                info->tos_value = tvm.value;
                info->tos_mask  = tvm.mask;
                if (invert)
index e1f9c926a68c7c7e35a0ea12e7be099f86d8dd6f..e5737cb80f3789e2c3ce789816250d891febafe2 100644 (file)
@@ -158,6 +158,17 @@ enum xtables_tryload {
        XTF_LOAD_MUST_SUCCEED,
 };
 
+enum xtables_exittype {
+       OTHER_PROBLEM = 1,
+       PARAMETER_PROBLEM,
+       VERSION_PROBLEM,
+       RESOURCE_PROBLEM,
+       XTF_ONLY_ONCE,
+       XTF_NO_INVERT,
+       XTF_BAD_VALUE,
+       XTF_ONE_ACTION,
+};
+
 extern const char *xtables_program_name;
 extern const char *xtables_modprobe_program;
 extern struct xtables_match *xtables_matches;
@@ -188,24 +199,13 @@ extern u_int16_t parse_port(const char *port, const char *proto);
 extern void
 parse_interface(const char *arg, char *vianame, unsigned char *mask);
 
-enum exittype {
-       OTHER_PROBLEM = 1,
-       PARAMETER_PROBLEM,
-       VERSION_PROBLEM,
-       RESOURCE_PROBLEM,
-       P_ONLY_ONCE,
-       P_NO_INVERT,
-       P_BAD_VALUE,
-       P_ONE_ACTION,
-};
-
 /* this is a special 64bit data type that is 8-byte aligned */
 #define aligned_u64 u_int64_t __attribute__((aligned(8)))
 
 int check_inverse(const char option[], int *invert, int *my_optind, int argc);
-void exit_error(enum exittype, const char *, ...)__attribute__((noreturn,
-                                                         format(printf,2,3)));
-extern void param_act(unsigned int, const char *, ...);
+void exit_error(enum xtables_exittype, const char *, ...)
+       __attribute__((noreturn, format(printf,2,3)));
+extern void xtables_param_act(unsigned int, const char *, ...);
 
 extern const char *ipaddr_to_numeric(const struct in_addr *);
 extern const char *ipaddr_to_anyname(const struct in_addr *);
index 0464185a0222f6e9604a840184c9f6204a78b2a9..cbacd89955118c2baea00b214ba80ab6671ae03a 100644 (file)
@@ -365,7 +365,7 @@ exit_printhelp(struct ip6tables_rule_match *matches)
 }
 
 void
-exit_error(enum exittype status, const char *msg, ...)
+exit_error(enum xtables_exittype status, const char *msg, ...)
 {
        va_list args;
 
index a3f6987236003fc3b53cd8670f864fd1c298cf42..307845c5b553d0cc0f02f32477b3a462107043b1 100644 (file)
@@ -30,7 +30,7 @@ const char *program_version;
 
 #ifndef IPTABLES_MULTI
 int line = 0;
-void exit_error(enum exittype status, const char *msg, ...)
+void exit_error(enum xtables_exittype status, const char *msg, ...)
 {
        va_list args;
 
index 15b5b6f48d8deb0bd61c8e94c4cc54cc8fa51a9a..9adc20938255a3492d73bccf46d9e325d5331b66 100644 (file)
@@ -367,7 +367,7 @@ exit_printhelp(struct iptables_rule_match *matches)
 }
 
 void
-exit_error(enum exittype status, const char *msg, ...)
+exit_error(enum xtables_exittype status, const char *msg, ...)
 {
        va_list args;
 
index 642c04bb1bc209f8ed89a66eeb0ce7ee7595121e..3ffefa2207ac208c817941a1e09f7333d01c8f16 100644 (file)
--- a/xtables.c
+++ b/xtables.c
@@ -676,7 +676,31 @@ void xtables_register_target(struct xtables_target *me)
        me->tflags = 0;
 }
 
-void param_act(unsigned int status, const char *p1, ...)
+/**
+ * xtables_param_act - act on condition
+ * @status:    a constant from enum xtables_exittype
+ *
+ * %XTF_ONLY_ONCE: print error message that option may only be used once.
+ * @p1:                module name (e.g. "mark")
+ * @p2(...):   option in conflict (e.g. "--mark")
+ * @p3(...):   condition to match on (see extensions/ for examples)
+ *
+ * %XTF_NO_INVERT: option does not support inversion
+ * @p1:                module name
+ * @p2:                option in conflict
+ * @p3:                condition to match on
+ *
+ * %XTF_BAD_VALUE: bad value for option
+ * @p1:                module name
+ * @p2:                option with which the problem occured (e.g. "--mark")
+ * @p3:                string the user passed in (e.g. "99999999999999")
+ *
+ * %XTF_ONE_ACTION: two mutually exclusive actions have been specified
+ * @p1:                module name
+ *
+ * Displays an error message and exits the program.
+ */
+void xtables_param_act(unsigned int status, const char *p1, ...)
 {
        const char *p2, *p3;
        va_list args;
@@ -685,7 +709,7 @@ void param_act(unsigned int status, const char *p1, ...)
        va_start(args, p1);
 
        switch (status) {
-       case P_ONLY_ONCE:
+       case XTF_ONLY_ONCE:
                p2 = va_arg(args, const char *);
                b  = va_arg(args, unsigned int);
                if (!b)
@@ -694,7 +718,7 @@ void param_act(unsigned int status, const char *p1, ...)
                           "%s: \"%s\" option may only be specified once",
                           p1, p2);
                break;
-       case P_NO_INVERT:
+       case XTF_NO_INVERT:
                p2 = va_arg(args, const char *);
                b  = va_arg(args, unsigned int);
                if (!b)
@@ -702,14 +726,14 @@ void param_act(unsigned int status, const char *p1, ...)
                exit_error(PARAMETER_PROBLEM,
                           "%s: \"%s\" option cannot be inverted", p1, p2);
                break;
-       case P_BAD_VALUE:
+       case XTF_BAD_VALUE:
                p2 = va_arg(args, const char *);
                p3 = va_arg(args, const char *);
                exit_error(PARAMETER_PROBLEM,
                           "%s: Bad value for \"%s\" option: \"%s\"",
                           p1, p2, p3);
                break;
-       case P_ONE_ACTION:
+       case XTF_ONE_ACTION:
                b = va_arg(args, unsigned int);
                if (!b)
                        return;