diff options
author | Florian Westphal <fw@strlen.de> | 2017-07-05 00:54:27 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2017-08-22 23:51:08 +0200 |
commit | 444ac7bee1452cdf59ec44400db210423052d109 (patch) | |
tree | 3b9d1b9952b78652e4b9342cb037899acf87a258 | |
parent | 0c0b2452bc3c96cf3db09eb8cbf62778a2fd8f6c (diff) |
rt: add path mtu support
Only use case is to allow similar behaviour to iptables
TCPMSS --clamp-mss-to-pmtu, by combining this with exthdr statement:
tcp option maxseg size set rt mtu
Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | doc/nft.xml | 7 | ||||
-rw-r--r-- | include/linux/netfilter/nf_tables.h | 1 | ||||
-rw-r--r-- | src/parser_bison.y | 1 | ||||
-rw-r--r-- | src/rt.c | 5 |
4 files changed, 14 insertions, 0 deletions
diff --git a/doc/nft.xml b/doc/nft.xml index d3213d02..4e2730f6 100644 --- a/doc/nft.xml +++ b/doc/nft.xml @@ -2836,6 +2836,11 @@ filter prerouting meta mark set 0xdead fib daddr . mark type vmap { blackhole : <entry>Routing nexthop</entry> <entry>ipv4_addr/ipv6_addr</entry> </row> + <row> + <entry>mtu</entry> + <entry>TCP maximum segment size of route</entry> + <entry>integer (16 bit)</entry> + </row> </tbody> </tgroup> </table> @@ -4270,6 +4275,8 @@ ip forward ip dscp set 42 <title>change tcp mss</title> <programlisting> tcp option maxseg size set 1360 +# set a size based on route information: +tcp option maxseg size set rt mtu </programlisting> </example> </para> diff --git a/include/linux/netfilter/nf_tables.h b/include/linux/netfilter/nf_tables.h index 40096de0..5441b190 100644 --- a/include/linux/netfilter/nf_tables.h +++ b/include/linux/netfilter/nf_tables.h @@ -813,6 +813,7 @@ enum nft_rt_keys { NFT_RT_CLASSID, NFT_RT_NEXTHOP4, NFT_RT_NEXTHOP6, + NFT_RT_TCPMSS, }; /** diff --git a/src/parser_bison.y b/src/parser_bison.y index 7898ea3f..18be53e8 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -3094,6 +3094,7 @@ rt_expr : RT rt_key rt_key : CLASSID { $$ = NFT_RT_CLASSID; } | NEXTHOP { $$ = NFT_RT_NEXTHOP4; } + | MTU { $$ = NFT_RT_TCPMSS; } ; ct_expr : CT ct_key @@ -73,6 +73,11 @@ static const struct rt_template rt_templates[] = { 16 * BITS_PER_BYTE, BYTEORDER_BIG_ENDIAN, true), + [NFT_RT_TCPMSS] = RT_TEMPLATE("mtu", + &integer_type, + 2 * BITS_PER_BYTE, + BYTEORDER_HOST_ENDIAN, + false), }; static void rt_expr_print(const struct expr *expr, struct output_ctx *octx) |