path: root/src/rule.c
diff options
authorPablo Neira Ayuso <>2017-08-14 17:47:21 +0200
committerPablo Neira Ayuso <>2017-08-15 14:03:41 +0200
commit0d9d04c31481c7c73b4ba64f0ad746b84c4250c5 (patch)
tree60713cea11ad785cfba3ceff19983e5394b97d2a /src/rule.c
parent2caecefe812e4d614687926d259ade3106935c56 (diff)
src: make netlink sequence number non-static
Place sequence number that is allocated per-command on the struct netlink_ctx structure. This is allocated from nft_run() to correlate commands with netlink messages for error reporting. Batch support probing also shares this sequence numbers with commands. There is an inpendent cache sequence number though, this routine is called from a different path, usually from the evaluation phase. Signed-off-by: Pablo Neira Ayuso <>
Diffstat (limited to 'src/rule.c')
1 files changed, 2 insertions, 1 deletions
diff --git a/src/rule.c b/src/rule.c
index 38cd648e..ef12becd 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -135,6 +135,7 @@ static int cache_init(struct mnl_socket *nf_sock, struct nft_cache *cache,
ctx.nf_sock = nf_sock;
ctx.cache = cache;
ctx.msgs = msgs;
+ ctx.seqnum = cache->seqnum++;
ret = cache_init_tables(&ctx, &handle, cache);
if (ret < 0)
@@ -154,7 +155,7 @@ int cache_update(struct mnl_socket *nf_sock, struct nft_cache *cache,
if (cache->initialized)
return 0;
- netlink_genid_get(nf_sock);
+ netlink_genid_get(nf_sock, cache->seqnum++);
ret = cache_init(nf_sock, cache, cmd, msgs);
if (ret < 0) {