From 5a7775a1d699ced8a0c760d4849c4e84bac9268a Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Wed, 9 May 2018 16:03:41 +0200 Subject: rule: Copy locations in handle_merge() This allows to make error messages point to the right part of the command after handles were merged. Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- src/rule.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/rule.c b/src/rule.c index bdfc10f3..a365876d 100644 --- a/src/rule.c +++ b/src/rule.c @@ -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) -- cgit v1.2.3