summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2017-02-28 13:31:54 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2017-02-28 13:52:17 +0100
commit22535a98470a908b879db8fc0354c5f2bbb3984e (patch)
treeddb527050d4db4e527c111a17bd1bc353069d324 /include
parent68ca39b68fb97733b7d04d9a5439cad4f38bfa2e (diff)
src: revisit tcp options support
Rework syntax, add tokens so we can extend the grammar more easily. This has triggered several syntax changes with regards to the original patch, specifically: tcp option sack0 left 1 There is no space between sack and the block number anymore, no more offset field, now they are a single field. Just like we do with rt, rt0 and rt2. This simplifies our grammar and that is good since it makes our life easier when extending it later on to accomodate new features. I have also renamed sack_permitted to sack-permitted. I couldn't find any option using underscore so far, so let's keep it consistent with what we have. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include')
-rw-r--r--include/tcpopt.h32
1 files changed, 29 insertions, 3 deletions
diff --git a/include/tcpopt.h b/include/tcpopt.h
index 5b990083..f43a7eb7 100644
--- a/include/tcpopt.h
+++ b/include/tcpopt.h
@@ -5,9 +5,7 @@
#include <exthdr.h>
extern struct expr *tcpopt_expr_alloc(const struct location *loc,
- const char *option_str,
- const unsigned int option_num,
- const char *optioni_field);
+ uint8_t type, uint8_t field);
extern void tcpopt_init_raw(struct expr *expr, uint8_t type,
unsigned int offset, unsigned int len);
@@ -15,6 +13,34 @@ extern void tcpopt_init_raw(struct expr *expr, uint8_t type,
extern bool tcpopt_find_template(struct expr *expr, const struct expr *mask,
unsigned int *shift);
+enum tcpopt_hdr_types {
+ TCPOPTHDR_INVALID,
+ TCPOPTHDR_EOL,
+ TCPOPTHDR_NOOP,
+ TCPOPTHDR_MAXSEG,
+ TCPOPTHDR_WINDOW,
+ TCPOPTHDR_SACK_PERMITTED,
+ TCPOPTHDR_SACK0,
+ TCPOPTHDR_SACK1,
+ TCPOPTHDR_SACK2,
+ TCPOPTHDR_SACK3,
+ TCPOPTHDR_TIMESTAMP,
+ TCPOPTHDR_ECHO,
+ TCPOPTHDR_ECHO_REPLY,
+};
+
+enum tcpopt_hdr_fields {
+ TCPOPTHDR_FIELD_INVALID,
+ TCPOPTHDR_FIELD_KIND,
+ TCPOPTHDR_FIELD_LENGTH,
+ TCPOPTHDR_FIELD_SIZE,
+ TCPOPTHDR_FIELD_COUNT,
+ TCPOPTHDR_FIELD_LEFT,
+ TCPOPTHDR_FIELD_RIGHT,
+ TCPOPTHDR_FIELD_TSVAL,
+ TCPOPTHDR_FIELD_TSECR,
+};
+
extern const struct exthdr_desc tcpopt_eol;
extern const struct exthdr_desc tcpopt_nop;
extern const struct exthdr_desc tcpopt_maxseg;