summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/if_ether.h12
-rw-r--r--include/linux/if_vlan.h10
-rw-r--r--include/linux/netfilter_bridge/ebt_802_3.h9
-rw-r--r--include/linux/skbuff.h1
4 files changed, 27 insertions, 5 deletions
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index d62b4dfd8305..4037aaab7aa9 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -96,11 +96,19 @@
* This is an Ethernet frame header.
*/
-struct ethhdr
-{
+struct ethhdr {
unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
unsigned char h_source[ETH_ALEN]; /* source ether addr */
unsigned short h_proto; /* packet type ID field */
} __attribute__((packed));
+#ifdef __KERNEL__
+#include <linux/skbuff.h>
+
+static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
+{
+ return (struct ethhdr *)skb->mac.raw;
+}
+#endif
+
#endif /* _LINUX_IF_ETHER_H */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 529c401a9a86..29b6e104657e 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -18,7 +18,6 @@
/* externally defined structs */
struct vlan_group;
struct net_device;
-struct sk_buff;
struct packet_type;
struct vlan_collection;
struct vlan_dev_info;
@@ -48,6 +47,13 @@ struct vlan_ethhdr {
unsigned short h_vlan_encapsulated_proto; /* packet type ID field (or len) */
};
+#include <linux/skbuff.h>
+
+static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
+{
+ return (struct vlan_ethhdr *)skb->mac.raw;
+}
+
struct vlan_hdr {
unsigned short h_vlan_TCI; /* Encapsulates priority and VLAN ID */
unsigned short h_vlan_encapsulated_proto; /* packet type ID field (or len) */
@@ -180,7 +186,7 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb,
* This allows the VLAN to have a different MAC than the underlying
* device, and still route correctly.
*/
- if (!memcmp(skb->mac.ethernet->h_dest, skb->dev->dev_addr, ETH_ALEN))
+ if (!memcmp(eth_hdr(skb)->h_dest, skb->dev->dev_addr, ETH_ALEN))
skb->pkt_type = PACKET_HOST;
break;
};
diff --git a/include/linux/netfilter_bridge/ebt_802_3.h b/include/linux/netfilter_bridge/ebt_802_3.h
index b3d6c3219075..b9f712c14a0a 100644
--- a/include/linux/netfilter_bridge/ebt_802_3.h
+++ b/include/linux/netfilter_bridge/ebt_802_3.h
@@ -49,6 +49,15 @@ struct ebt_802_3_hdr {
} llc;
};
+#ifdef __KERNEL__
+#include <linux/skbuff.h>
+
+static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb)
+{
+ return (struct ebt_802_3_hdr *)skb->mac.raw;
+}
+#endif
+
struct ebt_802_3_info
{
uint8_t sap;
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index b6c6ef59ab16..71fc2bdc0cd6 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -219,7 +219,6 @@ struct sk_buff {
} nh;
union {
- struct ethhdr *ethernet;
unsigned char *raw;
} mac;