summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2007-07-30 14:32:26 +0000
committerYasuyuki KOZAKAI <yasuyuki@netfilter.org>2007-07-30 14:32:26 +0000
commitd01454062d0265f118c1b721740997cb93ef8cdb (patch)
treebfa8ab2b178a18d02b6d634ebf38ec3aecac4c56
parent6f1c597f2aef128e35a78717a998fed7567ade2c (diff)
Makes it possible to omit extra_opts of matches/targets if unnecessary.
(Jan Engelhardt <jengelh@gmx.de>) A nice side effect is that merge_option() doesn't copy options in that case.
-rw-r--r--extensions/libip6t_TRACE.c5
-rw-r--r--extensions/libip6t_eui64.c5
-rw-r--r--extensions/libipt_MIRROR.c5
-rw-r--r--extensions/libipt_TRACE.c5
-rw-r--r--extensions/libipt_unclean.c5
-rw-r--r--extensions/libxt_NOTRACK.c6
-rw-r--r--extensions/libxt_standard.c6
-rw-r--r--ip6tables.c3
-rw-r--r--iptables.c3
9 files changed, 6 insertions, 37 deletions
diff --git a/extensions/libip6t_TRACE.c b/extensions/libip6t_TRACE.c
index edbb416c..9784093b 100644
--- a/extensions/libip6t_TRACE.c
+++ b/extensions/libip6t_TRACE.c
@@ -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)
diff --git a/extensions/libip6t_eui64.c b/extensions/libip6t_eui64.c
index 0d22df7c..e95944b0 100644
--- a/extensions/libip6t_eui64.c
+++ b/extensions/libip6t_eui64.c
@@ -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)
diff --git a/extensions/libipt_MIRROR.c b/extensions/libipt_MIRROR.c
index 02923b8c..2e3fb47a 100644
--- a/extensions/libipt_MIRROR.c
+++ b/extensions/libipt_MIRROR.c
@@ -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)
diff --git a/extensions/libipt_TRACE.c b/extensions/libipt_TRACE.c
index 22652cb6..d5c073e4 100644
--- a/extensions/libipt_TRACE.c
+++ b/extensions/libipt_TRACE.c
@@ -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)
diff --git a/extensions/libipt_unclean.c b/extensions/libipt_unclean.c
index 8bb29634..4ac41919 100644
--- a/extensions/libipt_unclean.c
+++ b/extensions/libipt_unclean.c
@@ -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)
diff --git a/extensions/libxt_NOTRACK.c b/extensions/libxt_NOTRACK.c
index 220a9b80..370ff21c 100644
--- a/extensions/libxt_NOTRACK.c
+++ b/extensions/libxt_NOTRACK.c
@@ -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)
diff --git a/extensions/libxt_standard.c b/extensions/libxt_standard.c
index 3838ac65..9aafb6c0 100644
--- a/extensions/libxt_standard.c
+++ b/extensions/libxt_standard.c
@@ -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)
diff --git a/ip6tables.c b/ip6tables.c
index 8f8c2c21..0f96981e 100644
--- a/ip6tables.c
+++ b/ip6tables.c
@@ -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++);
diff --git a/iptables.c b/iptables.c
index b894f6a2..78ac13c3 100644
--- a/iptables.c
+++ b/iptables.c
@@ -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++);