src: libnftnl: add support for matching IPv4 options
PATCH 1/1 src: libnftnl: add support for matching IPv4 options
This is the libnftnl change for the overall changes with this description:
Add capability to have rules matching IPv4 options. This is developed mainly to support dropping of IP packets with loose and/or strict source route route options. Nevertheless, the implementation include others and ability to get specific fields in the option.
Signed-off-by Stephen Suryaputra <[email protected]>
--- include/linux/netfilter/nf_tables.h | 2 ++ src/expr/exthdr.c | 5 +++++ 2 files changed, 7 insertions(+)
include/linux/netfilter/nf_tables.h +2 -0
@@ -729,10 +729,12 @@ enum nft_exthdr_flags {* * @NFT_EXTHDR_OP_IPV6: match against ipv6 extension headers * @NFT_EXTHDR_OP_TCP: match against tcp options +* @NFT_EXTHDR_OP_IPV4: match against ipv4 options */ enum nft_exthdr_op {NFT_EXTHDR_OP_IPV6 ,NFT_EXTHDR_OP_TCPOPT , +NFT_EXTHDR_OP_IPV4 , __NFT_EXTHDR_OP_MAX };#define NFT_EXTHDR_OP_MAX (__NFT_EXTHDR_OP_MAX - 1)
src/expr/exthdr.c +5 -0
@@ -200,6 +200,9 @@ static const char *op2str(uint8_t op)case NFT_EXTHDR_OP_TCPOPT :return " tcpopt" ;case NFT_EXTHDR_OP_IPV6 : +return " ipv6" ; +case NFT_EXTHDR_OP_IPV4 : +return " ipv4" ;default :return "" ; }
@@ -209,6 +212,8 @@ static inline int str2exthdr_op(const char* str) {if (!strcmp (str,"tcpopt" ))return NFT_EXTHDR_OP_TCPOPT ; +if (!strcmp (str,"ipv4" )) +return NFT_EXTHDR_OP_IPV4 ;/* if str == "ipv6" or anything else */ return NFT_EXTHDR_OP_IPV6 ;
Signature · 1 line
2.17.1