[NET]: Change memcmp(,,ETH_ALEN) to compare_ether_addr()

This changes some memcmp(one,two,ETH_ALEN) to compare_ether_addr(one,two).

Signed-off-by: Kris Katterjohn <kjak@users.sourceforge.net>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Kris Katterjohn and committed by
David S. Miller
d3f4a687 770cfbcf

+26 -25
+1 -1
net/8021q/vlan_dev.c
··· 214 * This allows the VLAN to have a different MAC than the underlying 215 * device, and still route correctly. 216 */ 217 - if (memcmp(eth_hdr(skb)->h_dest, skb->dev->dev_addr, ETH_ALEN) == 0) { 218 /* It is for our (changed) MAC-address! */ 219 skb->pkt_type = PACKET_HOST; 220 }
··· 214 * This allows the VLAN to have a different MAC than the underlying 215 * device, and still route correctly. 216 */ 217 + if (!compare_ether_addr(eth_hdr(skb)->h_dest, skb->dev->dev_addr)) { 218 /* It is for our (changed) MAC-address! */ 219 skb->pkt_type = PACKET_HOST; 220 }
+2 -2
net/atm/br2684.c
··· 296 eth = eth_hdr(skb); 297 298 if (is_multicast_ether_addr(eth->h_dest)) { 299 - if (memcmp(eth->h_dest, dev->broadcast, ETH_ALEN) == 0) 300 skb->pkt_type = PACKET_BROADCAST; 301 else 302 skb->pkt_type = PACKET_MULTICAST; 303 } 304 305 - else if (memcmp(eth->h_dest, dev->dev_addr, ETH_ALEN)) 306 skb->pkt_type = PACKET_OTHERHOST; 307 308 if (ntohs(eth->h_proto) >= 1536)
··· 296 eth = eth_hdr(skb); 297 298 if (is_multicast_ether_addr(eth->h_dest)) { 299 + if (!compare_ether_addr(eth->h_dest, dev->broadcast)) 300 skb->pkt_type = PACKET_BROADCAST; 301 else 302 skb->pkt_type = PACKET_MULTICAST; 303 } 304 305 + else if (compare_ether_addr(eth->h_dest, dev->dev_addr)) 306 skb->pkt_type = PACKET_OTHERHOST; 307 308 if (ntohs(eth->h_proto) >= 1536)
+3 -3
net/atm/lec.c
··· 1321 struct sk_buff *skb; 1322 struct lec_priv *priv = (struct lec_priv*)dev->priv; 1323 1324 - if ( memcmp(lan_dst, dev->dev_addr, ETH_ALEN) != 0 ) 1325 return (0); /* not our mac address */ 1326 1327 kfree(priv->tlvs); /* NULL if there was no previous association */ ··· 1798 1799 to_return = priv->lec_arp_tables[place]; 1800 while(to_return) { 1801 - if (memcmp(mac_addr, to_return->mac_addr, ETH_ALEN) == 0) { 1802 return to_return; 1803 } 1804 to_return = to_return->next; ··· 2002 return priv->mcast_vcc; 2003 break; 2004 case 2: /* LANE2 wants arp for multicast addresses */ 2005 - if ( memcmp(mac_to_find, bus_mac, ETH_ALEN) == 0) 2006 return priv->mcast_vcc; 2007 break; 2008 default:
··· 1321 struct sk_buff *skb; 1322 struct lec_priv *priv = (struct lec_priv*)dev->priv; 1323 1324 + if (compare_ether_addr(lan_dst, dev->dev_addr)) 1325 return (0); /* not our mac address */ 1326 1327 kfree(priv->tlvs); /* NULL if there was no previous association */ ··· 1798 1799 to_return = priv->lec_arp_tables[place]; 1800 while(to_return) { 1801 + if (!compare_ether_addr(mac_addr, to_return->mac_addr)) { 1802 return to_return; 1803 } 1804 to_return = to_return->next; ··· 2002 return priv->mcast_vcc; 2003 break; 2004 case 2: /* LANE2 wants arp for multicast addresses */ 2005 + if (!compare_ether_addr(mac_to_find, bus_mac)) 2006 return priv->mcast_vcc; 2007 break; 2008 default:
+1 -1
net/atm/mpc.c
··· 552 goto non_ip; /* Multi-Protocol Over ATM :-) */ 553 554 while (i < mpc->number_of_mps_macs) { 555 - if (memcmp(eth->h_dest, (mpc->mps_macs + i*ETH_ALEN), ETH_ALEN) == 0) 556 if ( send_via_shortcut(skb, mpc) == 0 ) /* try shortcut */ 557 return 0; /* success! */ 558 i++;
··· 552 goto non_ip; /* Multi-Protocol Over ATM :-) */ 553 554 while (i < mpc->number_of_mps_macs) { 555 + if (!compare_ether_addr(eth->h_dest, (mpc->mps_macs + i*ETH_ALEN))) 556 if ( send_via_shortcut(skb, mpc) == 0 ) /* try shortcut */ 557 return 0; /* success! */ 558 i++;
+3 -3
net/bluetooth/bnep/core.c
··· 75 76 list_for_each(p, &bnep_session_list) { 77 s = list_entry(p, struct bnep_session, list); 78 - if (!memcmp(dst, s->eh.h_source, ETH_ALEN)) 79 return s; 80 } 81 return NULL; ··· 420 iv[il++] = (struct kvec) { &type, 1 }; 421 len++; 422 423 - if (!memcmp(eh->h_dest, s->eh.h_source, ETH_ALEN)) 424 type |= 0x01; 425 426 - if (!memcmp(eh->h_source, s->eh.h_dest, ETH_ALEN)) 427 type |= 0x02; 428 429 if (type)
··· 75 76 list_for_each(p, &bnep_session_list) { 77 s = list_entry(p, struct bnep_session, list); 78 + if (!compare_ether_addr(dst, s->eh.h_source)) 79 return s; 80 } 81 return NULL; ··· 420 iv[il++] = (struct kvec) { &type, 1 }; 421 len++; 422 423 + if (!compare_ether_addr(eh->h_dest, s->eh.h_source)) 424 type |= 0x01; 425 426 + if (!compare_ether_addr(eh->h_source, s->eh.h_dest)) 427 type |= 0x02; 428 429 if (type)
+2 -2
net/bridge/netfilter/ebt_stp.c
··· 164 if (datalen != len) 165 return -EINVAL; 166 /* Make sure the match only receives stp frames */ 167 - if (memcmp(e->destmac, bridge_ula, ETH_ALEN) || 168 - memcmp(e->destmsk, msk, ETH_ALEN) || !(e->bitmask & EBT_DESTMAC)) 169 return -EINVAL; 170 171 return 0;
··· 164 if (datalen != len) 165 return -EINVAL; 166 /* Make sure the match only receives stp frames */ 167 + if (compare_ether_addr(e->destmac, bridge_ula) || 168 + compare_ether_addr(e->destmsk, msk) || !(e->bitmask & EBT_DESTMAC)) 169 return -EINVAL; 170 171 return 0;
+1 -1
net/core/dv.c
··· 457 unsigned char *skb_data_end = skb->data + skb->len; 458 459 /* Packet is already aimed at us, return */ 460 - if (!memcmp(eth, skb->dev->dev_addr, ETH_ALEN)) 461 return; 462 463 /* proto is not IP, do nothing */
··· 457 unsigned char *skb_data_end = skb->data + skb->len; 458 459 /* Packet is already aimed at us, return */ 460 + if (!compare_ether_addr(eth, skb->dev->dev_addr)) 461 return; 462 463 /* proto is not IP, do nothing */
+1 -1
net/core/wireless.c
··· 1506 1507 /* Update all records that match */ 1508 for(i = 0; i < spydata->spy_number; i++) 1509 - if(!memcmp(address, spydata->spy_address[i], ETH_ALEN)) { 1510 memcpy(&(spydata->spy_stat[i]), wstats, 1511 sizeof(struct iw_quality)); 1512 match = i;
··· 1506 1507 /* Update all records that match */ 1508 for(i = 0; i < spydata->spy_number; i++) 1509 + if(!compare_ether_addr(address, spydata->spy_address[i])) { 1510 memcpy(&(spydata->spy_stat[i]), wstats, 1511 sizeof(struct iw_quality)); 1512 match = i;
+7 -7
net/ieee80211/ieee80211_rx.c
··· 76 77 if (entry->skb != NULL && entry->seq == seq && 78 (entry->last_frag + 1 == frag || frag == -1) && 79 - memcmp(entry->src_addr, src, ETH_ALEN) == 0 && 80 - memcmp(entry->dst_addr, dst, ETH_ALEN) == 0) 81 return entry; 82 } 83 ··· 243 /* check that the frame is unicast frame to us */ 244 if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == 245 IEEE80211_FCTL_TODS && 246 - memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0 && 247 - memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) { 248 /* ToDS frame with own addr BSSID and DA */ 249 } else if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == 250 IEEE80211_FCTL_FROMDS && 251 - memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) { 252 /* FromDS frame with own addr as DA */ 253 } else 254 return 0; ··· 505 if (ieee->iw_mode == IW_MODE_MASTER && !wds && 506 (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == 507 IEEE80211_FCTL_FROMDS && ieee->stadev 508 - && memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) { 509 /* Frame from BSSID of the AP for which we are a client */ 510 skb->dev = dev = ieee->stadev; 511 stats = hostap_get_stats(dev); ··· 1231 * as one network */ 1232 return ((src->ssid_len == dst->ssid_len) && 1233 (src->channel == dst->channel) && 1234 - !memcmp(src->bssid, dst->bssid, ETH_ALEN) && 1235 !memcmp(src->ssid, dst->ssid, src->ssid_len)); 1236 } 1237
··· 76 77 if (entry->skb != NULL && entry->seq == seq && 78 (entry->last_frag + 1 == frag || frag == -1) && 79 + !compare_ether_addr(entry->src_addr, src) && 80 + !compare_ether_addr(entry->dst_addr, dst)) 81 return entry; 82 } 83 ··· 243 /* check that the frame is unicast frame to us */ 244 if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == 245 IEEE80211_FCTL_TODS && 246 + !compare_ether_addr(hdr->addr1, dev->dev_addr) && 247 + !compare_ether_addr(hdr->addr3, dev->dev_addr)) { 248 /* ToDS frame with own addr BSSID and DA */ 249 } else if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == 250 IEEE80211_FCTL_FROMDS && 251 + !compare_ether_addr(hdr->addr1, dev->dev_addr)) { 252 /* FromDS frame with own addr as DA */ 253 } else 254 return 0; ··· 505 if (ieee->iw_mode == IW_MODE_MASTER && !wds && 506 (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == 507 IEEE80211_FCTL_FROMDS && ieee->stadev 508 + && !compare_ether_addr(hdr->addr2, ieee->assoc_ap_addr)) { 509 /* Frame from BSSID of the AP for which we are a client */ 510 skb->dev = dev = ieee->stadev; 511 stats = hostap_get_stats(dev); ··· 1231 * as one network */ 1232 return ((src->ssid_len == dst->ssid_len) && 1233 (src->channel == dst->channel) && 1234 + !compare_ether_addr(src->bssid, dst->bssid) && 1235 !memcmp(src->ssid, dst->ssid, src->ssid_len)); 1236 } 1237
+3 -2
net/ipv4/netfilter/ipt_mac.c
··· 11 #include <linux/module.h> 12 #include <linux/skbuff.h> 13 #include <linux/if_ether.h> 14 15 #include <linux/netfilter_ipv4/ipt_mac.h> 16 #include <linux/netfilter_ipv4/ip_tables.h> ··· 34 return (skb->mac.raw >= skb->head 35 && (skb->mac.raw + ETH_HLEN) <= skb->data 36 /* If so, compare... */ 37 - && ((memcmp(eth_hdr(skb)->h_source, info->srcaddr, ETH_ALEN) 38 - == 0) ^ info->invert)); 39 } 40 41 static int
··· 11 #include <linux/module.h> 12 #include <linux/skbuff.h> 13 #include <linux/if_ether.h> 14 + #include <linux/etherdevice.h> 15 16 #include <linux/netfilter_ipv4/ipt_mac.h> 17 #include <linux/netfilter_ipv4/ip_tables.h> ··· 33 return (skb->mac.raw >= skb->head 34 && (skb->mac.raw + ETH_HLEN) <= skb->data 35 /* If so, compare... */ 36 + && ((!compare_ether_addr(eth_hdr(skb)->h_source, info->srcaddr)) 37 + ^ info->invert)); 38 } 39 40 static int
+2 -2
net/ipv6/netfilter/ip6t_mac.c
··· 34 return (skb->mac.raw >= skb->head 35 && (skb->mac.raw + ETH_HLEN) <= skb->data 36 /* If so, compare... */ 37 - && ((memcmp(eth_hdr(skb)->h_source, info->srcaddr, ETH_ALEN) 38 - == 0) ^ info->invert)); 39 } 40 41 static int
··· 34 return (skb->mac.raw >= skb->head 35 && (skb->mac.raw + ETH_HLEN) <= skb->data 36 /* If so, compare... */ 37 + && ((!compare_ether_addr(eth_hdr(skb)->h_source, info->srcaddr)) 38 + ^ info->invert)); 39 } 40 41 static int