aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKris Katterjohn <kjak@users.sourceforge.net>2006-01-09 19:01:43 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-01-10 15:54:28 -0500
commitd3f4a687f683f536506d0aa6b22e6cb3e79639ce (patch)
treed1f5fb7177d1dd254e63189cb89e51a86a24f171
parent770cfbcffdf0011ecf3a12435ecb5604c4c97a19 (diff)
[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>
-rw-r--r--net/8021q/vlan_dev.c2
-rw-r--r--net/atm/br2684.c4
-rw-r--r--net/atm/lec.c6
-rw-r--r--net/atm/mpc.c2
-rw-r--r--net/bluetooth/bnep/core.c6
-rw-r--r--net/bridge/netfilter/ebt_stp.c4
-rw-r--r--net/core/dv.c2
-rw-r--r--net/core/wireless.c2
-rw-r--r--net/ieee80211/ieee80211_rx.c14
-rw-r--r--net/ipv4/netfilter/ipt_mac.c5
-rw-r--r--net/ipv6/netfilter/ip6t_mac.c4
11 files changed, 26 insertions, 25 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index f2a8750bbf1d..0f604d227da2 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -214,7 +214,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
214 * This allows the VLAN to have a different MAC than the underlying 214 * This allows the VLAN to have a different MAC than the underlying
215 * device, and still route correctly. 215 * device, and still route correctly.
216 */ 216 */
217 if (memcmp(eth_hdr(skb)->h_dest, skb->dev->dev_addr, ETH_ALEN) == 0) { 217 if (!compare_ether_addr(eth_hdr(skb)->h_dest, skb->dev->dev_addr)) {
218 /* It is for our (changed) MAC-address! */ 218 /* It is for our (changed) MAC-address! */
219 skb->pkt_type = PACKET_HOST; 219 skb->pkt_type = PACKET_HOST;
220 } 220 }
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index bdb4d89730d2..1dafa9c108a7 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -296,13 +296,13 @@ static inline __be16 br_type_trans(struct sk_buff *skb, struct net_device *dev)
296 eth = eth_hdr(skb); 296 eth = eth_hdr(skb);
297 297
298 if (is_multicast_ether_addr(eth->h_dest)) { 298 if (is_multicast_ether_addr(eth->h_dest)) {
299 if (memcmp(eth->h_dest, dev->broadcast, ETH_ALEN) == 0) 299 if (!compare_ether_addr(eth->h_dest, dev->broadcast))
300 skb->pkt_type = PACKET_BROADCAST; 300 skb->pkt_type = PACKET_BROADCAST;
301 else 301 else
302 skb->pkt_type = PACKET_MULTICAST; 302 skb->pkt_type = PACKET_MULTICAST;
303 } 303 }
304 304
305 else if (memcmp(eth->h_dest, dev->dev_addr, ETH_ALEN)) 305 else if (compare_ether_addr(eth->h_dest, dev->dev_addr))
306 skb->pkt_type = PACKET_OTHERHOST; 306 skb->pkt_type = PACKET_OTHERHOST;
307 307
308 if (ntohs(eth->h_proto) >= 1536) 308 if (ntohs(eth->h_proto) >= 1536)
diff --git a/net/atm/lec.c b/net/atm/lec.c
index ad840b9afba8..eea051338498 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -1321,7 +1321,7 @@ static int lane2_associate_req (struct net_device *dev, u8 *lan_dst,
1321 struct sk_buff *skb; 1321 struct sk_buff *skb;
1322 struct lec_priv *priv = (struct lec_priv*)dev->priv; 1322 struct lec_priv *priv = (struct lec_priv*)dev->priv;
1323 1323
1324 if ( memcmp(lan_dst, dev->dev_addr, ETH_ALEN) != 0 ) 1324 if (compare_ether_addr(lan_dst, dev->dev_addr))
1325 return (0); /* not our mac address */ 1325 return (0); /* not our mac address */
1326 1326
1327 kfree(priv->tlvs); /* NULL if there was no previous association */ 1327 kfree(priv->tlvs); /* NULL if there was no previous association */
@@ -1798,7 +1798,7 @@ lec_arp_find(struct lec_priv *priv,
1798 1798
1799 to_return = priv->lec_arp_tables[place]; 1799 to_return = priv->lec_arp_tables[place];
1800 while(to_return) { 1800 while(to_return) {
1801 if (memcmp(mac_addr, to_return->mac_addr, ETH_ALEN) == 0) { 1801 if (!compare_ether_addr(mac_addr, to_return->mac_addr)) {
1802 return to_return; 1802 return to_return;
1803 } 1803 }
1804 to_return = to_return->next; 1804 to_return = to_return->next;
@@ -2002,7 +2002,7 @@ lec_arp_resolve(struct lec_priv *priv, unsigned char *mac_to_find,
2002 return priv->mcast_vcc; 2002 return priv->mcast_vcc;
2003 break; 2003 break;
2004 case 2: /* LANE2 wants arp for multicast addresses */ 2004 case 2: /* LANE2 wants arp for multicast addresses */
2005 if ( memcmp(mac_to_find, bus_mac, ETH_ALEN) == 0) 2005 if (!compare_ether_addr(mac_to_find, bus_mac))
2006 return priv->mcast_vcc; 2006 return priv->mcast_vcc;
2007 break; 2007 break;
2008 default: 2008 default:
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 526d9531411f..36b7ae360232 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -552,7 +552,7 @@ static int mpc_send_packet(struct sk_buff *skb, struct net_device *dev)
552 goto non_ip; /* Multi-Protocol Over ATM :-) */ 552 goto non_ip; /* Multi-Protocol Over ATM :-) */
553 553
554 while (i < mpc->number_of_mps_macs) { 554 while (i < mpc->number_of_mps_macs) {
555 if (memcmp(eth->h_dest, (mpc->mps_macs + i*ETH_ALEN), ETH_ALEN) == 0) 555 if (!compare_ether_addr(eth->h_dest, (mpc->mps_macs + i*ETH_ALEN)))
556 if ( send_via_shortcut(skb, mpc) == 0 ) /* try shortcut */ 556 if ( send_via_shortcut(skb, mpc) == 0 ) /* try shortcut */
557 return 0; /* success! */ 557 return 0; /* success! */
558 i++; 558 i++;
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index 682bf20af52d..cbb20c32a6c8 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -75,7 +75,7 @@ static struct bnep_session *__bnep_get_session(u8 *dst)
75 75
76 list_for_each(p, &bnep_session_list) { 76 list_for_each(p, &bnep_session_list) {
77 s = list_entry(p, struct bnep_session, list); 77 s = list_entry(p, struct bnep_session, list);
78 if (!memcmp(dst, s->eh.h_source, ETH_ALEN)) 78 if (!compare_ether_addr(dst, s->eh.h_source))
79 return s; 79 return s;
80 } 80 }
81 return NULL; 81 return NULL;
@@ -420,10 +420,10 @@ static inline int bnep_tx_frame(struct bnep_session *s, struct sk_buff *skb)
420 iv[il++] = (struct kvec) { &type, 1 }; 420 iv[il++] = (struct kvec) { &type, 1 };
421 len++; 421 len++;
422 422
423 if (!memcmp(eh->h_dest, s->eh.h_source, ETH_ALEN)) 423 if (!compare_ether_addr(eh->h_dest, s->eh.h_source))
424 type |= 0x01; 424 type |= 0x01;
425 425
426 if (!memcmp(eh->h_source, s->eh.h_dest, ETH_ALEN)) 426 if (!compare_ether_addr(eh->h_source, s->eh.h_dest))
427 type |= 0x02; 427 type |= 0x02;
428 428
429 if (type) 429 if (type)
diff --git a/net/bridge/netfilter/ebt_stp.c b/net/bridge/netfilter/ebt_stp.c
index f8a8cdec16ee..9d2ef4ffe276 100644
--- a/net/bridge/netfilter/ebt_stp.c
+++ b/net/bridge/netfilter/ebt_stp.c
@@ -164,8 +164,8 @@ static int ebt_stp_check(const char *tablename, unsigned int hookmask,
164 if (datalen != len) 164 if (datalen != len)
165 return -EINVAL; 165 return -EINVAL;
166 /* Make sure the match only receives stp frames */ 166 /* Make sure the match only receives stp frames */
167 if (memcmp(e->destmac, bridge_ula, ETH_ALEN) || 167 if (compare_ether_addr(e->destmac, bridge_ula) ||
168 memcmp(e->destmsk, msk, ETH_ALEN) || !(e->bitmask & EBT_DESTMAC)) 168 compare_ether_addr(e->destmsk, msk) || !(e->bitmask & EBT_DESTMAC))
169 return -EINVAL; 169 return -EINVAL;
170 170
171 return 0; 171 return 0;
diff --git a/net/core/dv.c b/net/core/dv.c
index 3f25f4aa4e66..c5deb3655257 100644
--- a/net/core/dv.c
+++ b/net/core/dv.c
@@ -457,7 +457,7 @@ void divert_frame(struct sk_buff *skb)
457 unsigned char *skb_data_end = skb->data + skb->len; 457 unsigned char *skb_data_end = skb->data + skb->len;
458 458
459 /* Packet is already aimed at us, return */ 459 /* Packet is already aimed at us, return */
460 if (!memcmp(eth, skb->dev->dev_addr, ETH_ALEN)) 460 if (!compare_ether_addr(eth, skb->dev->dev_addr))
461 return; 461 return;
462 462
463 /* proto is not IP, do nothing */ 463 /* proto is not IP, do nothing */
diff --git a/net/core/wireless.c b/net/core/wireless.c
index 271ddb35b0b2..f88b0affb3b9 100644
--- a/net/core/wireless.c
+++ b/net/core/wireless.c
@@ -1506,7 +1506,7 @@ void wireless_spy_update(struct net_device * dev,
1506 1506
1507 /* Update all records that match */ 1507 /* Update all records that match */
1508 for(i = 0; i < spydata->spy_number; i++) 1508 for(i = 0; i < spydata->spy_number; i++)
1509 if(!memcmp(address, spydata->spy_address[i], ETH_ALEN)) { 1509 if(!compare_ether_addr(address, spydata->spy_address[i])) {
1510 memcpy(&(spydata->spy_stat[i]), wstats, 1510 memcpy(&(spydata->spy_stat[i]), wstats,
1511 sizeof(struct iw_quality)); 1511 sizeof(struct iw_quality));
1512 match = i; 1512 match = i;
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c
index 4cc6f41c6930..5e3380388046 100644
--- a/net/ieee80211/ieee80211_rx.c
+++ b/net/ieee80211/ieee80211_rx.c
@@ -76,8 +76,8 @@ static struct ieee80211_frag_entry *ieee80211_frag_cache_find(struct
76 76
77 if (entry->skb != NULL && entry->seq == seq && 77 if (entry->skb != NULL && entry->seq == seq &&
78 (entry->last_frag + 1 == frag || frag == -1) && 78 (entry->last_frag + 1 == frag || frag == -1) &&
79 memcmp(entry->src_addr, src, ETH_ALEN) == 0 && 79 !compare_ether_addr(entry->src_addr, src) &&
80 memcmp(entry->dst_addr, dst, ETH_ALEN) == 0) 80 !compare_ether_addr(entry->dst_addr, dst))
81 return entry; 81 return entry;
82 } 82 }
83 83
@@ -243,12 +243,12 @@ static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
243 /* check that the frame is unicast frame to us */ 243 /* check that the frame is unicast frame to us */
244 if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == 244 if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
245 IEEE80211_FCTL_TODS && 245 IEEE80211_FCTL_TODS &&
246 memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0 && 246 !compare_ether_addr(hdr->addr1, dev->dev_addr) &&
247 memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) { 247 !compare_ether_addr(hdr->addr3, dev->dev_addr)) {
248 /* ToDS frame with own addr BSSID and DA */ 248 /* ToDS frame with own addr BSSID and DA */
249 } else if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == 249 } else if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
250 IEEE80211_FCTL_FROMDS && 250 IEEE80211_FCTL_FROMDS &&
251 memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) { 251 !compare_ether_addr(hdr->addr1, dev->dev_addr)) {
252 /* FromDS frame with own addr as DA */ 252 /* FromDS frame with own addr as DA */
253 } else 253 } else
254 return 0; 254 return 0;
@@ -505,7 +505,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
505 if (ieee->iw_mode == IW_MODE_MASTER && !wds && 505 if (ieee->iw_mode == IW_MODE_MASTER && !wds &&
506 (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == 506 (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
507 IEEE80211_FCTL_FROMDS && ieee->stadev 507 IEEE80211_FCTL_FROMDS && ieee->stadev
508 && memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) { 508 && !compare_ether_addr(hdr->addr2, ieee->assoc_ap_addr)) {
509 /* Frame from BSSID of the AP for which we are a client */ 509 /* Frame from BSSID of the AP for which we are a client */
510 skb->dev = dev = ieee->stadev; 510 skb->dev = dev = ieee->stadev;
511 stats = hostap_get_stats(dev); 511 stats = hostap_get_stats(dev);
@@ -1231,7 +1231,7 @@ static inline int is_same_network(struct ieee80211_network *src,
1231 * as one network */ 1231 * as one network */
1232 return ((src->ssid_len == dst->ssid_len) && 1232 return ((src->ssid_len == dst->ssid_len) &&
1233 (src->channel == dst->channel) && 1233 (src->channel == dst->channel) &&
1234 !memcmp(src->bssid, dst->bssid, ETH_ALEN) && 1234 !compare_ether_addr(src->bssid, dst->bssid) &&
1235 !memcmp(src->ssid, dst->ssid, src->ssid_len)); 1235 !memcmp(src->ssid, dst->ssid, src->ssid_len));
1236} 1236}
1237 1237
diff --git a/net/ipv4/netfilter/ipt_mac.c b/net/ipv4/netfilter/ipt_mac.c
index 11a459e33f25..1b9bb4559f80 100644
--- a/net/ipv4/netfilter/ipt_mac.c
+++ b/net/ipv4/netfilter/ipt_mac.c
@@ -11,6 +11,7 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/skbuff.h> 12#include <linux/skbuff.h>
13#include <linux/if_ether.h> 13#include <linux/if_ether.h>
14#include <linux/etherdevice.h>
14 15
15#include <linux/netfilter_ipv4/ipt_mac.h> 16#include <linux/netfilter_ipv4/ipt_mac.h>
16#include <linux/netfilter_ipv4/ip_tables.h> 17#include <linux/netfilter_ipv4/ip_tables.h>
@@ -33,8 +34,8 @@ match(const struct sk_buff *skb,
33 return (skb->mac.raw >= skb->head 34 return (skb->mac.raw >= skb->head
34 && (skb->mac.raw + ETH_HLEN) <= skb->data 35 && (skb->mac.raw + ETH_HLEN) <= skb->data
35 /* If so, compare... */ 36 /* If so, compare... */
36 && ((memcmp(eth_hdr(skb)->h_source, info->srcaddr, ETH_ALEN) 37 && ((!compare_ether_addr(eth_hdr(skb)->h_source, info->srcaddr))
37 == 0) ^ info->invert)); 38 ^ info->invert));
38} 39}
39 40
40static int 41static int
diff --git a/net/ipv6/netfilter/ip6t_mac.c b/net/ipv6/netfilter/ip6t_mac.c
index 526d43e37234..ae0b09291d17 100644
--- a/net/ipv6/netfilter/ip6t_mac.c
+++ b/net/ipv6/netfilter/ip6t_mac.c
@@ -34,8 +34,8 @@ match(const struct sk_buff *skb,
34 return (skb->mac.raw >= skb->head 34 return (skb->mac.raw >= skb->head
35 && (skb->mac.raw + ETH_HLEN) <= skb->data 35 && (skb->mac.raw + ETH_HLEN) <= skb->data
36 /* If so, compare... */ 36 /* If so, compare... */
37 && ((memcmp(eth_hdr(skb)->h_source, info->srcaddr, ETH_ALEN) 37 && ((!compare_ether_addr(eth_hdr(skb)->h_source, info->srcaddr))
38 == 0) ^ info->invert)); 38 ^ info->invert));
39} 39}
40 40
41static int 41static int