diff --git a/src/libnfnetlink.c b/src/libnfnetlink.c index d4212f9..5cfe2f5 100644 --- a/src/libnfnetlink.c +++ b/src/libnfnetlink.c @@ -418,7 +418,11 @@ void nfnl_fill_hdr(struct nfnl_subsys_handle *ssh, nlh->nlmsg_type = (ssh->subsys_id<<8)|msg_type; nlh->nlmsg_flags = msg_flags; nlh->nlmsg_pid = 0; - nlh->nlmsg_seq = ++ssh->nfnlh->seq; + /* set sequence number if we expect an answer from kernelspace */ + if (msg_flags & (NLM_F_ACK | NLM_F_ECHO | NLM_F_DUMP)) + nlh->nlmsg_seq = ++ssh->nfnlh->seq; + else + nlh->nlmsg_seq = 0; /* check for wraparounds: assume that seqnum 0 is only used by events */ if (!ssh->nfnlh->seq)