futher {ip,ip6,arp}_tables unification
Subsystems (3)
PATCH 1/1 futher {ip,ip6,arp}_tables unification
This patch moves {ip,ip6,arp}t_entry_{match,target} definitions to x_tables.h. This move simplifies code and future compatibility fixes.
Signature · 2 lines
Thanks, Dmitry.
include/linux/netfilter/x_tables.h +56 -0
@@ -4,6 +4,62 @@#define XT_FUNCTION_MAXNAMELEN 30#define XT_TABLE_MAXNAMELEN 32 +struct xt_entry_match +{ +union { +struct { +u_int16_t match_size; + +/* Used by userspace */ +char name[XT_FUNCTION_MAXNAMELEN -1 ]; + +u_int8_t revision; + } user; +struct { +u_int16_t match_size; + +/* Used inside the kernel */ +struct xt_match *match; + } kernel; + +/* Total length */ +u_int16_t match_size; + } u; + +unsigned char data[0 ]; +}; + +struct xt_entry_target +{ +union { +struct { +u_int16_t target_size; + +/* Used by userspace */ +char name[XT_FUNCTION_MAXNAMELEN -1 ]; + +u_int8_t revision; + } user; +struct { +u_int16_t target_size; + +/* Used inside the kernel */ +struct xt_target *target; + } kernel; + +/* Total length */ +u_int16_t target_size; + } u; + +unsigned char data[0 ]; +}; + +struct xt_standard_target +{ +struct xt_entry_target target; +int verdict; +}; +/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision * kernel supports, if >= revision. */ struct xt_get_revision
include/linux/netfilter_arp/arp_tables.h +2 -29
@@ -65,35 +65,8 @@ struct arpt_arp {u_int16_t invflags; }; -struct arpt_entry_target -{ -union { -struct { -u_int16_t target_size; - -/* Used by userspace */ -char name[ARPT_FUNCTION_MAXNAMELEN -1 ]; -u_int8_t revision; - } user; -struct { -u_int16_t target_size; - -/* Used inside the kernel */ -struct arpt_target *target; - } kernel; - -/* Total length */ -u_int16_t target_size; - } u; - -unsigned char data[0 ]; -}; - -struct arpt_standard_target -{ -struct arpt_entry_target target; -int verdict; -}; +#define arpt_entry_target xt_entry_target +#define arpt_standard_target xt_standard_target/* Values for "flag" field in struct arpt_ip (general arp structure). * No flags defined yet.
include/linux/netfilter_ipv4/ip_tables.h +3 -55
64 lines not on this page · raw message
include/linux/netfilter_ipv6/ip6_tables.h +3 -54
63 lines not on this page · raw message
Forgot required tc_ipt.h modification. Corrected.
Quoted 5 lines · Dmitry Mishin
This patch moves {ip,ip6,arp}t_entry_{match,target} definitions to
x_tables.h. This move simplifies code and future compatibility fixes.Signed-off-by Dmitry Mishin <[email protected]>Acked-off-by Kirill Korotaev <[email protected]>
Signature · 2 lines
Thanks, Dmitry.
include/linux/netfilter/x_tables.h +56 -0
@@ -4,6 +4,62 @@#define XT_FUNCTION_MAXNAMELEN 30#define XT_TABLE_MAXNAMELEN 32 +struct xt_entry_match +{ +union { +struct { +u_int16_t match_size; + +/* Used by userspace */ +char name[XT_FUNCTION_MAXNAMELEN -1 ]; + +u_int8_t revision; + } user; +struct { +u_int16_t match_size; + +/* Used inside the kernel */ +struct xt_match *match; + } kernel; + +/* Total length */ +u_int16_t match_size; + } u; + +unsigned char data[0 ]; +}; + +struct xt_entry_target +{ +union { +struct { +u_int16_t target_size; + +/* Used by userspace */ +char name[XT_FUNCTION_MAXNAMELEN -1 ]; + +u_int8_t revision; + } user; +struct { +u_int16_t target_size; + +/* Used inside the kernel */ +struct xt_target *target; + } kernel; + +/* Total length */ +u_int16_t target_size; + } u; + +unsigned char data[0 ]; +}; + +struct xt_standard_target +{ +struct xt_entry_target target; +int verdict; +}; +/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision * kernel supports, if >= revision. */ struct xt_get_revision
include/linux/netfilter_arp/arp_tables.h +2 -29
@@ -65,35 +65,8 @@ struct arpt_arp {u_int16_t invflags; }; -struct arpt_entry_target -{ -union { -struct { -u_int16_t target_size; - -/* Used by userspace */ -char name[ARPT_FUNCTION_MAXNAMELEN -1 ]; -u_int8_t revision; - } user; -struct { -u_int16_t target_size; - -/* Used inside the kernel */ -struct arpt_target *target; - } kernel; - -/* Total length */ -u_int16_t target_size; - } u; - -unsigned char data[0 ]; -}; - -struct arpt_standard_target -{ -struct arpt_entry_target target; -int verdict; -}; +#define arpt_entry_target xt_entry_target +#define arpt_standard_target xt_standard_target/* Values for "flag" field in struct arpt_ip (general arp structure). * No flags defined yet.
include/linux/netfilter_ipv4/ip_tables.h +3 -55
64 lines not on this page · raw message
include/linux/netfilter_ipv6/ip6_tables.h +3 -54
63 lines not on this page · raw message
include/net/tc_act/tc_ipt.h +2 -2
@@ -3,14 +3,14 @@#include <net/act_api.h> -struct ipt_entry_target ; +struct xt_entry_target ;struct tcf_ipt {tca_gen (ipt);u32 hook;char *tname; -struct ipt_entry_target *t; +struct xt_entry_target *t; };#endif
Quoted 1 line · Dmitry Mishin
Forgot required
tc_ipt.hmodification. Corrected.
Missed this mail. Your patch is better, so I backed out my version and took this one instead.
Quoted 2 lines · Dmitry Mishin
This patch moves {ip,ip6,arp}t_entry_{match,target} definitions to
x_tables.h. This move simplifies code and future compatibility fixes.
Applied, thanks. I've fixed up the ipt action which didn't compile anymore.