]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
rule: Copy locations in handle_merge()
authorPhil Sutter <phil@nwl.cc>
Wed, 9 May 2018 14:03:41 +0000 (16:03 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 9 May 2018 16:29:21 +0000 (18:29 +0200)
This allows to make error messages point to the right part of the
command after handles were merged.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/rule.c

index bdfc10f3b59fbc7f723ba49abc9d4d21f21fd6a6..a365876d07ea8c967e802e61f401a1f429c7a01f 100644 (file)
@@ -40,12 +40,18 @@ void handle_merge(struct handle *dst, const struct handle *src)
 {
        if (dst->family == 0)
                dst->family = src->family;
-       if (dst->table.name == NULL && src->table.name != NULL)
+       if (dst->table.name == NULL && src->table.name != NULL) {
                dst->table.name = xstrdup(src->table.name);
-       if (dst->chain.name == NULL && src->chain.name != NULL)
+               dst->table.location = src->table.location;
+       }
+       if (dst->chain.name == NULL && src->chain.name != NULL) {
                dst->chain.name = xstrdup(src->chain.name);
-       if (dst->set.name == NULL && src->set.name != NULL)
+               dst->chain.location = src->chain.location;
+       }
+       if (dst->set.name == NULL && src->set.name != NULL) {
                dst->set.name = xstrdup(src->set.name);
+               dst->set.location = src->set.location;
+       }
        if (dst->flowtable == NULL && src->flowtable != NULL)
                dst->flowtable = xstrdup(src->flowtable);
        if (dst->obj.name == NULL && src->obj.name != NULL)