]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
libiptc: minor bugfix
authorJesper Dangaard Brouer <hawk@comx.dk>
Thu, 3 Jul 2008 18:29:34 +0000 (20:29 +0200)
committerPatrick McHardy <kaber@trash.net>
Thu, 3 Jul 2008 18:29:34 +0000 (20:29 +0200)
Minor bugfix, an extra check is needed if the tail element is a
builtin chain, as builtin chains are not sorted.

Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
Signed-off-by: Patrick McHardy <kaber@trash.net>
libiptc/libiptc.c

index d0f51b4a05dd74f7f3bd3a63666b1d67e6a6ce4a..ec5317bc47e1152edd3333a2871b19930565399e 100644 (file)
@@ -819,7 +819,8 @@ static void __iptcc_p_add_chain(TC_HANDLE_T h, struct chain_head *c,
                list_add_tail(&c->list, &h->chains);
        else {
                ctail = list_entry(tail, struct chain_head, list);
-               if (strcmp(c->name, ctail->name) > 0)
+               if (strcmp(c->name, ctail->name) > 0 ||
+                   iptcc_is_builtin(ctail))
                        list_add_tail(&c->list, &h->chains);/* Already sorted*/
                else
                        iptc_insert_chain(h, c);/* Was not sorted */