diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-12-21 03:14:03 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-12-21 03:14:03 +0100 |
commit | e219aafe50fd546b8686582ddbafd24c3c2eda04 (patch) | |
tree | a665e08ca8d42f20ac8e5dcc8565d666cffb26bd /drivers/staging/wlan-ng/p80211conv.c | |
parent | ffe12855a5f7f195589130197558e6a5c276caa4 (diff) | |
parent | 24c96dc79c5e76d3cff7a33f955a4d3244644766 (diff) |
Merge back earlier 'pm-domains' material for v4.5.
Diffstat (limited to 'drivers/staging/wlan-ng/p80211conv.c')
-rw-r--r-- | drivers/staging/wlan-ng/p80211conv.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c index 49f2ef88929d..1b02cdf9d1fa 100644 --- a/drivers/staging/wlan-ng/p80211conv.c +++ b/drivers/staging/wlan-ng/p80211conv.c @@ -135,7 +135,7 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv, /* it's 802.3, pass ether payload unchanged, */ /* trim off ethernet header */ - skb_pull(skb, WLAN_ETHHDR_LEN); + skb_pull(skb, ETH_HLEN); /* leave off any PAD octets. */ skb_trim(skb, proto); @@ -144,7 +144,7 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv, /* it's DIXII, time for some conversion */ /* trim off ethernet header */ - skb_pull(skb, WLAN_ETHHDR_LEN); + skb_pull(skb, ETH_HLEN); /* tack on SNAP */ e_snap = @@ -281,8 +281,8 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, u16 fc; unsigned int payload_length; unsigned int payload_offset; - u8 daddr[WLAN_ETHADDR_LEN]; - u8 saddr[WLAN_ETHADDR_LEN]; + u8 daddr[ETH_ALEN]; + u8 saddr[ETH_ALEN]; union p80211_hdr *w_hdr; struct wlan_ethhdr *e_hdr; struct wlan_llc *e_llc; @@ -298,16 +298,16 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, /* setup some vars for convenience */ fc = le16_to_cpu(w_hdr->a3.fc); if ((WLAN_GET_FC_TODS(fc) == 0) && (WLAN_GET_FC_FROMDS(fc) == 0)) { - memcpy(daddr, w_hdr->a3.a1, WLAN_ETHADDR_LEN); - memcpy(saddr, w_hdr->a3.a2, WLAN_ETHADDR_LEN); + ether_addr_copy(daddr, w_hdr->a3.a1); + ether_addr_copy(saddr, w_hdr->a3.a2); } else if ((WLAN_GET_FC_TODS(fc) == 0) && (WLAN_GET_FC_FROMDS(fc) == 1)) { - memcpy(daddr, w_hdr->a3.a1, WLAN_ETHADDR_LEN); - memcpy(saddr, w_hdr->a3.a3, WLAN_ETHADDR_LEN); + ether_addr_copy(daddr, w_hdr->a3.a1); + ether_addr_copy(saddr, w_hdr->a3.a3); } else if ((WLAN_GET_FC_TODS(fc) == 1) && (WLAN_GET_FC_FROMDS(fc) == 0)) { - memcpy(daddr, w_hdr->a3.a3, WLAN_ETHADDR_LEN); - memcpy(saddr, w_hdr->a3.a2, WLAN_ETHADDR_LEN); + ether_addr_copy(daddr, w_hdr->a3.a3); + ether_addr_copy(saddr, w_hdr->a3.a2); } else { payload_offset = WLAN_HDR_A4_LEN; if (payload_length < WLAN_HDR_A4_LEN - WLAN_HDR_A3_LEN) { @@ -315,8 +315,8 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, return 1; } payload_length -= (WLAN_HDR_A4_LEN - WLAN_HDR_A3_LEN); - memcpy(daddr, w_hdr->a4.a3, WLAN_ETHADDR_LEN); - memcpy(saddr, w_hdr->a4.a4, WLAN_ETHADDR_LEN); + ether_addr_copy(daddr, w_hdr->a4.a3); + ether_addr_copy(saddr, w_hdr->a4.a4); } /* perform de-wep if necessary.. */ @@ -360,16 +360,16 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, /* Test for the various encodings */ if ((payload_length >= sizeof(struct wlan_ethhdr)) && (e_llc->dsap != 0xaa || e_llc->ssap != 0xaa) && - ((memcmp(daddr, e_hdr->daddr, WLAN_ETHADDR_LEN) == 0) || - (memcmp(saddr, e_hdr->saddr, WLAN_ETHADDR_LEN) == 0))) { + ((!ether_addr_equal_unaligned(daddr, e_hdr->daddr)) || + (!ether_addr_equal_unaligned(saddr, e_hdr->saddr)))) { pr_debug("802.3 ENCAP len: %d\n", payload_length); /* 802.3 Encapsulated */ /* Test for an overlength frame */ - if (payload_length > (netdev->mtu + WLAN_ETHHDR_LEN)) { + if (payload_length > (netdev->mtu + ETH_HLEN)) { /* A bogus length ethfrm has been encap'd. */ /* Is someone trying an oflow attack? */ netdev_err(netdev, "ENCAP frame too large (%d > %d)\n", - payload_length, netdev->mtu + WLAN_ETHHDR_LEN); + payload_length, netdev->mtu + ETH_HLEN); return 1; } @@ -406,9 +406,9 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, skb_pull(skb, payload_offset); /* create 802.3 header at beginning of skb. */ - e_hdr = (struct wlan_ethhdr *) skb_push(skb, WLAN_ETHHDR_LEN); - memcpy(e_hdr->daddr, daddr, WLAN_ETHADDR_LEN); - memcpy(e_hdr->saddr, saddr, WLAN_ETHADDR_LEN); + e_hdr = (struct wlan_ethhdr *)skb_push(skb, ETH_HLEN); + ether_addr_copy(e_hdr->daddr, daddr); + ether_addr_copy(e_hdr->saddr, saddr); e_hdr->type = htons(payload_length); /* chop off the 802.11 CRC */ @@ -446,10 +446,10 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, skb_pull(skb, sizeof(struct wlan_snap)); /* create 802.3 header at beginning of skb. */ - e_hdr = (struct wlan_ethhdr *) skb_push(skb, WLAN_ETHHDR_LEN); + e_hdr = (struct wlan_ethhdr *)skb_push(skb, ETH_HLEN); e_hdr->type = e_snap->type; - memcpy(e_hdr->daddr, daddr, WLAN_ETHADDR_LEN); - memcpy(e_hdr->saddr, saddr, WLAN_ETHADDR_LEN); + ether_addr_copy(e_hdr->daddr, daddr); + ether_addr_copy(e_hdr->saddr, saddr); /* chop off the 802.11 CRC */ skb_trim(skb, skb->len - WLAN_CRC_LEN); @@ -473,9 +473,9 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, skb_pull(skb, payload_offset); /* create 802.3 header at beginning of skb. */ - e_hdr = (struct wlan_ethhdr *) skb_push(skb, WLAN_ETHHDR_LEN); - memcpy(e_hdr->daddr, daddr, WLAN_ETHADDR_LEN); - memcpy(e_hdr->saddr, saddr, WLAN_ETHADDR_LEN); + e_hdr = (struct wlan_ethhdr *)skb_push(skb, ETH_HLEN); + ether_addr_copy(e_hdr->daddr, daddr); + ether_addr_copy(e_hdr->saddr, saddr); e_hdr->type = htons(payload_length); /* chop off the 802.11 CRC */ |