* [PATCH libnftnl v2] src: libnftnl: add support for matching IPv4 options
@ 2019-06-20 11:54 Stephen Suryaputra
2019-06-21 16:06 ` Pablo Neira Ayuso
2019-07-04 12:32 ` Pablo Neira Ayuso
0 siblings, 2 replies; 4+ messages in thread
From: Stephen Suryaputra @ 2019-06-20 11:54 UTC (permalink / raw)
To: netfilter-devel; +Cc: Stephen Suryaputra
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.
v2: Remove statements about supporting other options to reflect what are
supported in the kernel.
Signed-off-by: Stephen Suryaputra <ssuryaextr@gmail.com>
---
include/linux/netfilter/nf_tables.h | 2 ++
src/expr/exthdr.c | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/include/linux/netfilter/nf_tables.h b/include/linux/netfilter/nf_tables.h
index fd38cdc..a5e9bf3 100644
--- a/include/linux/netfilter/nf_tables.h
+++ b/include/linux/netfilter/nf_tables.h
@@ -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)
diff --git a/src/expr/exthdr.c b/src/expr/exthdr.c
index bef453e..e5f714b 100644
--- a/src/expr/exthdr.c
+++ b/src/expr/exthdr.c
@@ -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;
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH libnftnl v2] src: libnftnl: add support for matching IPv4 options
2019-06-20 11:54 [PATCH libnftnl v2] src: libnftnl: add support for matching IPv4 options Stephen Suryaputra
@ 2019-06-21 16:06 ` Pablo Neira Ayuso
2019-06-24 18:25 ` Stephen Suryaputra
2019-07-04 12:32 ` Pablo Neira Ayuso
1 sibling, 1 reply; 4+ messages in thread
From: Pablo Neira Ayuso @ 2019-06-21 16:06 UTC (permalink / raw)
To: Stephen Suryaputra; +Cc: netfilter-devel
On Thu, Jun 20, 2019 at 07:54:29AM -0400, Stephen Suryaputra wrote:
[...]
> diff --git a/src/expr/exthdr.c b/src/expr/exthdr.c
> index bef453e..e5f714b 100644
> --- a/src/expr/exthdr.c
> +++ b/src/expr/exthdr.c
> @@ -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 "";
> }
Would you mind to install libnftnl with this patch on top and run:
nftables/tests/py/# python nft-tests.py
to check if this breaks testcases, if so a patch to update tests in
nftables would be great too.
Thanks!
> @@ -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;
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH libnftnl v2] src: libnftnl: add support for matching IPv4 options
2019-06-21 16:06 ` Pablo Neira Ayuso
@ 2019-06-24 18:25 ` Stephen Suryaputra
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Suryaputra @ 2019-06-24 18:25 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
On Fri, Jun 21, 2019 at 06:06:53PM +0200, Pablo Neira Ayuso wrote:
>
> Would you mind to install libnftnl with this patch on top and run:
>
> nftables/tests/py/# python nft-tests.py
>
> to check if this breaks testcases, if so a patch to update tests in
> nftables would be great too.
Updated the testcases payload files. Will spin another nftables patch
version.
Thanks,
Stephen.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH libnftnl v2] src: libnftnl: add support for matching IPv4 options
2019-06-20 11:54 [PATCH libnftnl v2] src: libnftnl: add support for matching IPv4 options Stephen Suryaputra
2019-06-21 16:06 ` Pablo Neira Ayuso
@ 2019-07-04 12:32 ` Pablo Neira Ayuso
1 sibling, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2019-07-04 12:32 UTC (permalink / raw)
To: Stephen Suryaputra; +Cc: netfilter-devel
On Thu, Jun 20, 2019 at 07:54:29AM -0400, Stephen Suryaputra wrote:
> 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.
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-07-04 12:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-20 11:54 [PATCH libnftnl v2] src: libnftnl: add support for matching IPv4 options Stephen Suryaputra
2019-06-21 16:06 ` Pablo Neira Ayuso
2019-06-24 18:25 ` Stephen Suryaputra
2019-07-04 12:32 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).