netfilter: nft_exthdr: add boolean DCCP option matching
Subsystems (2)
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.
Signed-off-by Jeremy Sowden <[email protected]>
---
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
@@ -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