x_tables, first take
Subsystems (2)
PATCH 1/1 x_tables, first take
Hi!
At least those attending the workshop already know about "x_tables", also-known-as "the project that kept Harald away from the pubbing at night".
The idea is to consolidate the {arp,ip,ip6}_tables code as much as possible. Unfortunately the possibility is quite limited, but it's enough to reduce the need for all those "ipt_limit/ip6t_limit" code duplication.
If we don't merge something like x_tables, the copying will just become worse, since then we'll need to copy state,connmark,connrate,conntrack and all the others to ip6_tables :(
The patch is quite lengthy, so I point out the main features in all the noise:
1) use a shared structure for {ip,arp,ip6}t_{target,match,table} respectively. This new structures are called xt_{target,match,table}
2) separate the mutex and table/match/target list_heads' out of {ip,ip6,arp}_tables and put them into net/netfilter/x_tables.c. This new file maintains NPROTO arrays of them.
3) define all constants/.../ in include/netfilter/x_tables.h, and make include/netfilter_{ipv4,ipv6,arp}/{ip,arp,ip6}_tables.h just a wrapper around that
4) do the same like step '3' for per-extension headers
5) move 'shared' matches/targets from net/{ipv4,ipv6}/netfilter/{ip,ip6}t_FOO to net/netfilter/xt_FOO
I kept a careful eye on binary compatibility, so old userspace programs _should_ transparently work without any trouble. Lots of testing is required, so if somebody wants to give rsync://people.netfilter.org/users/laforge/scm/netfilter-2.6.14.git#x_tables a run in nfsim-testsuite, that would be appreciated quite a lot
Please send any comments/suggestions you might have. I'll further work on it, especially
a) try to remove the need for xt_tables[] and xt_mutex[] to be exported from x_tables.c
b) deal with some xt_owner incompatibilities between
c) have ip_tables provide real "protoff" pointer (e.g. layer 4 protocol header)
d) share tcp,udp,sctp,dccp matches between ip_tables and ip6_tables
e) try to figure out why the Kconfig magic for automatically selecting NETFILTER_XT_FOO based on old IP_NF_FOO values doesn't work as expected :(
Cheers,
Harald
btw: patch is incremental to the {ip6,arp}_tables versioning support that I just sent.
Signature · 5 lines
- Harald Welte <[email protected]> http://netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie
include/linux/netfilter/x_tables.h new file +174 -0
@@ -0,0 +1,174 @@ +#ifndef _X_TABLES_H +#define _X_TABLES_H + +#define XT_FUNCTION_MAXNAMELEN 30 +#define XT_TABLE_MAXNAMELEN 32 + +/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision +* kernel supports, if >= revision. */ +struct xt_get_revision +{ +char name[XT_FUNCTION_MAXNAMELEN -1 ]; + +u_int8_t revision; +}; + +/* CONTINUE verdict for targets */ +#define XT_CONTINUE 0xFFFFFFFF + +/* For standard target */ +#define XT_RETURN (-NF_REPEAT - 1) + +#define XT_ALIGN (s) (((s) + (__alignof__(void *)-1)) & ~(__alignof__(void *)-1)) + +/* Standard return verdict, or do jump. */ +#define XT_STANDARD_TARGET "" +/* Error verdict. */ +#define XT_ERROR_TARGET "ERROR" + +/* +* New IP firewall options for [gs]etsockopt at the RAW IP level. +* Unlike BSD Linux inherits IP options so you don't have to use a raw +* socket for this. Instead we check rights in the calls. */ +#define XT_BASE_CTL 64/* base for firewall socket options */ + +#define XT_SO_SET_REPLACE (XT_BASE_CTL) +#define XT_SO_SET_ADD_COUNTERS (XT_BASE_CTL + 1) +#define XT_SO_SET_MAX XT_SO_SET_ADD_COUNTERS + +#define XT_SO_GET_INFO (XT_BASE_CTL) +#define XT_SO_GET_ENTRIES (XT_BASE_CTL + 1) +#define XT_SO_GET_REVISION_MATCH (XT_BASE_CTL + 2) +#define XT_SO_GET_REVISION_TARGET (XT_BASE_CTL + 3) +#define XT_SO_GET_MAX XT_SO_GET_REVISION_TARGET + +#ifdef __KERNEL__ + +#include <linux/netdevice.h> + +#define ASSERT_READ_LOCK (x) +#define ASSERT_WRITE_LOCK (x) +#include <linux/netfilter_ipv4/listhelp.h> + +struct xt_match +{ +struct list_head list; + +const char name[XT_FUNCTION_MAXNAMELEN -1 ]; + +u_int8_t revision; + +/* Return true or false: return FALSE and set *hotdrop = 1 to +force immediate packet drop. */ +/* Arguments changed since 2.6.9, as this must now handle +non-linear skb, using skb_header_pointer and +skb_ip_make_writable. */ +int (*match)(const struct sk_buff *skb, +const struct net_device *in, +const struct net_device *out, +const void *matchinfo, +int offset, +unsigned int protoff, +int *hotdrop); + +/* Called when user tries to insert an entry of this type. */ +/* Should return true or false. */ +int (*checkentry)(const char *tablename, +const void *ip, +void *matchinfo, +unsigned int matchinfosize, +unsigned int hook_mask); + +/* Called when entry of this type deleted. */ +void (*destroy)(void *matchinfo,unsigned int matchinfosize); + +/* Set this to THIS_MODULE if you are a module, otherwise NULL */ +struct module *me; +}; + +/* Registration hooks for targets. */ +struct xt_target +{ +struct list_head list; + +const char name[XT_FUNCTION_MAXNAMELEN -1 ]; + +u_int8_t revision; + +/* Returns verdict. Argument order changed since 2.6.9, as this +must now handle non-linear skbs, using skb_copy_bits and +skb_ip_make_writable. */ +unsigned int (*target)(struct sk_buff **pskb, +const struct net_device *in, +const struct net_device *out, +unsigned int hooknum, +const void *targinfo, +void *userdata); + +/* Called when user tries to insert an entry of this type: +hook_mask is a bitmask of hooks from which it can be +called. */ +/* Should return true or false. */ +int (*checkentry)(const char *tablename, +const void *entry, +void *targinfo, +unsigned int targinfosize, +unsigned int hook_mask); + +/* Called when entry of this type deleted. */ +void (*destroy)(void *targinfo,unsigned int targinfosize); + +/* Set this to THIS_MODULE if you are a module, otherwise NULL */ +struct module *me; +}; + +/* Furniture shopping... */ +struct xt_table +{ +struct list_head list; + +/* A unique name... */ +char name[XT_TABLE_MAXNAMELEN ]; + +/* What hooks you will enter on */ +unsigned int valid_hooks; + +/* Lock for the curtain */ +rwlock_t lock; + +/* Man behind the curtain... */ +//struct ip6t_table_info *private; +void *private; + +/* Set this to THIS_MODULE if you are a module, otherwise NULL */ +struct module *me; +}; + +extern int xt_register_target (int af,struct xt_target *target); +extern void xt_unregister_target (int af,struct xt_target *target); +extern int xt_register_match (int af,struct xt_match *target); +extern void xt_unregister_match (int af,struct xt_match *target); + +extern int xt_register_table (struct xt_table *table, +//const struct xt_replace *repl); +const void *repl); +extern void xt_unregister_table (struct xt_table *table); + +extern struct xt_match *xt_find_match (int af,const char *name,u8 revision); +extern struct xt_target *xt_find_target (int af,const char *name,u8 revision); +extern struct xt_target *xt_request_find_target (int af,const char *name, +u8 revision); +extern int xt_find_revision (int af,const char *name,u8 revision,int target, +int *err); + +extern struct xt_table *xt_find_table_lock (int af,const char *name); + +extern struct semaphore xt_mutex[NPROTO ]; +extern struct list_head xt_tables[NPROTO ]; + +extern int xt_proto_init (int af); +extern void xt_proto_fini (int af); + +#endif /* __KERNEL__ */ + +#endif /* _X_TABLES_H */
include/linux/netfilter/xt_CLASSIFY.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef _XT_CLASSIFY_H +#define _XT_CLASSIFY_H + +struct xt_classify_target_info { +u_int32_t priority; +}; + +#endif /*_XT_CLASSIFY_H */
include/linux/netfilter/xt_MARK.h new file +21 -0
@@ -0,0 +1,21 @@ +#ifndef _XT_MARK_H_target +#define _XT_MARK_H_target + +/* Version 0 */ +struct xt_mark_target_info { +unsigned long mark; +}; + +/* Version 1 */ +enum { +XT_MARK_SET =0 , +XT_MARK_AND , +XT_MARK_OR , +}; + +struct xt_mark_target_info_v1 { +unsigned long mark; +u_int8_t mode; +}; + +#endif /*_XT_MARK_H_target */
include/linux/netfilter/xt_NFQUEUE.h new file +16 -0
@@ -0,0 +1,16 @@ +/* iptables module for using NFQUEUE mechanism +* +* (C) 2005 Harald Welte <[email protected]> +* +* This software is distributed under GNU GPL v2, 1991 +* +*/ +#ifndef _XT_NFQ_TARGET_H +#define _XT_NFQ_TARGET_H + +/* target info */ +struct xt_NFQ_info { +u_int16_t queuenum; +}; + +#endif /* _XT_NFQ_TARGET_H */
include/linux/netfilter/xt_comment.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef _XT_COMMENT_H +#define _XT_COMMENT_H + +#define XT_MAX_COMMENT_LEN 256 + +struct xt_comment_info { +unsigned char comment[XT_MAX_COMMENT_LEN ]; +}; + +#endif /* XT_COMMENT_H */
include/linux/netfilter/xt_length.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef _XT_LENGTH_H +#define _XT_LENGTH_H + +struct xt_length_info { +u_int16_t min, max; +u_int8_t invert; +}; + +#endif /*_XT_LENGTH_H*/
include/linux/netfilter/xt_limit.h new file +21 -0
@@ -0,0 +1,21 @@ +#ifndef _XT_RATE_H +#define _XT_RATE_H + +/* timings are in milliseconds. */ +#define XT_LIMIT_SCALE 10000 + +/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 +seconds, or one every 59 hours. */ +struct xt_rateinfo { +u_int32_t avg;/* Average secs between packets * scale */ +u_int32_t burst;/* Period multiplier for upper limit. */ + +/* Used internally by the kernel */ +unsigned long prev; +u_int32_t credit; +u_int32_t credit_cap, cost; + +/* Ugly, ugly fucker. */ +struct xt_rateinfo *master; +}; +#endif /*_XT_RATE_H*/
include/linux/netfilter/xt_mac.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef _XT_MAC_H +#define _XT_MAC_H + +struct xt_mac_info { +unsigned char srcaddr[ETH_ALEN ]; +int invert; +}; +#endif /*_XT_MAC_H*/
include/linux/netfilter/xt_mark.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef _XT_MARK_H +#define _XT_MARK_H + +struct xt_mark_info { +unsigned long mark, mask; +u_int8_t invert; +}; + +#endif /*_XT_MARK_H*/
include/linux/netfilter/xt_owner.h new file +20 -0
@@ -0,0 +1,20 @@ +#ifndef _XT_OWNER_H +#define _XT_OWNER_H + +/* match and invert flags */ +#define XT_OWNER_UID 0x01 +#define XT_OWNER_GID 0x02 +#define XT_OWNER_PID 0x04 +#define XT_OWNER_SID 0x08 +#define XT_OWNER_COMM 0x10 + +struct xt_owner_info { +uid_t uid; +gid_t gid; +pid_t pid; +pid_t sid; +char comm[16 ]; +u_int8_t match, invert;/* flags */ +}; + +#endif /*_XT_OWNER_H*/
include/linux/netfilter/xt_physdev.h new file +24 -0
@@ -0,0 +1,24 @@ +#ifndef _XT_PHYSDEV_H +#define _XT_PHYSDEV_H + +#ifdef __KERNEL__ +#include <linux/if.h> +#endif + +#define XT_PHYSDEV_OP_IN 0x01 +#define XT_PHYSDEV_OP_OUT 0x02 +#define XT_PHYSDEV_OP_BRIDGED 0x04 +#define XT_PHYSDEV_OP_ISIN 0x08 +#define XT_PHYSDEV_OP_ISOUT 0x10 +#define XT_PHYSDEV_OP_MASK (0x20 - 1) + +struct xt_physdev_info { +char physindev[IFNAMSIZ ]; +char in_mask[IFNAMSIZ ]; +char physoutdev[IFNAMSIZ ]; +char out_mask[IFNAMSIZ ]; +u_int8_t invert; +u_int8_t bitmask; +}; + +#endif /*_XT_PHYSDEV_H*/
include/linux/netfilter/xt_pkttype.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef _XT_PKTTYPE_H +#define _XT_PKTTYPE_H + +struct xt_pkttype_info { +int pkttype; +int invert; +}; +#endif /*_XT_PKTTYPE_H*/
include/linux/netfilter/xt_realm.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef _XT_REALM_H +#define _XT_REALM_H + +struct xt_realm_info { +u_int32_t id; +u_int32_t mask; +u_int8_t invert; +}; + +#endif /* _XT_REALM_H */
include/linux/netfilter/xt_state.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef _XT_STATE_H +#define _XT_STATE_H + +#define XT_STATE_BIT (ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) +#define XT_STATE_INVALID (1 << 0) + +#define XT_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 1)) + +struct xt_state_info +{ +unsigned int statemask; +}; +#endif /*_XT_STATE_H*/
include/linux/netfilter/xt_string.h new file +18 -0
@@ -0,0 +1,18 @@ +#ifndef _XT_STRING_H +#define _XT_STRING_H + +#define XT_STRING_MAX_PATTERN_SIZE 128 +#define XT_STRING_MAX_ALGO_NAME_SIZE 16 + +struct xt_string_info +{ +u_int16_t from_offset; +u_int16_t to_offset; +char algo[XT_STRING_MAX_ALGO_NAME_SIZE ]; +char pattern[XT_STRING_MAX_PATTERN_SIZE ]; +u_int8_t patlen; +u_int8_t invert; +struct ts_config __attribute__((aligned (8 ))) *config; +}; + +#endif /*_XT_STRING_H*/
include/linux/netfilter_arp/arp_tables.h +23 -82
136 lines not on this page · raw message
include/linux/netfilter_ipv4/ip_tables.h +32 -126
200 lines not on this page · raw message
include/linux/netfilter_ipv4/ipt_CLASSIFY.h +1 -3
@@ -1,8 +1,6 @@#ifndef _IPT_CLASSIFY_H#define _IPT_CLASSIFY_H -struct ipt_classify_target_info { -u_int32_t priority; -}; +#define ipt_classify_target_info xt_classify_target_info#endif /*_IPT_CLASSIFY_H */
include/linux/netfilter_ipv4/ipt_MARK.h +11 -13
@@ -1,20 +1,18 @@#ifndef _IPT_MARK_H_target#define _IPT_MARK_H_target +/* Backwards compatibility for old userspace */ + +#include <linux/netfilter/xt_MARK.h> +/* Version 0 */ -struct ipt_mark_target_info { -unsigned long mark; -}; +#define ipt_mark_target_info xt_mark_target_info/* Version 1 */ -enum { -IPT_MARK_SET =0 , -IPT_MARK_AND , -IPT_MARK_OR -}; - -struct ipt_mark_target_info_v1 { -unsigned long mark; -u_int8_t mode; -}; +#define IPT_MARK_SET XT_MARK_SET +#define IPT_MARK_AND XT_MARK_AND +#define IPT_MARK_OR XT_MARK_OR + +#define ipt_mark_target_info_v1 xt_mark_target_info_v1 +#endif /*_IPT_MARK_H_target*/
include/linux/netfilter_ipv4/ipt_NFQUEUE.h +4 -4
@@ -8,9 +8,9 @@#ifndef _IPT_NFQ_TARGET_H#define _IPT_NFQ_TARGET_H -/* target info */ -struct ipt_NFQ_info { -u_int16_t queuenum; -}; +/* Backwards compatibility for old userspace */ +#include <linux/netfilter/xt_NFQUEUE.h> + +#define ipt_NFQ_info xt_NFQ_info#endif /* _IPT_DSCP_TARGET_H */
include/linux/netfilter_ipv4/ipt_comment.h +4 -4
@@ -1,10 +1,10 @@#ifndef _IPT_COMMENT_H#define _IPT_COMMENT_H -#define IPT_MAX_COMMENT_LEN 256 +#include <linux/netfilter/xt_comment.h> -struct ipt_comment_info { -unsigned char comment[IPT_MAX_COMMENT_LEN ]; -}; +#define IPT_MAX_COMMENT_LEN XT_MAX_COMMENT_LEN + +#define ipt_comment_info xt_comment_info#endif /* _IPT_COMMENT_H */
include/linux/netfilter_ipv4/ipt_length.h +2 -4
@@ -1,9 +1,7 @@#ifndef _IPT_LENGTH_H#define _IPT_LENGTH_H -struct ipt_length_info { -u_int16_t min, max; -u_int8_t invert; -}; +#include <linux/netfilter/xt_length.h> +#define ipt_length_info xt_length_info#endif /*_IPT_LENGTH_H*/
include/linux/netfilter_ipv4/ipt_limit.h +3 -16
@@ -1,21 +1,8 @@#ifndef _IPT_RATE_H#define _IPT_RATE_H -/* timings are in milliseconds. */ -#define IPT_LIMIT_SCALE 10000 +#include <linux/netfilter/xt_limit.h> +#define IPT_LIMIT_SCALE XT_LIMIT_SCALE +#define ipt_rateinfo xt_rateinfo -/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 -seconds, or one every 59 hours. */ -struct ipt_rateinfo { -u_int32_t avg;/* Average secs between packets * scale */ -u_int32_t burst;/* Period multiplier for upper limit. */ - -/* Used internally by the kernel */ -unsigned long prev; -u_int32_t credit; -u_int32_t credit_cap, cost; - -/* Ugly, ugly fucker. */ -struct ipt_rateinfo *master; -};#endif /*_IPT_RATE_H*/
include/linux/netfilter_ipv4/ipt_mac.h +3 -4
@@ -1,8 +1,7 @@#ifndef _IPT_MAC_H#define _IPT_MAC_H -struct ipt_mac_info { -unsigned char srcaddr[ETH_ALEN ]; -int invert; -}; +#include <linux/netfilter/xt_mac.h> +#define ipt_mac_info xt_mac_info +#endif /*_IPT_MAC_H*/
include/linux/netfilter_ipv4/ipt_mark.h +4 -4
@@ -1,9 +1,9 @@#ifndef _IPT_MARK_H#define _IPT_MARK_H -struct ipt_mark_info { -unsigned long mark, mask; -u_int8_t invert; -}; +/* Backwards compatibility for old userspace */ +#include <linux/netfilter/xt_mark.h> + +#define ipt_mark_info xt_mark_info#endif /*_IPT_MARK_H*/
include/linux/netfilter_ipv4/ipt_owner.h +9 -14
@@ -1,20 +1,15 @@#ifndef _IPT_OWNER_H#define _IPT_OWNER_H -/* match and invert flags */ -#define IPT_OWNER_UID 0x01 -#define IPT_OWNER_GID 0x02 -#define IPT_OWNER_PID 0x04 -#define IPT_OWNER_SID 0x08 -#define IPT_OWNER_COMM 0x10 +/* Backwards compatibility for old userspace */ +#include <linux/netfilter/xt_owner.h> -struct ipt_owner_info { -uid_t uid; -gid_t gid; -pid_t pid; -pid_t sid; -char comm[16 ]; -u_int8_t match, invert;/* flags */ -}; +#define IPT_OWNER_UID XT_OWNER_UID +#define IPT_OWNER_GID XT_OWNER_GID +#define IPT_OWNER_PID XT_OWNER_PID +#define IPT_OWNER_SID XT_OWNER_SID +#define IPT_OWNER_COMM XT_OWNER_COMM + +#define ipt_owner_info xt_owner_info#endif /*_IPT_OWNER_H*/
include/linux/netfilter_ipv4/ipt_physdev.h +10 -17
@@ -1,24 +1,17 @@#ifndef _IPT_PHYSDEV_H#define _IPT_PHYSDEV_H -#ifdef __KERNEL__ -#include <linux/if.h> -#endif +/* Backwards compatibility for old userspace */ -#define IPT_PHYSDEV_OP_IN 0x01 -#define IPT_PHYSDEV_OP_OUT 0x02 -#define IPT_PHYSDEV_OP_BRIDGED 0x04 -#define IPT_PHYSDEV_OP_ISIN 0x08 -#define IPT_PHYSDEV_OP_ISOUT 0x10 -#define IPT_PHYSDEV_OP_MASK (0x20 - 1) +#include <linux/netfilter/xt_physdev.h> -struct ipt_physdev_info { -char physindev[IFNAMSIZ ]; -char in_mask[IFNAMSIZ ]; -char physoutdev[IFNAMSIZ ]; -char out_mask[IFNAMSIZ ]; -u_int8_t invert; -u_int8_t bitmask; -}; +#define IPT_PHYSDEV_OP_IN XT_PHYSDEV_OP_IN +#define IPT_PHYSDEV_OP_OUT XT_PHYSDEV_OP_OUT +#define IPT_PHYSDEV_OP_BRIDGED XT_PHYSDEV_OP_BRIDGED +#define IPT_PHYSDEV_OP_ISIN XT_PHYSDEV_OP_ISIN +#define IPT_PHYSDEV_OP_ISOUT XT_PHYSDEV_OP_ISOUT +#define IPT_PHYSDEV_OP_MASK XT_PHYSDEV_OP_MASK + +#define ipt_physdev_info xt_physdev_info#endif /*_IPT_PHYSDEV_H*/
include/linux/netfilter_ipv4/ipt_pkttype.h +3 -4
@@ -1,8 +1,7 @@#ifndef _IPT_PKTTYPE_H#define _IPT_PKTTYPE_H -struct ipt_pkttype_info { -int pkttype; -int invert; -}; +#include <linux/netfilter/xt_pkttype.h> +#define ipt_pkttype_info xt_pkttype_info +#endif /*_IPT_PKTTYPE_H*/
include/linux/netfilter_ipv4/ipt_realm.h +2 -5
@@ -1,10 +1,7 @@#ifndef _IPT_REALM_H#define _IPT_REALM_H -struct ipt_realm_info { -u_int32_t id; -u_int32_t mask; -u_int8_t invert; -}; +#include <linux/netfilter/xt_realm.h> +#define ipt_realm_info xt_realm_info#endif /* _IPT_REALM_H */
include/linux/netfilter_ipv4/ipt_state.h +9 -7
@@ -1,13 +1,15 @@#ifndef _IPT_STATE_H#define _IPT_STATE_H -#define IPT_STATE_BIT (ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) -#define IPT_STATE_INVALID (1 << 0) +/* Backwards compatibility for old userspace */ -#define IPT_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 1)) +#include <linux/netfilter/xt_state.h> + +#define IPT_STATE_BIT XT_STATE_BIT +#define IPT_STATE_INVALID XT_STATE_INVALID + +#define IPT_STATE_UNTRACKED XT_STATE_UNTRACKED + +#define ipt_state_info xt_state_info -struct ipt_state_info -{ -unsigned int statemask; -};#endif /*_IPT_STATE_H*/
include/linux/netfilter_ipv4/ipt_string.h +4 -12
@@ -1,18 +1,10 @@#ifndef _IPT_STRING_H#define _IPT_STRING_H -#define IPT_STRING_MAX_PATTERN_SIZE 128 -#define IPT_STRING_MAX_ALGO_NAME_SIZE 16 +#include <linux/netfilter/xt_string.h> -struct ipt_string_info -{ -u_int16_t from_offset; -u_int16_t to_offset; -char algo[IPT_STRING_MAX_ALGO_NAME_SIZE ]; -char pattern[IPT_STRING_MAX_PATTERN_SIZE ]; -u_int8_t patlen; -u_int8_t invert; -struct ts_config __attribute__((aligned (8 ))) *config; -}; +#define IPT_STRING_MAX_PATTERN_SIZE XT_STRING_MAX_PATTERN_SIZE +#define IPT_STRING_MAX_ALGO_NAME_SIZE XT_STRING_MAX_ALGO_NAME_SIZE +#define ipt_string_info xt_string_info#endif /*_IPT_STRING_H*/
include/linux/netfilter_ipv6/ip6_tables.h +25 -120
175 lines not on this page · raw message
include/linux/netfilter_ipv6/ip6t_MARK.h +5 -4
@@ -1,8 +1,9 @@#ifndef _IP6T_MARK_H_target#define _IP6T_MARK_H_target -struct ip6t_mark_target_info { -unsigned long mark; -}; +/* Backwards compatibility for old userspace */ +#include <linux/netfilter/xt_MARK.h> -#endif /*_IPT_MARK_H_target*/ +#define ip6t_mark_target_info xt_mark_target_info + +#endif /*_IP6T_MARK_H_target*/
include/linux/netfilter_ipv6/ip6t_length.h +2 -4
@@ -1,10 +1,8 @@#ifndef _IP6T_LENGTH_H#define _IP6T_LENGTH_H -struct ip6t_length_info { -u_int16_t min, max; -u_int8_t invert; -}; +#include <linux/netfilter/xt_length.h> +#define ip6t_length_info xt_length_info#endif /*_IP6T_LENGTH_H*/
include/linux/netfilter_ipv6/ip6t_limit.h +4 -17
@@ -1,21 +1,8 @@#ifndef _IP6T_RATE_H#define _IP6T_RATE_H -/* timings are in milliseconds. */ -#define IP6T_LIMIT_SCALE 10000 +#include <linux/netfilter/xt_limit.h> +#define IP6T_LIMIT_SCALE XT_LIMIT_SCALE +#define ip6t_rateinfo xt_rateinfo -/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 -seconds, or one every 59 hours. */ -struct ip6t_rateinfo { -u_int32_t avg;/* Average secs between packets * scale */ -u_int32_t burst;/* Period multiplier for upper limit. */ - -/* Used internally by the kernel */ -unsigned long prev; -u_int32_t credit; -u_int32_t credit_cap, cost; - -/* Ugly, ugly fucker. */ -struct ip6t_rateinfo *master; -}; -#endif /*_IPT_RATE_H*/ +#endif /*_IP6T_RATE_H*/
include/linux/netfilter_ipv6/ip6t_mac.h +4 -5
@@ -1,8 +1,7 @@#ifndef _IP6T_MAC_H#define _IP6T_MAC_H -struct ip6t_mac_info { -unsigned char srcaddr[ETH_ALEN ]; -int invert; -}; -#endif /*_IPT_MAC_H*/ +#include <linux/netfilter/xt_mac.h> +#define ip6t_mac_info xt_mac_info + +#endif /*_IP6T_MAC_H*/
include/linux/netfilter_ipv6/ip6t_mark.h +4 -4
@@ -1,9 +1,9 @@#ifndef _IP6T_MARK_H#define _IP6T_MARK_H -struct ip6t_mark_info { -unsigned long mark, mask; -u_int8_t invert; -}; +/* Backwards compatibility for old userspace */ +#include <linux/netfilter/xt_mark.h> + +#define ip6t_mark_info xt_mark_info#endif /*_IPT_MARK_H*/
include/linux/netfilter_ipv6/ip6t_owner.h +7 -5
@@ -1,11 +1,13 @@ #ifndef _IP6T_OWNER_H #define _IP6T_OWNER_H -/* match and invert flags */ -#define IP6T_OWNER_UID 0x01 -#define IP6T_OWNER_GID 0x02 -#define IP6T_OWNER_PID 0x04 -#define IP6T_OWNER_SID 0x08 +/* Backwards compatibility for old userspace */ +#include <linux/netfilter/xt_owner.h> + +#define IP6T_OWNER_UID XT_OWNER_UID +#define IP6T_OWNER_GID XT_OWNER_GID +#define IP6T_OWNER_PID XT_OWNER_PID +#define IP6T_OWNER_SID XT_OWNER_SID struct ip6t_owner_info { uid_t uid;
include/linux/netfilter_ipv6/ip6t_physdev.h +10 -17
@@ -1,24 +1,17 @@#ifndef _IP6T_PHYSDEV_H#define _IP6T_PHYSDEV_H -#ifdef __KERNEL__ -#include <linux/if.h> -#endif +/* Backwards compatibility for old userspace */ -#define IP6T_PHYSDEV_OP_IN 0x01 -#define IP6T_PHYSDEV_OP_OUT 0x02 -#define IP6T_PHYSDEV_OP_BRIDGED 0x04 -#define IP6T_PHYSDEV_OP_ISIN 0x08 -#define IP6T_PHYSDEV_OP_ISOUT 0x10 -#define IP6T_PHYSDEV_OP_MASK (0x20 - 1) +#include <linux/netfilter/xt_physdev.h> -struct ip6t_physdev_info { -char physindev[IFNAMSIZ ]; -char in_mask[IFNAMSIZ ]; -char physoutdev[IFNAMSIZ ]; -char out_mask[IFNAMSIZ ]; -u_int8_t invert; -u_int8_t bitmask; -}; +#define IP6T_PHYSDEV_OP_IN XT_PHYSDEV_OP_IN +#define IP6T_PHYSDEV_OP_OUT XT_PHYSDEV_OP_OUT +#define IP6T_PHYSDEV_OP_BRIDGED XT_PHYSDEV_OP_BRIDGED +#define IP6T_PHYSDEV_OP_ISIN XT_PHYSDEV_OP_ISIN +#define IP6T_PHYSDEV_OP_ISOUT XT_PHYSDEV_OP_ISOUT +#define IP6T_PHYSDEV_OP_MASK XT_PHYSDEV_OP_MASK + +#define ip6t_physdev_info xt_physdev_info#endif /*_IP6T_PHYSDEV_H*/
net/ipv4/netfilter/Kconfig +53 -102
247 lines not on this page · raw message
net/ipv4/netfilter/Makefile +0 -12
@@ -46,14 +46,10 @@ obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o # matches obj-$(CONFIG_IP_NF_MATCH_HELPER) += ipt_helper.o -obj-$(CONFIG_IP_NF_MATCH_LIMIT) += ipt_limit.o obj-$(CONFIG_IP_NF_MATCH_HASHLIMIT) += ipt_hashlimit.o obj-$(CONFIG_IP_NF_MATCH_SCTP) += ipt_sctp.o obj-$(CONFIG_IP_NF_MATCH_DCCP) += ipt_dccp.o -obj-$(CONFIG_IP_NF_MATCH_MARK) += ipt_mark.o -obj-$(CONFIG_IP_NF_MATCH_MAC) += ipt_mac.o obj-$(CONFIG_IP_NF_MATCH_IPRANGE) += ipt_iprange.o -obj-$(CONFIG_IP_NF_MATCH_PKTTYPE) += ipt_pkttype.o obj-$(CONFIG_IP_NF_MATCH_MULTIPORT) += ipt_multiport.o obj-$(CONFIG_IP_NF_MATCH_OWNER) += ipt_owner.o obj-$(CONFIG_IP_NF_MATCH_TOS) += ipt_tos.o
@@ -61,25 +57,18 @@ obj-$(CONFIG_IP_NF_MATCH_RECENT) += ipt_ obj-$(CONFIG_IP_NF_MATCH_ECN) += ipt_ecn.o obj-$(CONFIG_IP_NF_MATCH_DSCP) += ipt_dscp.o obj-$(CONFIG_IP_NF_MATCH_AH_ESP) += ipt_ah.o ipt_esp.o -obj-$(CONFIG_IP_NF_MATCH_LENGTH) += ipt_length.o obj-$(CONFIG_IP_NF_MATCH_TTL) += ipt_ttl.o -obj-$(CONFIG_IP_NF_MATCH_STATE) += ipt_state.o obj-$(CONFIG_IP_NF_MATCH_CONNMARK) += ipt_connmark.o obj-$(CONFIG_IP_NF_MATCH_CONNTRACK) += ipt_conntrack.o obj-$(CONFIG_IP_NF_MATCH_CONNBYTES) += ipt_connbytes.o obj-$(CONFIG_IP_NF_MATCH_TCPMSS) += ipt_tcpmss.o -obj-$(CONFIG_IP_NF_MATCH_REALM) += ipt_realm.o obj-$(CONFIG_IP_NF_MATCH_ADDRTYPE) += ipt_addrtype.o -obj-$(CONFIG_IP_NF_MATCH_PHYSDEV) += ipt_physdev.o -obj-$(CONFIG_IP_NF_MATCH_COMMENT) += ipt_comment.o -obj-$(CONFIG_IP_NF_MATCH_STRING) += ipt_string.o # targets obj-$(CONFIG_IP_NF_TARGET_REJECT) += ipt_REJECT.o obj-$(CONFIG_IP_NF_TARGET_TOS) += ipt_TOS.o obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o obj-$(CONFIG_IP_NF_TARGET_DSCP) += ipt_DSCP.o -obj-$(CONFIG_IP_NF_TARGET_MARK) += ipt_MARK.o obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o obj-$(CONFIG_IP_NF_TARGET_NETMAP) += ipt_NETMAP.o
@@ -93,7 +82,6 @@ obj-$(CONFIG_IP_NF_TARGET_TCPMSS) += ipt obj-$(CONFIG_IP_NF_TARGET_NOTRACK) += ipt_NOTRACK.o obj-$(CONFIG_IP_NF_TARGET_CLUSTERIP) += ipt_CLUSTERIP.o obj-$(CONFIG_IP_NF_TARGET_TTL) += ipt_TTL.o -obj-$(CONFIG_IP_NF_TARGET_NFQUEUE) += ipt_NFQUEUE.o # generic ARP tables obj-$(CONFIG_IP_NF_ARPTABLES) += arp_tables.o
net/ipv4/netfilter/arp_tables.c +72 -246
581 lines not on this page · raw message
net/ipv4/netfilter/arpt_mangle.c +3 -2
@@ -8,8 +8,9 @@ MODULE_AUTHOR("Bart De Schuymer <bdschuyMODULE_DESCRIPTION ("arptables arp payload mangle target" );static unsigned int -target (struct sk_buff **pskb,unsigned int hooknum,const struct net_device *in, -const struct net_device *out,const void *targinfo,void *userinfo) +target (struct sk_buff **pskb,const struct net_device *in, +const struct net_device *out,unsigned int hooknum,const void *targinfo, +void *userinfo) {const struct arpt_mangle *mangle = targinfo;struct arphdr *arp;
net/ipv4/netfilter/ip_nat_rule.c +2 -2
@@ -168,7 +168,7 @@ static unsigned int ipt_dnat_target(stru }static int ipt_snat_checkentry (const char *tablename, -const struct ipt_entry *e, +const void *entry,void *targinfo,unsigned int targinfosize,unsigned int hook_mask)
@@ -201,7 +201,7 @@ static int ipt_snat_checkentry(const cha }static int ipt_dnat_checkentry (const char *tablename, -const struct ipt_entry *e, +const void *entry,void *targinfo,unsigned int targinfosize,unsigned int hook_mask)
net/ipv4/netfilter/ip_tables.c +97 -373
798 lines not on this page · raw message
net/ipv4/netfilter/ipt_CLASSIFY.c deleted +0 -90
38 lines not on this page · raw message
net/ipv4/netfilter/ipt_comment.c deleted +0 -59
59 lines not on this page · raw message
net/ipv4/netfilter/ipt_dccp.c +2 -1
Lines of this file are not shown. View the raw message.
net/ipv4/netfilter/ipt_hashlimit.c +1 -1
Lines of this file are not shown. View the raw message.
net/ipv4/netfilter/ipt_helper.c +1 -1
Lines of this file are not shown. View the raw message.
net/ipv4/netfilter/ipt_iprange.c +1 -1
Lines of this file are not shown. View the raw message.
net/ipv4/netfilter/ipt_length.c deleted +0 -64
64 lines not on this page · raw message
net/ipv4/netfilter/ipt_limit.c +1 -1
Lines of this file are not shown. View the raw message.
net/ipv4/netfilter/ipt_mac.c deleted +0 -79
79 lines not on this page · raw message
net/ipv4/netfilter/ipt_pkttype.c deleted +0 -70
70 lines not on this page · raw message
net/ipv4/netfilter/ipt_realm.c deleted +0 -76
76 lines not on this page · raw message
net/ipv4/netfilter/ipt_sctp.c +2 -1
Lines of this file are not shown. View the raw message.
net/ipv4/netfilter/ipt_state.c deleted +0 -74
74 lines not on this page · raw message
net/ipv4/netfilter/ipt_string.c deleted +0 -91
91 lines not on this page · raw message
net/ipv6/netfilter/Kconfig +29 -50
79 lines not on this page · raw message
net/ipv6/netfilter/Makefile +0 -6
Lines of this file are not shown. View the raw message.
net/ipv6/netfilter/ip6_tables.c +97 -384
481 lines not on this page · raw message
net/ipv6/netfilter/ip6t_HL.c +1 -1
Lines of this file are not shown. View the raw message.
net/ipv6/netfilter/ip6t_LOG.c +1 -1
Lines of this file are not shown. View the raw message.
net/ipv6/netfilter/ip6t_REJECT.c +2 -1
Lines of this file are not shown. View the raw message.
net/ipv6/netfilter/ip6t_ah.c +1 -1
Lines of this file are not shown. View the raw message.
net/ipv6/netfilter/ip6t_dst.c +1 -1
Lines of this file are not shown. View the raw message.
net/ipv6/netfilter/ip6t_eui64.c +1 -1
Lines of this file are not shown. View the raw message.
net/ipv6/netfilter/ip6t_hbh.c +1 -1
Lines of this file are not shown. View the raw message.
net/ipv6/netfilter/ip6t_hl.c +1 -1
Lines of this file are not shown. View the raw message.
net/ipv6/netfilter/ip6t_ipv6header.c +1 -1
Lines of this file are not shown. View the raw message.
net/ipv6/netfilter/ip6t_length.c deleted +0 -66
66 lines not on this page · raw message
net/ipv6/netfilter/ip6t_limit.c deleted +0 -147
147 lines not on this page · raw message
net/ipv6/netfilter/ip6t_mac.c deleted +0 -80
80 lines not on this page · raw message
net/ipv6/netfilter/ip6t_multiport.c +2 -1
Lines of this file are not shown. View the raw message.
net/ipv6/netfilter/ip6t_owner.c +1 -1
Lines of this file are not shown. View the raw message.
net/ipv6/netfilter/ip6t_rt.c +1 -1
Lines of this file are not shown. View the raw message.
net/netfilter/Kconfig +148 -0
148 lines not on this page · raw message
net/netfilter/Makefile +15 -0
Lines of this file are not shown. View the raw message.
net/netfilter/x_tables.c new file +458 -0
458 lines not on this page · raw message
net/netfilter/xt_MARK.c new file +191 -0
191 lines not on this page · raw message
net/netfilter/xt_NFQUEUE.c new file +107 -0
107 lines not on this page · raw message
net/netfilter/xt_comment.c new file +73 -0
73 lines not on this page · raw message
net/netfilter/xt_length.c new file +98 -0
98 lines not on this page · raw message
net/netfilter/xt_limit.c new file +175 -0
175 lines not on this page · raw message
net/netfilter/xt_mac.c new file +99 -0
99 lines not on this page · raw message
net/netfilter/xt_mark.c new file +91 -0
91 lines not on this page · raw message
net/netfilter/xt_owner.c new file +115 -0
115 lines not on this page · raw message
net/netfilter/xt_physdev.c new file +155 -0
155 lines not on this page · raw message
net/netfilter/xt_pkttype.c new file +82 -0
82 lines not on this page · raw message
net/netfilter/xt_realm.c new file +78 -0
78 lines not on this page · raw message
net/netfilter/xt_state.c new file +96 -0
96 lines not on this page · raw message
net/netfilter/xt_string.c new file +111 -0
111 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.