summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHolger Eitzenberger <holger@eitzenberger.org>2011-01-24 22:36:33 +0100
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2011-01-25 21:12:28 +0100
commit7d9ab336bb12c15bae566ee1389cf3da23ef6067 (patch)
tree3334fa5b613927eaef6239dcea475cfd57764b13 /lib
parentba623ef3b9ce8f2a92f0f1e47163468932816ab3 (diff)
ipset: fix the Netlink sequence number
Do not use time() as a Netlink sequence number for each message, as otherwise the same seq number will be used when sending another message in the same second. Instead use time() just for initialization, then increment per message. Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org> Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Diffstat (limited to 'lib')
-rw-r--r--lib/mnl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/mnl.c b/lib/mnl.c
index 683dba2..77e4faa 100644
--- a/lib/mnl.c
+++ b/lib/mnl.c
@@ -75,7 +75,7 @@ ipset_mnl_fill_hdr(struct ipset_handle *handle, enum ipset_cmd cmd,
nlh->nlmsg_flags = cmdflags[cmd - 1];
if (envflags & IPSET_ENV_EXIST)
nlh->nlmsg_flags &= ~NLM_F_EXCL;
- nlh->nlmsg_seq = handle->seq = time(NULL);
+ nlh->nlmsg_seq = ++handle->seq;
nfg = mnl_nlmsg_put_extra_header(nlh, sizeof(struct nfgenmsg));
nfg->nfgen_family = AF_INET;
@@ -135,6 +135,7 @@ ipset_mnl_init(mnl_cb_t *cb_ctl, void *data)
handle->portid = mnl_socket_get_portid(handle->h);
handle->cb_ctl = cb_ctl;
handle->data = data;
+ handle->seq = time(NULL);
return handle;