summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Brunner <s.brunner@stephan-brunner.net>2024-07-15 16:13:42 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2024-07-16 12:17:31 +0200
commit8a251ddc8c9da5b04e95eaba23cde6ab6576b7ca (patch)
tree0bde02a9d136a7632221f31800b2e82dcd93102d
parent5b61acb75b74725d7914b24568023f670ddeff62 (diff)
conntrack: tcp: fix parsing of tuple-port-src and tuple-port-dst
As seen in the parsing code above, L4PROTO should be set to IPPROTO_TCP, not the port number itself. Fixes: 40efc1ebb15b ("conntrack: cleanup command line tool protocol extensions") Co-Developed-by: Reinhard Nißl <reinhard.nissl@fee.de> Signed-off-by: Stephan Brunner <s.brunner@stephan-brunner.net>
-rw-r--r--extensions/libct_proto_tcp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/extensions/libct_proto_tcp.c b/extensions/libct_proto_tcp.c
index 27f5833..4681693 100644
--- a/extensions/libct_proto_tcp.c
+++ b/extensions/libct_proto_tcp.c
@@ -165,13 +165,13 @@ static int parse_options(char c,
case '8':
port = htons(atoi(optarg));
nfct_set_attr_u16(exptuple, ATTR_ORIG_PORT_SRC, port);
- nfct_set_attr_u8(exptuple, ATTR_ORIG_L4PROTO, port);
+ nfct_set_attr_u8(exptuple, ATTR_ORIG_L4PROTO, IPPROTO_TCP);
*flags |= CT_TCP_EXPTUPLE_SPORT;
break;
case '9':
port = htons(atoi(optarg));
nfct_set_attr_u16(exptuple, ATTR_ORIG_PORT_DST, port);
- nfct_set_attr_u8(exptuple, ATTR_ORIG_L4PROTO, port);
+ nfct_set_attr_u8(exptuple, ATTR_ORIG_L4PROTO, IPPROTO_TCP);
*flags |= CT_TCP_EXPTUPLE_DPORT;
break;
}