aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netfilter_bridge
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/netfilter_bridge')
-rw-r--r--include/linux/netfilter_bridge/Kbuild18
-rw-r--r--include/linux/netfilter_bridge/ebt_among.h64
-rw-r--r--include/linux/netfilter_bridge/ebt_arp.h36
-rw-r--r--include/linux/netfilter_bridge/ebt_arpreply.h10
-rw-r--r--include/linux/netfilter_bridge/ebt_ip.h44
-rw-r--r--include/linux/netfilter_bridge/ebt_ip6.h50
-rw-r--r--include/linux/netfilter_bridge/ebt_limit.h24
-rw-r--r--include/linux/netfilter_bridge/ebt_log.h20
-rw-r--r--include/linux/netfilter_bridge/ebt_mark_m.h16
-rw-r--r--include/linux/netfilter_bridge/ebt_mark_t.h23
-rw-r--r--include/linux/netfilter_bridge/ebt_nat.h13
-rw-r--r--include/linux/netfilter_bridge/ebt_nflog.h23
-rw-r--r--include/linux/netfilter_bridge/ebt_pkttype.h12
-rw-r--r--include/linux/netfilter_bridge/ebt_redirect.h10
-rw-r--r--include/linux/netfilter_bridge/ebt_stp.h46
-rw-r--r--include/linux/netfilter_bridge/ebt_ulog.h38
-rw-r--r--include/linux/netfilter_bridge/ebt_vlan.h22
17 files changed, 469 insertions, 0 deletions
diff --git a/include/linux/netfilter_bridge/Kbuild b/include/linux/netfilter_bridge/Kbuild
new file mode 100644
index 00000000000..e48f1a3f5a4
--- /dev/null
+++ b/include/linux/netfilter_bridge/Kbuild
@@ -0,0 +1,18 @@
1header-y += ebt_802_3.h
2header-y += ebt_among.h
3header-y += ebt_arp.h
4header-y += ebt_arpreply.h
5header-y += ebt_ip.h
6header-y += ebt_ip6.h
7header-y += ebt_limit.h
8header-y += ebt_log.h
9header-y += ebt_mark_m.h
10header-y += ebt_mark_t.h
11header-y += ebt_nat.h
12header-y += ebt_nflog.h
13header-y += ebt_pkttype.h
14header-y += ebt_redirect.h
15header-y += ebt_stp.h
16header-y += ebt_ulog.h
17header-y += ebt_vlan.h
18header-y += ebtables.h
diff --git a/include/linux/netfilter_bridge/ebt_among.h b/include/linux/netfilter_bridge/ebt_among.h
new file mode 100644
index 00000000000..bd4e3ad0b70
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_among.h
@@ -0,0 +1,64 @@
1#ifndef __LINUX_BRIDGE_EBT_AMONG_H
2#define __LINUX_BRIDGE_EBT_AMONG_H
3
4#include <linux/types.h>
5
6#define EBT_AMONG_DST 0x01
7#define EBT_AMONG_SRC 0x02
8
9/* Grzegorz Borowiak <grzes@gnu.univ.gda.pl> 2003
10 *
11 * Write-once-read-many hash table, used for checking if a given
12 * MAC address belongs to a set or not and possibly for checking
13 * if it is related with a given IPv4 address.
14 *
15 * The hash value of an address is its last byte.
16 *
17 * In real-world ethernet addresses, values of the last byte are
18 * evenly distributed and there is no need to consider other bytes.
19 * It would only slow the routines down.
20 *
21 * For MAC address comparison speedup reasons, we introduce a trick.
22 * MAC address is mapped onto an array of two 32-bit integers.
23 * This pair of integers is compared with MAC addresses in the
24 * hash table, which are stored also in form of pairs of integers
25 * (in `cmp' array). This is quick as it requires only two elementary
26 * number comparisons in worst case. Further, we take advantage of
27 * fact that entropy of 3 last bytes of address is larger than entropy
28 * of 3 first bytes. So first we compare 4 last bytes of addresses and
29 * if they are the same we compare 2 first.
30 *
31 * Yes, it is a memory overhead, but in 2003 AD, who cares?
32 */
33
34struct ebt_mac_wormhash_tuple {
35 __u32 cmp[2];
36 __be32 ip;
37};
38
39struct ebt_mac_wormhash {
40 int table[257];
41 int poolsize;
42 struct ebt_mac_wormhash_tuple pool[0];
43};
44
45#define ebt_mac_wormhash_size(x) ((x) ? sizeof(struct ebt_mac_wormhash) \
46 + (x)->poolsize * sizeof(struct ebt_mac_wormhash_tuple) : 0)
47
48struct ebt_among_info {
49 int wh_dst_ofs;
50 int wh_src_ofs;
51 int bitmask;
52};
53
54#define EBT_AMONG_DST_NEG 0x1
55#define EBT_AMONG_SRC_NEG 0x2
56
57#define ebt_among_wh_dst(x) ((x)->wh_dst_ofs ? \
58 (struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_dst_ofs) : NULL)
59#define ebt_among_wh_src(x) ((x)->wh_src_ofs ? \
60 (struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_src_ofs) : NULL)
61
62#define EBT_AMONG_MATCH "among"
63
64#endif
diff --git a/include/linux/netfilter_bridge/ebt_arp.h b/include/linux/netfilter_bridge/ebt_arp.h
new file mode 100644
index 00000000000..522f3e427f4
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_arp.h
@@ -0,0 +1,36 @@
1#ifndef __LINUX_BRIDGE_EBT_ARP_H
2#define __LINUX_BRIDGE_EBT_ARP_H
3
4#include <linux/types.h>
5
6#define EBT_ARP_OPCODE 0x01
7#define EBT_ARP_HTYPE 0x02
8#define EBT_ARP_PTYPE 0x04
9#define EBT_ARP_SRC_IP 0x08
10#define EBT_ARP_DST_IP 0x10
11#define EBT_ARP_SRC_MAC 0x20
12#define EBT_ARP_DST_MAC 0x40
13#define EBT_ARP_GRAT 0x80
14#define EBT_ARP_MASK (EBT_ARP_OPCODE | EBT_ARP_HTYPE | EBT_ARP_PTYPE | \
15 EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC | \
16 EBT_ARP_GRAT)
17#define EBT_ARP_MATCH "arp"
18
19struct ebt_arp_info
20{
21 __be16 htype;
22 __be16 ptype;
23 __be16 opcode;
24 __be32 saddr;
25 __be32 smsk;
26 __be32 daddr;
27 __be32 dmsk;
28 unsigned char smaddr[ETH_ALEN];
29 unsigned char smmsk[ETH_ALEN];
30 unsigned char dmaddr[ETH_ALEN];
31 unsigned char dmmsk[ETH_ALEN];
32 __u8 bitmask;
33 __u8 invflags;
34};
35
36#endif
diff --git a/include/linux/netfilter_bridge/ebt_arpreply.h b/include/linux/netfilter_bridge/ebt_arpreply.h
new file mode 100644
index 00000000000..7e77896e1fb
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_arpreply.h
@@ -0,0 +1,10 @@
1#ifndef __LINUX_BRIDGE_EBT_ARPREPLY_H
2#define __LINUX_BRIDGE_EBT_ARPREPLY_H
3
4struct ebt_arpreply_info {
5 unsigned char mac[ETH_ALEN];
6 int target;
7};
8#define EBT_ARPREPLY_TARGET "arpreply"
9
10#endif
diff --git a/include/linux/netfilter_bridge/ebt_ip.h b/include/linux/netfilter_bridge/ebt_ip.h
new file mode 100644
index 00000000000..c4bbc41b0ea
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_ip.h
@@ -0,0 +1,44 @@
1/*
2 * ebt_ip
3 *
4 * Authors:
5 * Bart De Schuymer <bart.de.schuymer@pandora.be>
6 *
7 * April, 2002
8 *
9 * Changes:
10 * added ip-sport and ip-dport
11 * Innominate Security Technologies AG <mhopf@innominate.com>
12 * September, 2002
13 */
14
15#ifndef __LINUX_BRIDGE_EBT_IP_H
16#define __LINUX_BRIDGE_EBT_IP_H
17
18#include <linux/types.h>
19
20#define EBT_IP_SOURCE 0x01
21#define EBT_IP_DEST 0x02
22#define EBT_IP_TOS 0x04
23#define EBT_IP_PROTO 0x08
24#define EBT_IP_SPORT 0x10
25#define EBT_IP_DPORT 0x20
26#define EBT_IP_MASK (EBT_IP_SOURCE | EBT_IP_DEST | EBT_IP_TOS | EBT_IP_PROTO |\
27 EBT_IP_SPORT | EBT_IP_DPORT )
28#define EBT_IP_MATCH "ip"
29
30/* the same values are used for the invflags */
31struct ebt_ip_info {
32 __be32 saddr;
33 __be32 daddr;
34 __be32 smsk;
35 __be32 dmsk;
36 __u8 tos;
37 __u8 protocol;
38 __u8 bitmask;
39 __u8 invflags;
40 __u16 sport[2];
41 __u16 dport[2];
42};
43
44#endif
diff --git a/include/linux/netfilter_bridge/ebt_ip6.h b/include/linux/netfilter_bridge/ebt_ip6.h
new file mode 100644
index 00000000000..42b88968272
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_ip6.h
@@ -0,0 +1,50 @@
1/*
2 * ebt_ip6
3 *
4 * Authors:
5 * Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
6 * Manohar Castelino <manohar.r.castelino@intel.com>
7 *
8 * Jan 11, 2008
9 *
10 */
11
12#ifndef __LINUX_BRIDGE_EBT_IP6_H
13#define __LINUX_BRIDGE_EBT_IP6_H
14
15#include <linux/types.h>
16
17#define EBT_IP6_SOURCE 0x01
18#define EBT_IP6_DEST 0x02
19#define EBT_IP6_TCLASS 0x04
20#define EBT_IP6_PROTO 0x08
21#define EBT_IP6_SPORT 0x10
22#define EBT_IP6_DPORT 0x20
23#define EBT_IP6_ICMP6 0x40
24
25#define EBT_IP6_MASK (EBT_IP6_SOURCE | EBT_IP6_DEST | EBT_IP6_TCLASS |\
26 EBT_IP6_PROTO | EBT_IP6_SPORT | EBT_IP6_DPORT | \
27 EBT_IP6_ICMP6)
28#define EBT_IP6_MATCH "ip6"
29
30/* the same values are used for the invflags */
31struct ebt_ip6_info {
32 struct in6_addr saddr;
33 struct in6_addr daddr;
34 struct in6_addr smsk;
35 struct in6_addr dmsk;
36 __u8 tclass;
37 __u8 protocol;
38 __u8 bitmask;
39 __u8 invflags;
40 union {
41 __u16 sport[2];
42 __u8 icmpv6_type[2];
43 };
44 union {
45 __u16 dport[2];
46 __u8 icmpv6_code[2];
47 };
48};
49
50#endif
diff --git a/include/linux/netfilter_bridge/ebt_limit.h b/include/linux/netfilter_bridge/ebt_limit.h
new file mode 100644
index 00000000000..66d80b30ba0
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_limit.h
@@ -0,0 +1,24 @@
1#ifndef __LINUX_BRIDGE_EBT_LIMIT_H
2#define __LINUX_BRIDGE_EBT_LIMIT_H
3
4#include <linux/types.h>
5
6#define EBT_LIMIT_MATCH "limit"
7
8/* timings are in milliseconds. */
9#define EBT_LIMIT_SCALE 10000
10
11/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
12 seconds, or one every 59 hours. */
13
14struct ebt_limit_info {
15 __u32 avg; /* Average secs between packets * scale */
16 __u32 burst; /* Period multiplier for upper limit. */
17
18 /* Used internally by the kernel */
19 unsigned long prev;
20 __u32 credit;
21 __u32 credit_cap, cost;
22};
23
24#endif
diff --git a/include/linux/netfilter_bridge/ebt_log.h b/include/linux/netfilter_bridge/ebt_log.h
new file mode 100644
index 00000000000..7e7f1d1fe49
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_log.h
@@ -0,0 +1,20 @@
1#ifndef __LINUX_BRIDGE_EBT_LOG_H
2#define __LINUX_BRIDGE_EBT_LOG_H
3
4#include <linux/types.h>
5
6#define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */
7#define EBT_LOG_ARP 0x02
8#define EBT_LOG_NFLOG 0x04
9#define EBT_LOG_IP6 0x08
10#define EBT_LOG_MASK (EBT_LOG_IP | EBT_LOG_ARP | EBT_LOG_IP6)
11#define EBT_LOG_PREFIX_SIZE 30
12#define EBT_LOG_WATCHER "log"
13
14struct ebt_log_info {
15 __u8 loglevel;
16 __u8 prefix[EBT_LOG_PREFIX_SIZE];
17 __u32 bitmask;
18};
19
20#endif
diff --git a/include/linux/netfilter_bridge/ebt_mark_m.h b/include/linux/netfilter_bridge/ebt_mark_m.h
new file mode 100644
index 00000000000..410f9e5a71d
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_mark_m.h
@@ -0,0 +1,16 @@
1#ifndef __LINUX_BRIDGE_EBT_MARK_M_H
2#define __LINUX_BRIDGE_EBT_MARK_M_H
3
4#include <linux/types.h>
5
6#define EBT_MARK_AND 0x01
7#define EBT_MARK_OR 0x02
8#define EBT_MARK_MASK (EBT_MARK_AND | EBT_MARK_OR)
9struct ebt_mark_m_info {
10 unsigned long mark, mask;
11 __u8 invert;
12 __u8 bitmask;
13};
14#define EBT_MARK_MATCH "mark_m"
15
16#endif
diff --git a/include/linux/netfilter_bridge/ebt_mark_t.h b/include/linux/netfilter_bridge/ebt_mark_t.h
new file mode 100644
index 00000000000..7d5a268a431
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_mark_t.h
@@ -0,0 +1,23 @@
1#ifndef __LINUX_BRIDGE_EBT_MARK_T_H
2#define __LINUX_BRIDGE_EBT_MARK_T_H
3
4/* The target member is reused for adding new actions, the
5 * value of the real target is -1 to -NUM_STANDARD_TARGETS.
6 * For backward compatibility, the 4 lsb (2 would be enough,
7 * but let's play it safe) are kept to designate this target.
8 * The remaining bits designate the action. By making the set
9 * action 0xfffffff0, the result will look ok for older
10 * versions. [September 2006] */
11#define MARK_SET_VALUE (0xfffffff0)
12#define MARK_OR_VALUE (0xffffffe0)
13#define MARK_AND_VALUE (0xffffffd0)
14#define MARK_XOR_VALUE (0xffffffc0)
15
16struct ebt_mark_t_info {
17 unsigned long mark;
18 /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */
19 int target;
20};
21#define EBT_MARK_TARGET "mark"
22
23#endif
diff --git a/include/linux/netfilter_bridge/ebt_nat.h b/include/linux/netfilter_bridge/ebt_nat.h
new file mode 100644
index 00000000000..5e74e3b03bd
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_nat.h
@@ -0,0 +1,13 @@
1#ifndef __LINUX_BRIDGE_EBT_NAT_H
2#define __LINUX_BRIDGE_EBT_NAT_H
3
4#define NAT_ARP_BIT (0x00000010)
5struct ebt_nat_info {
6 unsigned char mac[ETH_ALEN];
7 /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */
8 int target;
9};
10#define EBT_SNAT_TARGET "snat"
11#define EBT_DNAT_TARGET "dnat"
12
13#endif
diff --git a/include/linux/netfilter_bridge/ebt_nflog.h b/include/linux/netfilter_bridge/ebt_nflog.h
new file mode 100644
index 00000000000..df829fce912
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_nflog.h
@@ -0,0 +1,23 @@
1#ifndef __LINUX_BRIDGE_EBT_NFLOG_H
2#define __LINUX_BRIDGE_EBT_NFLOG_H
3
4#include <linux/types.h>
5
6#define EBT_NFLOG_MASK 0x0
7
8#define EBT_NFLOG_PREFIX_SIZE 64
9#define EBT_NFLOG_WATCHER "nflog"
10
11#define EBT_NFLOG_DEFAULT_GROUP 0x1
12#define EBT_NFLOG_DEFAULT_THRESHOLD 1
13
14struct ebt_nflog_info {
15 __u32 len;
16 __u16 group;
17 __u16 threshold;
18 __u16 flags;
19 __u16 pad;
20 char prefix[EBT_NFLOG_PREFIX_SIZE];
21};
22
23#endif /* __LINUX_BRIDGE_EBT_NFLOG_H */
diff --git a/include/linux/netfilter_bridge/ebt_pkttype.h b/include/linux/netfilter_bridge/ebt_pkttype.h
new file mode 100644
index 00000000000..c241badcd03
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_pkttype.h
@@ -0,0 +1,12 @@
1#ifndef __LINUX_BRIDGE_EBT_PKTTYPE_H
2#define __LINUX_BRIDGE_EBT_PKTTYPE_H
3
4#include <linux/types.h>
5
6struct ebt_pkttype_info {
7 __u8 pkt_type;
8 __u8 invert;
9};
10#define EBT_PKTTYPE_MATCH "pkttype"
11
12#endif
diff --git a/include/linux/netfilter_bridge/ebt_redirect.h b/include/linux/netfilter_bridge/ebt_redirect.h
new file mode 100644
index 00000000000..dd9622ce848
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_redirect.h
@@ -0,0 +1,10 @@
1#ifndef __LINUX_BRIDGE_EBT_REDIRECT_H
2#define __LINUX_BRIDGE_EBT_REDIRECT_H
3
4struct ebt_redirect_info {
5 /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */
6 int target;
7};
8#define EBT_REDIRECT_TARGET "redirect"
9
10#endif
diff --git a/include/linux/netfilter_bridge/ebt_stp.h b/include/linux/netfilter_bridge/ebt_stp.h
new file mode 100644
index 00000000000..1025b9f5fb7
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_stp.h
@@ -0,0 +1,46 @@
1#ifndef __LINUX_BRIDGE_EBT_STP_H
2#define __LINUX_BRIDGE_EBT_STP_H
3
4#include <linux/types.h>
5
6#define EBT_STP_TYPE 0x0001
7
8#define EBT_STP_FLAGS 0x0002
9#define EBT_STP_ROOTPRIO 0x0004
10#define EBT_STP_ROOTADDR 0x0008
11#define EBT_STP_ROOTCOST 0x0010
12#define EBT_STP_SENDERPRIO 0x0020
13#define EBT_STP_SENDERADDR 0x0040
14#define EBT_STP_PORT 0x0080
15#define EBT_STP_MSGAGE 0x0100
16#define EBT_STP_MAXAGE 0x0200
17#define EBT_STP_HELLOTIME 0x0400
18#define EBT_STP_FWDD 0x0800
19
20#define EBT_STP_MASK 0x0fff
21#define EBT_STP_CONFIG_MASK 0x0ffe
22
23#define EBT_STP_MATCH "stp"
24
25struct ebt_stp_config_info {
26 __u8 flags;
27 __u16 root_priol, root_priou;
28 char root_addr[6], root_addrmsk[6];
29 __u32 root_costl, root_costu;
30 __u16 sender_priol, sender_priou;
31 char sender_addr[6], sender_addrmsk[6];
32 __u16 portl, portu;
33 __u16 msg_agel, msg_ageu;
34 __u16 max_agel, max_ageu;
35 __u16 hello_timel, hello_timeu;
36 __u16 forward_delayl, forward_delayu;
37};
38
39struct ebt_stp_info {
40 __u8 type;
41 struct ebt_stp_config_info config;
42 __u16 bitmask;
43 __u16 invflags;
44};
45
46#endif
diff --git a/include/linux/netfilter_bridge/ebt_ulog.h b/include/linux/netfilter_bridge/ebt_ulog.h
new file mode 100644
index 00000000000..89a6becb526
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_ulog.h
@@ -0,0 +1,38 @@
1#ifndef _EBT_ULOG_H
2#define _EBT_ULOG_H
3
4#include <linux/types.h>
5
6#define EBT_ULOG_DEFAULT_NLGROUP 0
7#define EBT_ULOG_DEFAULT_QTHRESHOLD 1
8#define EBT_ULOG_MAXNLGROUPS 32 /* hardcoded netlink max */
9#define EBT_ULOG_PREFIX_LEN 32
10#define EBT_ULOG_MAX_QLEN 50
11#define EBT_ULOG_WATCHER "ulog"
12#define EBT_ULOG_VERSION 1
13
14struct ebt_ulog_info {
15 __u32 nlgroup;
16 unsigned int cprange;
17 unsigned int qthreshold;
18 char prefix[EBT_ULOG_PREFIX_LEN];
19};
20
21typedef struct ebt_ulog_packet_msg {
22 int version;
23 char indev[IFNAMSIZ];
24 char outdev[IFNAMSIZ];
25 char physindev[IFNAMSIZ];
26 char physoutdev[IFNAMSIZ];
27 char prefix[EBT_ULOG_PREFIX_LEN];
28 struct timeval stamp;
29 unsigned long mark;
30 unsigned int hook;
31 size_t data_len;
32 /* The complete packet, including Ethernet header and perhaps
33 * the VLAN header is appended */
34 unsigned char data[0] __attribute__
35 ((aligned (__alignof__(struct ebt_ulog_info))));
36} ebt_ulog_packet_msg_t;
37
38#endif /* _EBT_ULOG_H */
diff --git a/include/linux/netfilter_bridge/ebt_vlan.h b/include/linux/netfilter_bridge/ebt_vlan.h
new file mode 100644
index 00000000000..967d1d5cf98
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_vlan.h
@@ -0,0 +1,22 @@
1#ifndef __LINUX_BRIDGE_EBT_VLAN_H
2#define __LINUX_BRIDGE_EBT_VLAN_H
3
4#include <linux/types.h>
5
6#define EBT_VLAN_ID 0x01
7#define EBT_VLAN_PRIO 0x02
8#define EBT_VLAN_ENCAP 0x04
9#define EBT_VLAN_MASK (EBT_VLAN_ID | EBT_VLAN_PRIO | EBT_VLAN_ENCAP)
10#define EBT_VLAN_MATCH "vlan"
11
12struct ebt_vlan_info {
13 __u16 id; /* VLAN ID {1-4095} */
14 __u8 prio; /* VLAN User Priority {0-7} */
15 __be16 encap; /* VLAN Encapsulated frame code {0-65535} */
16 __u8 bitmask; /* Args bitmask bit 1=1 - ID arg,
17 bit 2=1 User-Priority arg, bit 3=1 encap*/
18 __u8 invflags; /* Inverse bitmask bit 1=1 - inversed ID arg,
19 bit 2=1 - inversed Pirority arg */
20};
21
22#endif