diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2021-12-24 16:25:22 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2021-12-24 16:25:22 +0100 |
commit | 1c3149ff21d44460a8a506abb22cad6d6c158cd3 (patch) | |
tree | ba23d17135aa074d0849a619ca5386c1b14827e7 /src | |
parent | 932d8d4fc4f991341c641bf38b8e3865f2e71943 (diff) |
conntrack: add netlink flags to nfct_mnl_nlmsghdr_put()
Moreover, remove NLM_F_DUMP for IPCTNL_MSG_CT_GET_STATS since ctnetlink
ignores this flag, this is simple netlink get command, not a dump.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/conntrack.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/conntrack.c b/src/conntrack.c index 067ae41..3f74fa1 100644 --- a/src/conntrack.c +++ b/src/conntrack.c @@ -2417,14 +2417,14 @@ static int nfct_mnl_socket_open(unsigned int events) static struct nlmsghdr * nfct_mnl_nlmsghdr_put(char *buf, uint16_t subsys, uint16_t type, - uint8_t family) + uint16_t flags, uint8_t family) { struct nlmsghdr *nlh; struct nfgenmsg *nfh; nlh = mnl_nlmsg_put_header(buf); nlh->nlmsg_type = (subsys << 8) | type; - nlh->nlmsg_flags = NLM_F_REQUEST|NLM_F_DUMP; + nlh->nlmsg_flags = NLM_F_REQUEST | flags; nlh->nlmsg_seq = time(NULL); nfh = mnl_nlmsg_put_extra_header(nlh, sizeof(struct nfgenmsg)); @@ -2470,7 +2470,7 @@ nfct_mnl_dump(uint16_t subsys, uint16_t type, mnl_cb_t cb, char buf[MNL_SOCKET_BUFFER_SIZE]; struct nlmsghdr *nlh; - nlh = nfct_mnl_nlmsghdr_put(buf, subsys, type, family); + nlh = nfct_mnl_nlmsghdr_put(buf, subsys, type, NLM_F_DUMP, family); if (filter_dump) nfct_nlmsg_build_filter(nlh, filter_dump); @@ -2500,7 +2500,7 @@ nfct_mnl_get(uint16_t subsys, uint16_t type, mnl_cb_t cb, uint8_t family) char buf[MNL_SOCKET_BUFFER_SIZE]; struct nlmsghdr *nlh; - nlh = nfct_mnl_nlmsghdr_put(buf, subsys, type, family); + nlh = nfct_mnl_nlmsghdr_put(buf, subsys, type, 0, family); return nfct_mnl_talk(nlh, cb); } |