]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
iptables: fix standard target
authorPablo Neira Ayuso <pablo@netfilter.org>
Sun, 7 Oct 2012 22:55:43 +0000 (00:55 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sun, 7 Oct 2012 22:58:04 +0000 (00:58 +0200)
This regression was added by:

commit cd2f9bdbb7f9b737e5d640aafeb78bcd8e3a7adf
Author: Jan Engelhardt <jengelh@inai.de>
Date:   Tue Sep 4 05:24:47 2012 +0200

    iptables: support for target aliase

The result is that:

 iptables -I INPUT -j ACCEPT

says:

 iptables: No chain/target/match by that name.

This also breaks iptables-restore, of course. Jan, you'll have to explain me
how you have tested this.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/ip6tables.c
iptables/iptables.c

index 36612161dc0e3f2a1ad65af17a9977c7578bdc80..faddb71b64996d4424485eb1688e7159b5466255 100644 (file)
@@ -1286,7 +1286,10 @@ static void command_jump(struct iptables_command_state *cs)
 
        cs->target->t = xtables_calloc(1, size);
        cs->target->t->u.target_size = size;
-       strcpy(cs->target->t->u.user.name, cs->target->real_name);
+       if (cs->target->real_name != NULL)
+               strcpy(cs->target->t->u.user.name, cs->jumpto);
+       else
+               strcpy(cs->target->t->u.user.name, cs->target->real_name);
        cs->target->t->u.user.revision = cs->target->revision;
        if (cs->target->real_name != cs->target->name)
                fprintf(stderr, "WARNING: The %s target is obsolete. "
index e935f651e2a7023d4e70eff82bbfdb95a94edb54..96cea64dd200a7fa36008bacf62249299018720a 100644 (file)
@@ -1295,7 +1295,10 @@ static void command_jump(struct iptables_command_state *cs)
 
        cs->target->t = xtables_calloc(1, size);
        cs->target->t->u.target_size = size;
-       strcpy(cs->target->t->u.user.name, cs->target->real_name);
+       if (cs->target->real_name != NULL)
+               strcpy(cs->target->t->u.user.name, cs->jumpto);
+       else
+               strcpy(cs->target->t->u.user.name, cs->target->real_name);
        cs->target->t->u.user.revision = cs->target->revision;
        if (cs->target->real_name != cs->target->name)
                /* Alias support for userspace side */