Commit 1e30a014 authored by Dmitry Mishin's avatar Dmitry Mishin Committed by David S. Miller

[NETFILTER]: 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.
Signed-off-by: default avatarDmitry Mishin <dim@openvz.org>
Acked-off-by: default avatarKirill Korotaev <dev@openvz.org>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 81fbfd69
...@@ -4,6 +4,62 @@ ...@@ -4,6 +4,62 @@
#define XT_FUNCTION_MAXNAMELEN 30 #define XT_FUNCTION_MAXNAMELEN 30
#define XT_TABLE_MAXNAMELEN 32 #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 /* The argument to IPT_SO_GET_REVISION_*. Returns highest revision
* kernel supports, if >= revision. */ * kernel supports, if >= revision. */
struct xt_get_revision struct xt_get_revision
......
...@@ -65,35 +65,8 @@ struct arpt_arp { ...@@ -65,35 +65,8 @@ struct arpt_arp {
u_int16_t invflags; u_int16_t invflags;
}; };
struct arpt_entry_target #define arpt_entry_target xt_entry_target
{ #define arpt_standard_target xt_standard_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;
};
/* Values for "flag" field in struct arpt_ip (general arp structure). /* Values for "flag" field in struct arpt_ip (general arp structure).
* No flags defined yet. * No flags defined yet.
......
...@@ -52,61 +52,9 @@ struct ipt_ip { ...@@ -52,61 +52,9 @@ struct ipt_ip {
u_int8_t invflags; u_int8_t invflags;
}; };
struct ipt_entry_match #define ipt_entry_match xt_entry_match
{ #define ipt_entry_target xt_entry_target
union { #define ipt_standard_target xt_standard_target
struct {
u_int16_t match_size;
/* Used by userspace */
char name[IPT_FUNCTION_MAXNAMELEN-1];
u_int8_t revision;
} user;
struct {
u_int16_t match_size;
/* Used inside the kernel */
struct ipt_match *match;
} kernel;
/* Total length */
u_int16_t match_size;
} u;
unsigned char data[0];
};
struct ipt_entry_target
{
union {
struct {
u_int16_t target_size;
/* Used by userspace */
char name[IPT_FUNCTION_MAXNAMELEN-1];
u_int8_t revision;
} user;
struct {
u_int16_t target_size;
/* Used inside the kernel */
struct ipt_target *target;
} kernel;
/* Total length */
u_int16_t target_size;
} u;
unsigned char data[0];
};
struct ipt_standard_target
{
struct ipt_entry_target target;
int verdict;
};
#define ipt_counters xt_counters #define ipt_counters xt_counters
......
...@@ -56,60 +56,9 @@ struct ip6t_ip6 { ...@@ -56,60 +56,9 @@ struct ip6t_ip6 {
u_int8_t invflags; u_int8_t invflags;
}; };
/* FIXME: If alignment in kernel different from userspace? --RR */ #define ip6t_entry_match xt_entry_match
struct ip6t_entry_match #define ip6t_entry_target xt_entry_target
{ #define ip6t_standard_target xt_standard_target
union {
struct {
u_int16_t match_size;
/* Used by userspace */
char name[IP6T_FUNCTION_MAXNAMELEN-1];
u_int8_t revision;
} user;
struct {
u_int16_t match_size;
/* Used inside the kernel */
struct ip6t_match *match;
} kernel;
/* Total length */
u_int16_t match_size;
} u;
unsigned char data[0];
};
struct ip6t_entry_target
{
union {
struct {
u_int16_t target_size;
/* Used by userspace */
char name[IP6T_FUNCTION_MAXNAMELEN-1];
u_int8_t revision;
} user;
struct {
u_int16_t target_size;
/* Used inside the kernel */
struct ip6t_target *target;
} kernel;
/* Total length */
u_int16_t target_size;
} u;
unsigned char data[0];
};
struct ip6t_standard_target
{
struct ip6t_entry_target target;
int verdict;
};
#define ip6t_counters xt_counters #define ip6t_counters xt_counters
......
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
#include <net/act_api.h> #include <net/act_api.h>
struct ipt_entry_target; struct xt_entry_target;
struct tcf_ipt struct tcf_ipt
{ {
tca_gen(ipt); tca_gen(ipt);
u32 hook; u32 hook;
char *tname; char *tname;
struct ipt_entry_target *t; struct xt_entry_target *t;
}; };
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment