diff options
Diffstat (limited to 'include/uapi')
19 files changed, 799 insertions, 0 deletions
diff --git a/include/uapi/linux/netfilter_bridge/Kbuild b/include/uapi/linux/netfilter_bridge/Kbuild index aafaa5aa54d4..348717c3a22f 100644 --- a/include/uapi/linux/netfilter_bridge/Kbuild +++ b/include/uapi/linux/netfilter_bridge/Kbuild | |||
| @@ -1 +1,19 @@ | |||
| 1 | # UAPI Header export list | 1 | # UAPI Header export list |
| 2 | header-y += ebt_802_3.h | ||
| 3 | header-y += ebt_among.h | ||
| 4 | header-y += ebt_arp.h | ||
| 5 | header-y += ebt_arpreply.h | ||
| 6 | header-y += ebt_ip.h | ||
| 7 | header-y += ebt_ip6.h | ||
| 8 | header-y += ebt_limit.h | ||
| 9 | header-y += ebt_log.h | ||
| 10 | header-y += ebt_mark_m.h | ||
| 11 | header-y += ebt_mark_t.h | ||
| 12 | header-y += ebt_nat.h | ||
| 13 | header-y += ebt_nflog.h | ||
| 14 | header-y += ebt_pkttype.h | ||
| 15 | header-y += ebt_redirect.h | ||
| 16 | header-y += ebt_stp.h | ||
| 17 | header-y += ebt_ulog.h | ||
| 18 | header-y += ebt_vlan.h | ||
| 19 | header-y += ebtables.h | ||
diff --git a/include/uapi/linux/netfilter_bridge/ebt_802_3.h b/include/uapi/linux/netfilter_bridge/ebt_802_3.h new file mode 100644 index 000000000000..5bf84912a082 --- /dev/null +++ b/include/uapi/linux/netfilter_bridge/ebt_802_3.h | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | #ifndef _UAPI__LINUX_BRIDGE_EBT_802_3_H | ||
| 2 | #define _UAPI__LINUX_BRIDGE_EBT_802_3_H | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 6 | #define EBT_802_3_SAP 0x01 | ||
| 7 | #define EBT_802_3_TYPE 0x02 | ||
| 8 | |||
| 9 | #define EBT_802_3_MATCH "802_3" | ||
| 10 | |||
| 11 | /* | ||
| 12 | * If frame has DSAP/SSAP value 0xaa you must check the SNAP type | ||
| 13 | * to discover what kind of packet we're carrying. | ||
| 14 | */ | ||
| 15 | #define CHECK_TYPE 0xaa | ||
| 16 | |||
| 17 | /* | ||
| 18 | * Control field may be one or two bytes. If the first byte has | ||
| 19 | * the value 0x03 then the entire length is one byte, otherwise it is two. | ||
| 20 | * One byte controls are used in Unnumbered Information frames. | ||
| 21 | * Two byte controls are used in Numbered Information frames. | ||
| 22 | */ | ||
| 23 | #define IS_UI 0x03 | ||
| 24 | |||
| 25 | #define EBT_802_3_MASK (EBT_802_3_SAP | EBT_802_3_TYPE | EBT_802_3) | ||
| 26 | |||
| 27 | /* ui has one byte ctrl, ni has two */ | ||
| 28 | struct hdr_ui { | ||
| 29 | __u8 dsap; | ||
| 30 | __u8 ssap; | ||
| 31 | __u8 ctrl; | ||
| 32 | __u8 orig[3]; | ||
| 33 | __be16 type; | ||
| 34 | }; | ||
| 35 | |||
| 36 | struct hdr_ni { | ||
| 37 | __u8 dsap; | ||
| 38 | __u8 ssap; | ||
| 39 | __be16 ctrl; | ||
| 40 | __u8 orig[3]; | ||
| 41 | __be16 type; | ||
| 42 | }; | ||
| 43 | |||
| 44 | struct ebt_802_3_hdr { | ||
| 45 | __u8 daddr[6]; | ||
| 46 | __u8 saddr[6]; | ||
| 47 | __be16 len; | ||
| 48 | union { | ||
| 49 | struct hdr_ui ui; | ||
| 50 | struct hdr_ni ni; | ||
| 51 | } llc; | ||
| 52 | }; | ||
| 53 | |||
| 54 | |||
| 55 | struct ebt_802_3_info { | ||
| 56 | __u8 sap; | ||
| 57 | __be16 type; | ||
| 58 | __u8 bitmask; | ||
| 59 | __u8 invflags; | ||
| 60 | }; | ||
| 61 | |||
| 62 | #endif /* _UAPI__LINUX_BRIDGE_EBT_802_3_H */ | ||
diff --git a/include/uapi/linux/netfilter_bridge/ebt_among.h b/include/uapi/linux/netfilter_bridge/ebt_among.h new file mode 100644 index 000000000000..bd4e3ad0b706 --- /dev/null +++ b/include/uapi/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 | |||
| 34 | struct ebt_mac_wormhash_tuple { | ||
| 35 | __u32 cmp[2]; | ||
| 36 | __be32 ip; | ||
| 37 | }; | ||
| 38 | |||
| 39 | struct 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 | |||
| 48 | struct 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/uapi/linux/netfilter_bridge/ebt_arp.h b/include/uapi/linux/netfilter_bridge/ebt_arp.h new file mode 100644 index 000000000000..522f3e427f49 --- /dev/null +++ b/include/uapi/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 | ||
