diff options
| author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-10-07 00:45:31 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-10-07 00:45:31 -0700 |
| commit | 9ad5c92053d1dd52ee9e1e46067af92b0e6e22c2 (patch) | |
| tree | 55fa33b7bb7d0354bfc97a7b4adf9e01f17a452a /include | |
| parent | 627771b0ab02e931263e7281e3028fd4bb08c607 (diff) | |
| parent | aa59d2c8a6dc8c90e305b72687559e6829e43388 (diff) | |
Merge bk://kernel.bkbits.net/davem/net-2.6
into ppc970.osdl.org:/home/torvalds/v2.6/linux
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/if_ether.h | 12 | ||||
| -rw-r--r-- | include/linux/if_tr.h | 9 | ||||
| -rw-r--r-- | include/linux/if_vlan.h | 10 | ||||
| -rw-r--r-- | include/linux/netfilter_bridge/ebt_802_3.h | 9 | ||||
| -rw-r--r-- | include/linux/skbuff.h | 1 | ||||
| -rw-r--r-- | include/net/llc_pdu.h | 10 |
6 files changed, 41 insertions, 10 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_tr.h b/include/linux/if_tr.h index f7c97eeb95c8..4fd451f81ccb 100644 --- a/include/linux/if_tr.h +++ b/include/linux/if_tr.h @@ -48,6 +48,15 @@ struct trh_hdr { __u16 rseg[8]; /* routing registers */ }; +#ifdef __KERNEL__ +#include <linux/skbuff.h> + +static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb) +{ + return (struct trh_hdr *)skb->mac.raw; +} +#endif + /* This is an Token-Ring LLC structure */ struct trllc { __u8 dsap; /* destination SAP */ 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; diff --git a/include/net/llc_pdu.h b/include/net/llc_pdu.h index 644f9edc2bae..cbbfc373447d 100644 --- a/include/net/llc_pdu.h +++ b/include/net/llc_pdu.h @@ -253,9 +253,9 @@ static inline void llc_pdu_header_init(struct sk_buff *skb, u8 type, static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa) { if (skb->protocol == ntohs(ETH_P_802_2)) - memcpy(sa, ((struct ethhdr *)skb->mac.raw)->h_source, ETH_ALEN); + memcpy(sa, eth_hdr(skb)->h_source, ETH_ALEN); else if (skb->protocol == ntohs(ETH_P_TR_802_2)) - memcpy(sa, ((struct trh_hdr *)skb->mac.raw)->saddr, ETH_ALEN); + memcpy(sa, tr_hdr(skb)->saddr, ETH_ALEN); } /** @@ -268,9 +268,9 @@ static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa) static inline void llc_pdu_decode_da(struct sk_buff *skb, u8 *da) { if (skb->protocol == ntohs(ETH_P_802_2)) - memcpy(da, ((struct ethhdr *)skb->mac.raw)->h_dest, ETH_ALEN); + memcpy(da, eth_hdr(skb)->h_dest, ETH_ALEN); else if (skb->protocol == ntohs(ETH_P_TR_802_2)) - memcpy(da, ((struct trh_hdr *)skb->mac.raw)->daddr, ETH_ALEN); + memcpy(da, tr_hdr(skb)->daddr, ETH_ALEN); } /** @@ -347,7 +347,7 @@ static inline void llc_pdu_init_as_test_rsp(struct sk_buff *skb, struct llc_pdu_un *ev_pdu = llc_pdu_un_hdr(ev_skb); int dsize; - dsize = ntohs(((struct ethhdr *)ev_skb->mac.raw)->h_proto) - 3; + dsize = ntohs(eth_hdr(ev_skb)->h_proto) - 3; memcpy(((u8 *)pdu) + 3, ((u8 *)ev_pdu) + 3, dsize); skb_put(skb, dsize); } |
