From 864a1b44e1937a42753648644a812f70f9500a73 Mon Sep 17 00:00:00 2001 From: Manuel Messner Date: Tue, 7 Feb 2017 03:14:12 +0100 Subject: src: add TCP option matching This patch enables nft to match against TCP options. Currently these TCP options are supported: * End of Option List (eol) * No-Operation (noop) * Maximum Segment Size (maxseg) * Window Scale (window) * SACK Permitted (sack_permitted) * SACK (sack) * Timestamps (timestamp) Syntax: tcp options $option_name [$offset] $field_name Example: # count all incoming packets with a specific maximum segment size `x` # nft add rule filter input tcp option maxseg size x counter # count all incoming packets with a SACK TCP option where the third # (counted from zero) left field is greater `x`. # nft add rule filter input tcp option sack 2 left \> x counter If the offset (the `2` in the example above) is zero, it can optionally be omitted. For all non-SACK TCP options it is always zero, thus can be left out. Option names and field names are parsed from templates, similar to meta and ct options rather than via keywords to prevent adding more keywords than necessary. Signed-off-by: Manuel Messner Signed-off-by: Florian Westphal --- src/Makefile.am | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index c6586f5f..99eef7bb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -55,6 +55,7 @@ nft_SOURCES = main.c \ services.c \ mergesort.c \ scanner.l \ + tcpopt.c \ parser_bison.y if BUILD_CLI -- cgit v1.2.3