summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2023-08-21 12:14:56 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2023-08-22 10:49:52 +0200
commitf2b2581573f7274fb0c292bae8dcfa29a1aac569 (patch)
tree5a7bc6a95017299c81e3eb5ede29fcab379a9409 /src
parent3251e0530b3dc718acc70168285d030e36d9aee4 (diff)
conntrack: unbreak -U command, use correct family
Set the family from the conntrack object, otherwise, if -f is not specified and the kernel bails out with: # conntrack -U -p tcp -m 1 Operation failed: Not supported conntrack v1.4.7 (conntrack-tools): Operation failed: Not supported Fixes: b7a396b70015 ("conntrack: use libmnl for updating conntrack table") Reported-by: Tony He <huangya90@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r--src/conntrack.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/conntrack.c b/src/conntrack.c
index 89800b7..e1385b2 100644
--- a/src/conntrack.c
+++ b/src/conntrack.c
@@ -2184,14 +2184,16 @@ static int mnl_nfct_update_cb(const struct nlmsghdr *nlh, void *data)
if (nfct_cmp(tmp, ct, NFCT_CMP_ALL | NFCT_CMP_MASK))
goto destroy_ok;
- res = nfct_mnl_request(modifier_sock, NFNL_SUBSYS_CTNETLINK, cmd->family,
+ res = nfct_mnl_request(modifier_sock, NFNL_SUBSYS_CTNETLINK,
+ nfct_get_attr_u8(ct, ATTR_ORIG_L3PROTO),
IPCTNL_MSG_CT_NEW, NLM_F_ACK, NULL, tmp, NULL);
if (res < 0) {
fprintf(stderr, "Operation failed: %s\n",
err2str(errno, CT_UPDATE));
}
- res = nfct_mnl_request(modifier_sock, NFNL_SUBSYS_CTNETLINK, cmd->family,
+ res = nfct_mnl_request(modifier_sock, NFNL_SUBSYS_CTNETLINK,
+ nfct_get_attr_u8(ct, ATTR_ORIG_L3PROTO),
IPCTNL_MSG_CT_GET, NLM_F_ACK,
mnl_nfct_print_cb, tmp, NULL);
if (res < 0) {