]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Makes it possible to omit extra_opts of matches/targets if unnecessary.
authorJan Engelhardt <jengelh@medozas.de>
Mon, 30 Jul 2007 14:32:26 +0000 (14:32 +0000)
committerYasuyuki KOZAKAI <yasuyuki@netfilter.org>
Mon, 30 Jul 2007 14:32:26 +0000 (14:32 +0000)
(Jan Engelhardt <jengelh@gmx.de>)

A nice side effect is that merge_option() doesn't copy options in that case.

extensions/libip6t_TRACE.c
extensions/libip6t_eui64.c
extensions/libipt_MIRROR.c
extensions/libipt_TRACE.c
extensions/libipt_unclean.c
extensions/libxt_NOTRACK.c
extensions/libxt_standard.c
ip6tables.c
iptables.c

index edbb416cb598a777a81de396c08825309a3c93f0..9784093b26d614321c38bfddf92141b031e942cf 100644 (file)
@@ -16,10 +16,6 @@ help(void)
 IPTABLES_VERSION);
 }
 
-static struct option opts[] = {
-       { 0 }
-};
-
 /* Initialize the target. */
 static void
 init(struct ip6t_entry_target *t, unsigned int *nfcache)
@@ -54,7 +50,6 @@ struct ip6tables_target trace
        .final_check = &final_check,
        .print = NULL, /* print */
        .save = NULL, /* save */
-       .extra_opts = opts
 };
 
 void _init(void)
index 0d22df7cee9519649afea8132ccd94b4f26b48a7..e95944b0a0ecdf85176c83bac28dc3c40c5bdeff 100644 (file)
@@ -22,10 +22,6 @@ help(void)
 "\n", IPTABLES_VERSION);
 }
 
-static struct option opts[] = {
-       {0}
-};
-
 /* Function which parses command options; returns true if it
    ate an option */
 static int
@@ -67,7 +63,6 @@ static struct ip6tables_match eui64 = {
        .final_check    = &final_check,
        .print          = &print,
        .save           = &save,
-       .extra_opts     = opts,
 };
 
 void _init(void)
index 02923b8c36084f86db34152efeec05f8f99d7de6..2e3fb47a5d4bb155cf2c24085f2fb52ffd0aa028 100644 (file)
@@ -16,10 +16,6 @@ help(void)
 IPTABLES_VERSION);
 }
 
-static struct option opts[] = {
-       { 0 }
-};
-
 /* Initialize the target. */
 static void
 init(struct xt_entry_target *t, unsigned int *nfcache)
@@ -52,7 +48,6 @@ static struct iptables_target mirror = {
        .final_check    = &final_check,
        .print          = NULL,
        .save           = NULL,
-       .extra_opts     = opts
 };
 
 void _init(void)
index 22652cb68298e3134b67dabc445805fa59482801..d5c073e488763e785b3720eeedf344fdbc1c0423 100644 (file)
@@ -16,10 +16,6 @@ help(void)
 IPTABLES_VERSION);
 }
 
-static struct option opts[] = {
-       { 0 }
-};
-
 /* Initialize the target. */
 static void
 init(struct ipt_entry_target *t, unsigned int *nfcache)
@@ -54,7 +50,6 @@ struct iptables_target trace
        .final_check = &final_check,
        .print = NULL, /* print */
        .save = NULL, /* save */
-       .extra_opts = opts
 };
 
 void _init(void)
index 8bb29634c572822b4de99f204e06f98a74e85fd8..4ac4191908dbc56f79e5b19b7a3fe56a59e8f6ce 100644 (file)
@@ -13,10 +13,6 @@ help(void)
 "\n", IPTABLES_VERSION);
 }
 
-static struct option opts[] = {
-       {0}
-};
-
 /* Function which parses command options; returns true if it
    ate an option */
 static int
@@ -44,7 +40,6 @@ struct iptables_match unclean = {
        .final_check    = &final_check,
        .print          = NULL,
        .save           = NULL,
-       .extra_opts     = opts
 };
 
 void _init(void)
index 220a9b80af52debf73d8483e91113d221640c708..370ff21cba1cf6de1d67a665c1c3fd0eee6f7376 100644 (file)
@@ -16,10 +16,6 @@ help(void)
 IPTABLES_VERSION);
 }
 
-static struct option opts[] = {
-       { 0 }
-};
-
 /* Initialize the target. */
 static void
 init(struct xt_entry_target *t, unsigned int *nfcache)
@@ -53,7 +49,6 @@ struct xtables_target notrack =
        .init           = &init,
        .parse          = &parse,
        .final_check    = &final_check,
-       .extra_opts     = opts,
 };
 
 static
@@ -68,7 +63,6 @@ struct xtables_target notrack6 =
        .init           = &init,
        .parse          = &parse,
        .final_check    = &final_check,
-       .extra_opts     = opts,
 };
 
 void _init(void)
index 3838ac6565b43e386c353c1fb1a09629bbb2b1e5..9aafb6c0f154e0b5e4756493e4c4259d2eae87fb 100644 (file)
@@ -16,10 +16,6 @@ help(void)
 "(If target is DROP, ACCEPT, RETURN or nothing)\n", IPTABLES_VERSION);
 }
 
-static struct option opts[] = {
-       {0}
-};
-
 /* Initialize the target. */
 static void
 init(struct xt_entry_target *t, unsigned int *nfcache)
@@ -60,7 +56,6 @@ struct xtables_target standard = {
        .final_check    = &final_check,
        .print          = NULL,
        .save           = &save,
-       .extra_opts     = opts
 };
 
 static
@@ -76,7 +71,6 @@ struct xtables_target standard6 = {
        .final_check    = &final_check,
        .print          = NULL,
        .save           = &save,
-       .extra_opts     = opts
 };
 
 void _init(void)
index 8f8c2c2127bcf488f37de5a2f118c0aea6713d81..0f96981e309b85de0fdc840fa7f9f9492aef8f36 100644 (file)
@@ -815,6 +815,9 @@ merge_options(struct option *oldopts, const struct option *newopts,
        unsigned int num_old, num_new, i;
        struct option *merge;
 
+       if (newopts == NULL)
+               return oldopts;
+
        for (num_old = 0; oldopts[num_old].name; num_old++);
        for (num_new = 0; newopts[num_new].name; num_new++);
 
index b894f6a20dfac8897979262bb656359606a60e00..78ac13c3152cd6f58eb64fceb1f9ab92f8934187 100644 (file)
@@ -853,6 +853,9 @@ merge_options(struct option *oldopts, const struct option *newopts,
        unsigned int num_old, num_new, i;
        struct option *merge;
 
+       if (newopts == NULL)
+               return oldopts;
+
        for (num_old = 0; oldopts[num_old].name; num_old++);
        for (num_new = 0; newopts[num_new].name; num_new++);