Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __LINUX_BRIDGE_EBT_802_3_H |
| 2 | #define __LINUX_BRIDGE_EBT_802_3_H |
| 3 | |
| 4 | #define EBT_802_3_SAP 0x01 |
| 5 | #define EBT_802_3_TYPE 0x02 |
| 6 | |
| 7 | #define EBT_802_3_MATCH "802_3" |
| 8 | |
| 9 | /* |
| 10 | * If frame has DSAP/SSAP value 0xaa you must check the SNAP type |
| 11 | * to discover what kind of packet we're carrying. |
| 12 | */ |
| 13 | #define CHECK_TYPE 0xaa |
| 14 | |
| 15 | /* |
| 16 | * Control field may be one or two bytes. If the first byte has |
| 17 | * the value 0x03 then the entire length is one byte, otherwise it is two. |
| 18 | * One byte controls are used in Unnumbered Information frames. |
| 19 | * Two byte controls are used in Numbered Information frames. |
| 20 | */ |
| 21 | #define IS_UI 0x03 |
| 22 | |
| 23 | #define EBT_802_3_MASK (EBT_802_3_SAP | EBT_802_3_TYPE | EBT_802_3) |
| 24 | |
| 25 | /* ui has one byte ctrl, ni has two */ |
| 26 | struct hdr_ui { |
| 27 | uint8_t dsap; |
| 28 | uint8_t ssap; |
| 29 | uint8_t ctrl; |
| 30 | uint8_t orig[3]; |
Al Viro | 47c183fa | 2006-11-14 21:11:51 -0800 | [diff] [blame] | 31 | __be16 type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | struct hdr_ni { |
| 35 | uint8_t dsap; |
| 36 | uint8_t ssap; |
Al Viro | 47c183fa | 2006-11-14 21:11:51 -0800 | [diff] [blame] | 37 | __be16 ctrl; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | uint8_t orig[3]; |
Al Viro | 47c183fa | 2006-11-14 21:11:51 -0800 | [diff] [blame] | 39 | __be16 type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | struct ebt_802_3_hdr { |
| 43 | uint8_t daddr[6]; |
| 44 | uint8_t saddr[6]; |
Al Viro | 47c183fa | 2006-11-14 21:11:51 -0800 | [diff] [blame] | 45 | __be16 len; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | union { |
| 47 | struct hdr_ui ui; |
| 48 | struct hdr_ni ni; |
| 49 | } llc; |
| 50 | }; |
| 51 | |
| 52 | #ifdef __KERNEL__ |
| 53 | #include <linux/skbuff.h> |
| 54 | |
| 55 | static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb) |
| 56 | { |
| 57 | return (struct ebt_802_3_hdr *)skb->mac.raw; |
| 58 | } |
| 59 | #endif |
| 60 | |
| 61 | struct ebt_802_3_info |
| 62 | { |
| 63 | uint8_t sap; |
Al Viro | 47c183fa | 2006-11-14 21:11:51 -0800 | [diff] [blame] | 64 | __be16 type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | uint8_t bitmask; |
| 66 | uint8_t invflags; |
| 67 | }; |
| 68 | |
| 69 | #endif |