Skip to contentSkip to conversation

netfilter: nft_exthdr: add boolean DCCP option matching

PATCH Superseded Jeremy Sowden 1 participant 1 message Apr 11, 2023

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 netfilter: nft_exthdr: add boolean DCCP option matching

The xt_dccp iptables module supports the matching of DCCP packets based on the presence or absence of DCCP options. Extend nft_exthdr to add this functionality to nftables.

---
Changes since v1

* The order in which optlen and optoff are assigned and validated has been updated in line with Florian's feedback.
* The whole option block is no longer copied into a buffer in struct nft_exthdr_dccp. Access to this was not synchronized, which would have been unsafe. Since DCCP options are encoded in a TLV format and we don't need to inspect the values, we use an on-stack buffer with enough space to hold the type and length.

 include/uapi/linux/netfilter/nf_tables.h |   2 +
 net/netfilter/nft_exthdr.c               | 105 +++++++++++++++++++++++
 2 files changed, 107 insertions(+)
include/uapi/linux/netfilter/nf_tables.h +2 -0
index c4d4d8e42dc8..e059dc2644df 100644
@@ -859,12 +859,14 @@ enum nft_exthdr_flags {
  * @NFT_EXTHDR_OP_TCP: match against tcp options
  * @NFT_EXTHDR_OP_IPV4: match against ipv4 options
  * @NFT_EXTHDR_OP_SCTP: match against sctp chunks
+ * @NFT_EXTHDR_OP_DCCP: match against dccp otions
  */
 enum nft_exthdr_op {
 	NFT_EXTHDR_OP_IPV6,
 	NFT_EXTHDR_OP_TCPOPT,
 	NFT_EXTHDR_OP_IPV4,
 	NFT_EXTHDR_OP_SCTP,
+	NFT_EXTHDR_OP_DCCP,
 	__NFT_EXTHDR_OP_MAX
 };
 #define NFT_EXTHDR_OP_MAX	(__NFT_EXTHDR_OP_MAX - 1)
net/netfilter/nft_exthdr.c +105 -0

135 lines not on this page · raw message

Signature · 1 line
2.39.2