OSDN Git Service

netfilter: nfnetlink_hook: use the sequence number of the request message
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 3 Aug 2021 23:27:19 +0000 (01:27 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 6 Aug 2021 15:07:40 +0000 (17:07 +0200)
The sequence number allows to correlate the netlink reply message (as
part of the dump) with the original request message.

The cb->seq field is internally used to detect an interference (update)
of the hook list during the netlink dump, do not use it as sequence
number in the netlink dump header.

Fixes: e2cf17d3774c ("netfilter: add new hook nfnl subsystem")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nfnetlink_hook.c

index e0ff297..7b0d4a3 100644 (file)
@@ -264,7 +264,8 @@ static int nfnl_hook_dump(struct sk_buff *nlskb,
        ops = nf_hook_entries_get_hook_ops(e);
 
        for (; i < e->num_hook_entries; i++) {
-               err = nfnl_hook_dump_one(nlskb, ctx, ops[i], cb->seq);
+               err = nfnl_hook_dump_one(nlskb, ctx, ops[i],
+                                        cb->nlh->nlmsg_seq);
                if (err)
                        break;
        }