From d25e217578492d17f7752bf77cfab5f2c2509795 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sun, 6 Mar 2011 14:57:44 +0100 Subject: libxtables: XTTYPE_MARKMASK32 support Signed-off-by: Jan Engelhardt --- include/xtables.h.in | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/xtables.h.in') diff --git a/include/xtables.h.in b/include/xtables.h.in index c3c8da9c..2fa59771 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -50,6 +50,7 @@ struct in_addr; * %XTTYPE_UINT*: standard integer * %XTTYPE_UINT*RC: colon-separated range of standard integers * %XTTYPE_STRING: arbitrary string + * %XTTYPE_MARKMASK32: 32-bit mark with optional mask */ enum xt_option_type { XTTYPE_NONE, @@ -57,6 +58,7 @@ enum xt_option_type { XTTYPE_UINT32, XTTYPE_UINT32RC, XTTYPE_STRING, + XTTYPE_MARKMASK32, }; /** @@ -113,6 +115,9 @@ struct xt_option_call { union { uint8_t u8; uint32_t u32, u32_range[2]; + struct { + uint32_t mark, mask; + }; } val; }; -- cgit v1.2.3 From 8b5bdea659f1fb86b3288a2568ab104a90b914e5 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sun, 6 Mar 2011 16:56:53 +0100 Subject: libxtables: XTTYPE_UINT64 support Signed-off-by: Jan Engelhardt --- include/xtables.h.in | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/xtables.h.in') diff --git a/include/xtables.h.in b/include/xtables.h.in index 2fa59771..c361bdbd 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -56,6 +56,7 @@ enum xt_option_type { XTTYPE_NONE, XTTYPE_UINT8, XTTYPE_UINT32, + XTTYPE_UINT64, XTTYPE_UINT32RC, XTTYPE_STRING, XTTYPE_MARKMASK32, @@ -115,6 +116,7 @@ struct xt_option_call { union { uint8_t u8; uint32_t u32, u32_range[2]; + uint64_t u64; struct { uint32_t mark, mask; }; -- cgit v1.2.3 From 2e0ec4fa0fb5162c441cd666f55fe76777e40d5e Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sun, 6 Mar 2011 16:24:43 +0100 Subject: libxtables: linked-list name<->id map This consolidates the maps from libxt_devgroup and libxt_realm. Signed-off-by: Jan Engelhardt --- include/xtables.h.in | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include/xtables.h.in') diff --git a/include/xtables.h.in b/include/xtables.h.in index c361bdbd..30d9e73b 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -134,6 +134,16 @@ struct xt_fcheck_call { unsigned int xflags; }; +/** + * A "linear"/linked-list based name<->id map, for files similar to + * /etc/iproute2/. + */ +struct xtables_lmap { + char *name; + int id; + struct xtables_lmap *next; +}; + /* Include file for additions: new matches and targets. */ struct xtables_match { @@ -418,6 +428,11 @@ extern void xtables_option_mfcall(struct xtables_match *); extern void xtables_options_fcheck(const char *, unsigned int, const struct xt_option_entry *); +extern struct xtables_lmap *xtables_lmap_init(const char *); +extern void xtables_lmap_free(struct xtables_lmap *); +extern int xtables_lmap_name2id(const struct xtables_lmap *, const char *); +extern const char *xtables_lmap_id2name(const struct xtables_lmap *, int); + #ifdef XTABLES_INTERNAL /* Shipped modules rely on this... */ -- cgit v1.2.3 From 564eaf48e14411803a353206eefbb89d525c63ff Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sun, 6 Mar 2011 16:59:23 +0100 Subject: libxtables: XTTYPE_UINT16RC support Signed-off-by: Jan Engelhardt --- include/xtables.h.in | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/xtables.h.in') diff --git a/include/xtables.h.in b/include/xtables.h.in index 30d9e73b..ae76bb6b 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -57,6 +57,7 @@ enum xt_option_type { XTTYPE_UINT8, XTTYPE_UINT32, XTTYPE_UINT64, + XTTYPE_UINT16RC, XTTYPE_UINT32RC, XTTYPE_STRING, XTTYPE_MARKMASK32, @@ -115,6 +116,7 @@ struct xt_option_call { uint8_t nvals; union { uint8_t u8; + uint16_t u16_range[2]; uint32_t u32, u32_range[2]; uint64_t u64; struct { -- cgit v1.2.3 From 8bf513ada0aae0e4b1ac5160113fc532c2f525d0 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sun, 6 Mar 2011 17:09:19 +0100 Subject: libxtables: XTTYPE_UINT8RC support Signed-off-by: Jan Engelhardt --- include/xtables.h.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/xtables.h.in') diff --git a/include/xtables.h.in b/include/xtables.h.in index ae76bb6b..8f65b053 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -57,6 +57,7 @@ enum xt_option_type { XTTYPE_UINT8, XTTYPE_UINT32, XTTYPE_UINT64, + XTTYPE_UINT8RC, XTTYPE_UINT16RC, XTTYPE_UINT32RC, XTTYPE_STRING, @@ -115,7 +116,7 @@ struct xt_option_call { bool invert; uint8_t nvals; union { - uint8_t u8; + uint8_t u8, u8_range[2]; uint16_t u16_range[2]; uint32_t u32, u32_range[2]; uint64_t u64; -- cgit v1.2.3 From bc438c4cbdab09fafbbceecddd54e44e4234a4a1 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sun, 6 Mar 2011 17:13:54 +0100 Subject: libxtables: XTTYPE_UINT64RC support Signed-off-by: Jan Engelhardt --- include/xtables.h.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/xtables.h.in') diff --git a/include/xtables.h.in b/include/xtables.h.in index 8f65b053..325c04c4 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -60,6 +60,7 @@ enum xt_option_type { XTTYPE_UINT8RC, XTTYPE_UINT16RC, XTTYPE_UINT32RC, + XTTYPE_UINT64RC, XTTYPE_STRING, XTTYPE_MARKMASK32, }; @@ -119,7 +120,7 @@ struct xt_option_call { uint8_t u8, u8_range[2]; uint16_t u16_range[2]; uint32_t u32, u32_range[2]; - uint64_t u64; + uint64_t u64, u64_range[2]; struct { uint32_t mark, mask; }; -- cgit v1.2.3 From 0eff54bd407aae6b99c3b189d356929e399b5a38 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sun, 6 Mar 2011 17:42:51 +0100 Subject: libxtables: XTTYPE_UINT16 support Signed-off-by: Jan Engelhardt --- include/xtables.h.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/xtables.h.in') diff --git a/include/xtables.h.in b/include/xtables.h.in index 325c04c4..6167f4da 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -55,6 +55,7 @@ struct in_addr; enum xt_option_type { XTTYPE_NONE, XTTYPE_UINT8, + XTTYPE_UINT16, XTTYPE_UINT32, XTTYPE_UINT64, XTTYPE_UINT8RC, @@ -118,7 +119,7 @@ struct xt_option_call { uint8_t nvals; union { uint8_t u8, u8_range[2]; - uint16_t u16_range[2]; + uint16_t u16, u16_range[2]; uint32_t u32, u32_range[2]; uint64_t u64, u64_range[2]; struct { -- cgit v1.2.3 From 33d180871bea281a448efd0c1a49517318162382 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sun, 6 Mar 2011 18:11:58 +0100 Subject: libxtables: pass struct xt_entry_{match,target} to x6 parser Signed-off-by: Jan Engelhardt --- include/xtables.h.in | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/xtables.h.in') diff --git a/include/xtables.h.in b/include/xtables.h.in index 6167f4da..afade14b 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -126,6 +126,10 @@ struct xt_option_call { uint32_t mark, mask; }; } val; + union { + struct xt_entry_match **match; + struct xt_entry_target **target; + }; }; /** -- cgit v1.2.3 From 41a4cea0f4109fb76762dca073c3c1217658ee06 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 15 Feb 2011 22:10:48 +0100 Subject: libxtables: XTTYPE_SYSLOGLEVEL support Signed-off-by: Jan Engelhardt --- include/xtables.h.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/xtables.h.in') diff --git a/include/xtables.h.in b/include/xtables.h.in index afade14b..afdac36a 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -51,6 +51,7 @@ struct in_addr; * %XTTYPE_UINT*RC: colon-separated range of standard integers * %XTTYPE_STRING: arbitrary string * %XTTYPE_MARKMASK32: 32-bit mark with optional mask + * %XTTYPE_SYSLOGLEVEL: syslog level by name or number */ enum xt_option_type { XTTYPE_NONE, @@ -64,6 +65,7 @@ enum xt_option_type { XTTYPE_UINT64RC, XTTYPE_STRING, XTTYPE_MARKMASK32, + XTTYPE_SYSLOGLEVEL, }; /** @@ -118,7 +120,7 @@ struct xt_option_call { bool invert; uint8_t nvals; union { - uint8_t u8, u8_range[2]; + uint8_t u8, u8_range[2], syslog_level; uint16_t u16, u16_range[2]; uint32_t u32, u32_range[2]; uint64_t u64, u64_range[2]; -- cgit v1.2.3 From 2b01f706e7ba48d72e57f8e47457a86d9ed44992 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 14 Feb 2011 15:10:15 +0100 Subject: libxtables: XTTYPE_ONEHOST support The bonus of the POSIX socket API is that it is almost protocol-agnostic and that there are ready-made functions to take over the gist of address parsing and packing. Signed-off-by: Jan Engelhardt --- include/xtables.h.in | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/xtables.h.in') diff --git a/include/xtables.h.in b/include/xtables.h.in index afdac36a..d8a31245 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -52,6 +52,7 @@ struct in_addr; * %XTTYPE_STRING: arbitrary string * %XTTYPE_MARKMASK32: 32-bit mark with optional mask * %XTTYPE_SYSLOGLEVEL: syslog level by name or number + * %XTTYPE_ONEHOST: one host or address (union nf_inet_addr) */ enum xt_option_type { XTTYPE_NONE, @@ -66,6 +67,7 @@ enum xt_option_type { XTTYPE_STRING, XTTYPE_MARKMASK32, XTTYPE_SYSLOGLEVEL, + XTTYPE_ONEHOST, }; /** @@ -124,6 +126,7 @@ struct xt_option_call { uint16_t u16, u16_range[2]; uint32_t u32, u32_range[2]; uint64_t u64, u64_range[2]; + union nf_inet_addr inetaddr; struct { uint32_t mark, mask; }; -- cgit v1.2.3 From b8592fa3352018646b0befaa48f930f75c5b7d92 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 14 Feb 2011 15:12:50 +0100 Subject: libxtables: XTTYPE_PORT support Signed-off-by: Jan Engelhardt --- include/xtables.h.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/xtables.h.in') diff --git a/include/xtables.h.in b/include/xtables.h.in index d8a31245..a9a9ffad 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -53,6 +53,8 @@ struct in_addr; * %XTTYPE_MARKMASK32: 32-bit mark with optional mask * %XTTYPE_SYSLOGLEVEL: syslog level by name or number * %XTTYPE_ONEHOST: one host or address (union nf_inet_addr) + * %XTTYPE_PORT: 16-bit port name or number + * %XTTYPE_PORT_NE: 16-bit port name or number, stored as network-endian */ enum xt_option_type { XTTYPE_NONE, @@ -68,6 +70,8 @@ enum xt_option_type { XTTYPE_MARKMASK32, XTTYPE_SYSLOGLEVEL, XTTYPE_ONEHOST, + XTTYPE_PORT, + XTTYPE_PORT_NE, }; /** @@ -123,7 +127,7 @@ struct xt_option_call { uint8_t nvals; union { uint8_t u8, u8_range[2], syslog_level; - uint16_t u16, u16_range[2]; + uint16_t u16, u16_range[2], port; uint32_t u32, u32_range[2]; uint64_t u64, u64_range[2]; union nf_inet_addr inetaddr; -- cgit v1.2.3