From 1c3149ff21d44460a8a506abb22cad6d6c158cd3 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 24 Dec 2021 16:25:22 +0100 Subject: 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 --- src/conntrack.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/conntrack.c') 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); } -- cgit v1.2.3