From c552570dc67a56614c1053b9ea2fb27cd6ce106b Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Sun, 15 Nov 2015 16:10:45 +0000 Subject: rule: move comment out of handle The comment does not belong to the handle, it belongs to the rule. Signed-off-by: Patrick McHardy --- src/netlink_delinearize.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/netlink_delinearize.c') diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c index 3584de78..3499d748 100644 --- a/src/netlink_delinearize.c +++ b/src/netlink_delinearize.c @@ -1609,19 +1609,19 @@ struct rule *netlink_delinearize_rule(struct netlink_ctx *ctx, if (nftnl_rule_is_set(nlr, NFTNL_RULE_POSITION)) h.position = nftnl_rule_get_u64(nlr, NFTNL_RULE_POSITION); + pctx->rule = rule_alloc(&netlink_location, &h); + pctx->table = table_lookup(&h); + assert(pctx->table != NULL); + if (nftnl_rule_is_set(nlr, NFTNL_RULE_USERDATA)) { - uint32_t len; const void *data; + uint32_t len; - data = nftnl_rule_get_data(nlr, NFTNL_RULE_USERDATA, - &len); - h.comment = xmalloc(len); - memcpy((char *)h.comment, data, len); + data = nftnl_rule_get_data(nlr, NFTNL_RULE_USERDATA, &len); + pctx->rule->comment = xmalloc(len); + memcpy((char *)pctx->rule->comment, data, len); } - pctx->rule = rule_alloc(&netlink_location, &h); - pctx->table = table_lookup(&h); - assert(pctx->table != NULL); nftnl_expr_foreach((struct nftnl_rule *)nlr, netlink_parse_expr, pctx); rule_parse_postprocess(pctx, pctx->rule); -- cgit v1.2.3