[SK_BUFF]: Introduce skb_mac_header()

For the places where we need a pointer to the mac header, it is still legal to
touch skb->mac.raw directly if just adding to, subtracting from or setting it
to another layer header.

This one also converts some more cases to skb_reset_mac_header() that my
regex missed as it had no spaces before nor after '=', ugh.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Arnaldo Carvalho de Melo
2007-03-19 15:33:04 -07:00
committed by David S. Miller
parent 31713c333d
commit 98e399f82a
49 changed files with 108 additions and 88 deletions

View File

@ -590,20 +590,20 @@ void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx)
int hostap_80211_header_parse(struct sk_buff *skb, unsigned char *haddr)
{
memcpy(haddr, skb->mac.raw + 10, ETH_ALEN); /* addr2 */
memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */
return ETH_ALEN;
}
int hostap_80211_prism_header_parse(struct sk_buff *skb, unsigned char *haddr)
{
if (*(u32 *)skb->mac.raw == LWNG_CAP_DID_BASE) {
memcpy(haddr, skb->mac.raw +
sizeof(struct linux_wlan_ng_prism_hdr) + 10,
const unsigned char *mac = skb_mac_header(skb);
if (*(u32 *)mac == LWNG_CAP_DID_BASE) {
memcpy(haddr, mac + sizeof(struct linux_wlan_ng_prism_hdr) + 10,
ETH_ALEN); /* addr2 */
} else { /* (*(u32 *)skb->mac.raw == htonl(LWNG_CAPHDR_VERSION)) */
memcpy(haddr, skb->mac.raw +
sizeof(struct linux_wlan_ng_cap_hdr) + 10,
} else { /* (*(u32 *)mac == htonl(LWNG_CAPHDR_VERSION)) */
memcpy(haddr, mac + sizeof(struct linux_wlan_ng_cap_hdr) + 10,
ETH_ALEN); /* addr2 */
}
return ETH_ALEN;