summaryrefslogtreecommitdiffstats
path: root/iptables.c
diff options
context:
space:
mode:
authorJamal Hadi Salim <hadi@cyberus.ca>2009-02-12 09:33:59 -0500
committerJan Engelhardt <jengelh@medozas.de>2009-02-12 18:56:45 +0100
commit853322131026d62df3f8d77d67e5c63be496303c (patch)
treed2e7dee1d15300a01d4e1c6837ccda49b1fe0141 /iptables.c
parent617d3d140f4739558dce2ef8ed01aef251cf5487 (diff)
libxtables: add xtables_set_revision
Introduce xtables_set_revision() and make iptables and ip6tables use it. Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Diffstat (limited to 'iptables.c')
-rw-r--r--iptables.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/iptables.c b/iptables.c
index 670d8aa7..7974f9aa 100644
--- a/iptables.c
+++ b/iptables.c
@@ -1335,14 +1335,6 @@ static void clear_rule_matches(struct xtables_rule_match **matches)
*matches = NULL;
}
-static void set_revision(char *name, u_int8_t revision)
-{
- /* Old kernel sources don't have ".revision" field,
- but we stole a byte from name. */
- name[IPT_FUNCTION_MAXNAMELEN - 2] = '\0';
- name[IPT_FUNCTION_MAXNAMELEN - 1] = revision;
-}
-
void
get_kernel_version(void) {
static struct utsname uts;
@@ -1613,7 +1605,7 @@ int do_command(int argc, char *argv[], char **table, struct iptc_handle **handle
target->t = xtables_calloc(1, size);
target->t->u.target_size = size;
strcpy(target->t->u.user.name, jumpto);
- set_revision(target->t->u.user.name,
+ xtables_set_revision(target->t->u.user.name,
target->revision);
if (target->init != NULL)
target->init(target->t);
@@ -1672,7 +1664,7 @@ int do_command(int argc, char *argv[], char **table, struct iptc_handle **handle
m->m = xtables_calloc(1, size);
m->m->u.match_size = size;
strcpy(m->m->u.user.name, m->name);
- set_revision(m->m->u.user.name, m->revision);
+ xtables_set_revision(m->m->u.user.name, m->revision);
if (m->init != NULL)
m->init(m->m);
if (m != m->next) {
@@ -1826,7 +1818,7 @@ int do_command(int argc, char *argv[], char **table, struct iptc_handle **handle
m->m = xtables_calloc(1, size);
m->m->u.match_size = size;
strcpy(m->m->u.user.name, m->name);
- set_revision(m->m->u.user.name,
+ xtables_set_revision(m->m->u.user.name,
m->revision);
if (m->init != NULL)
m->init(m->m);
@@ -1987,7 +1979,7 @@ int do_command(int argc, char *argv[], char **table, struct iptc_handle **handle
target->t->u.target_size = size;
strcpy(target->t->u.user.name, jumpto);
if (!iptc_is_chain(jumpto, *handle))
- set_revision(target->t->u.user.name,
+ xtables_set_revision(target->t->u.user.name,
target->revision);
if (target->init != NULL)
target->init(target->t);