]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
ebtables: Change option values to avoid clashes
authorPhil Sutter <phil@nwl.cc>
Wed, 22 Nov 2023 02:05:19 +0000 (03:05 +0100)
committerPhil Sutter <phil@nwl.cc>
Tue, 5 Dec 2023 15:35:37 +0000 (16:35 +0100)
In order to parse input using do_parse(), distinct ebtables option's
values have to be distinct from others. Since arptables uses values 2-8
already, resort to values >10.

Signed-off-by: Phil Sutter <phil@nwl.cc>
iptables/xtables-eb-translate.c
iptables/xtables-eb.c

index d0fec9c6d5ae39b71c68636957f683075b08211b..a2ab318cff2519d711c80401304db84c3fdb98d7 100644 (file)
@@ -292,9 +292,9 @@ print_zero:
                        table_set = true;
                        break;
                case 'i': /* Input interface */
-               case  : /* Logical input interface */
+               case 15 : /* Logical input interface */
                case 'o': /* Output interface */
-               case  : /* Logical output interface */
+               case 16 : /* Logical output interface */
                case 'j': /* Target */
                case 'p': /* Net family protocol */
                case 's': /* Source mac */
@@ -316,7 +316,7 @@ print_zero:
 
                                ebtables_parse_interface(optarg, cs.eb.in);
                                break;
-                       } else if (c == 2) {
+                       } else if (c == 15) {
                                ebt_check_option2(&flags, OPT_LOGICALIN);
                                if (selected_chain > 2 && selected_chain < NF_BR_BROUTING)
                                        xtables_error(PARAMETER_PROBLEM,
@@ -336,7 +336,7 @@ print_zero:
 
                                ebtables_parse_interface(optarg, cs.eb.out);
                                break;
-                       } else if (c == 3) {
+                       } else if (c == 16) {
                                ebt_check_option2(&flags, OPT_LOGICALOUT);
                                if (selected_chain < 2 || selected_chain == NF_BR_BROUTING)
                                        xtables_error(PARAMETER_PROBLEM,
@@ -424,14 +424,14 @@ print_zero:
                                xtables_error(PARAMETER_PROBLEM,
                                              "Sorry, protocols have values above or equal to 0x0600");
                        break;
-               case  : /* Lc */
+               case 17 : /* Lc */
                        ebt_check_option2(&flags, LIST_C);
                        if (command != 'L')
                                xtables_error(PARAMETER_PROBLEM,
                                              "Use --Lc with -L");
                        flags |= LIST_C;
                        break;
-               case  : /* Ln */
+               case 18 : /* Ln */
                        ebt_check_option2(&flags, LIST_N);
                        if (command != 'L')
                                xtables_error(PARAMETER_PROBLEM,
@@ -441,7 +441,7 @@ print_zero:
                                              "--Lx is not compatible with --Ln");
                        flags |= LIST_N;
                        break;
-               case  : /* Lx */
+               case 19 : /* Lx */
                        ebt_check_option2(&flags, LIST_X);
                        if (command != 'L')
                                xtables_error(PARAMETER_PROBLEM,
index db75e65caa02a62069065d25e033f6a2caf0885c..9afaa614bac5b4a291009292dc579b44ec8b3756 100644 (file)
@@ -196,17 +196,17 @@ struct option ebt_original_options[] =
        { "insert"         , required_argument, 0, 'I' },
        { "delete"         , required_argument, 0, 'D' },
        { "list"           , optional_argument, 0, 'L' },
-       { "Lc"             , no_argument      , 0,   },
-       { "Ln"             , no_argument      , 0,   },
-       { "Lx"             , no_argument      , 0,   },
+       { "Lc"             , no_argument      , 0, 17  },
+       { "Ln"             , no_argument      , 0, 18  },
+       { "Lx"             , no_argument      , 0, 19  },
        { "Lmac2"          , no_argument      , 0, 12  },
        { "zero"           , optional_argument, 0, 'Z' },
        { "flush"          , optional_argument, 0, 'F' },
        { "policy"         , required_argument, 0, 'P' },
        { "in-interface"   , required_argument, 0, 'i' },
        { "in-if"          , required_argument, 0, 'i' },
-       { "logical-in"     , required_argument, 0,   },
-       { "logical-out"    , required_argument, 0,   },
+       { "logical-in"     , required_argument, 0, 15  },
+       { "logical-out"    , required_argument, 0, 16  },
        { "out-interface"  , required_argument, 0, 'o' },
        { "out-if"         , required_argument, 0, 'o' },
        { "version"        , no_argument      , 0, 'V' },
@@ -940,9 +940,9 @@ print_zero:
                        table_set = true;
                        break;
                case 'i': /* Input interface */
-               case  : /* Logical input interface */
+               case 15 : /* Logical input interface */
                case 'o': /* Output interface */
-               case  : /* Logical output interface */
+               case 16 : /* Logical output interface */
                case 'j': /* Target */
                case 'p': /* Net family protocol */
                case 's': /* Source mac */
@@ -965,7 +965,7 @@ print_zero:
 
                                ebtables_parse_interface(optarg, cs.eb.in);
                                break;
-                       } else if (c == 2) {
+                       } else if (c == 15) {
                                ebt_check_option2(&flags, OPT_LOGICALIN);
                                if (selected_chain > 2 && selected_chain < NF_BR_BROUTING)
                                        xtables_error(PARAMETER_PROBLEM,
@@ -985,7 +985,7 @@ print_zero:
 
                                ebtables_parse_interface(optarg, cs.eb.out);
                                break;
-                       } else if (c == 3) {
+                       } else if (c == 16) {
                                ebt_check_option2(&flags, OPT_LOGICALOUT);
                                if (selected_chain < 2 || selected_chain == NF_BR_BROUTING)
                                        xtables_error(PARAMETER_PROBLEM,
@@ -1073,14 +1073,14 @@ print_zero:
                                xtables_error(PARAMETER_PROBLEM,
                                              "Sorry, protocols have values above or equal to 0x0600");
                        break;
-               case  : /* Lc */
+               case 17 : /* Lc */
                        ebt_check_option2(&flags, LIST_C);
                        if (command != 'L')
                                xtables_error(PARAMETER_PROBLEM,
                                              "Use --Lc with -L");
                        flags |= LIST_C;
                        break;
-               case  : /* Ln */
+               case 18 : /* Ln */
                        ebt_check_option2(&flags, LIST_N);
                        if (command != 'L')
                                xtables_error(PARAMETER_PROBLEM,
@@ -1090,7 +1090,7 @@ print_zero:
                                              "--Lx is not compatible with --Ln");
                        flags |= LIST_N;
                        break;
-               case  : /* Lx */
+               case 19 : /* Lx */
                        ebt_check_option2(&flags, LIST_X);
                        if (command != 'L')
                                xtables_error(PARAMETER_PROBLEM,