]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[NET]: Change memcmp(,,ETH_ALEN) to compare_ether_addr()
authorKris Katterjohn <kjak@users.sourceforge.net>
Tue, 10 Jan 2006 00:01:43 +0000 (16:01 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Tue, 10 Jan 2006 20:54:28 +0000 (12:54 -0800)
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>
net/8021q/vlan_dev.c
net/atm/br2684.c
net/atm/lec.c
net/atm/mpc.c
net/bluetooth/bnep/core.c
net/bridge/netfilter/ebt_stp.c
net/core/dv.c
net/core/wireless.c
net/ieee80211/ieee80211_rx.c
net/ipv4/netfilter/ipt_mac.c
net/ipv6/netfilter/ip6t_mac.c

index f2a8750bbf1d7555633c1b2562883dcd02b800bc..0f604d227da2ba003a25256a28cf3e7de0fd0076 100644 (file)
@@ -214,7 +214,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
                 * This allows the VLAN to have a different MAC than the underlying
                 * device, and still route correctly.
                 */
-               if (memcmp(eth_hdr(skb)->h_dest, skb->dev->dev_addr, ETH_ALEN) == 0) {
+               if (!compare_ether_addr(eth_hdr(skb)->h_dest, skb->dev->dev_addr)) {
                        /* It is for our (changed) MAC-address! */
                        skb->pkt_type = PACKET_HOST;
                }
index bdb4d89730d21da0ad945d7873f040e4f1633d42..1dafa9c108a75fdca35792e67e2b5c35ec8ed2ec 100644 (file)
@@ -296,13 +296,13 @@ static inline __be16 br_type_trans(struct sk_buff *skb, struct net_device *dev)
        eth = eth_hdr(skb);
 
        if (is_multicast_ether_addr(eth->h_dest)) {
-               if (memcmp(eth->h_dest, dev->broadcast, ETH_ALEN) == 0)
+               if (!compare_ether_addr(eth->h_dest, dev->broadcast))
                        skb->pkt_type = PACKET_BROADCAST;
                else
                        skb->pkt_type = PACKET_MULTICAST;
        }
 
-       else if (memcmp(eth->h_dest, dev->dev_addr, ETH_ALEN))
+       else if (compare_ether_addr(eth->h_dest, dev->dev_addr))
                skb->pkt_type = PACKET_OTHERHOST;
 
        if (ntohs(eth->h_proto) >= 1536)
index ad840b9afba8a3a68e644a682f9bf6499e38d765..eea051338498922071b65a84304a994d110bda89 100644 (file)
@@ -1321,7 +1321,7 @@ static int lane2_associate_req (struct net_device *dev, u8 *lan_dst,
         struct sk_buff *skb;
         struct lec_priv *priv = (struct lec_priv*)dev->priv;
 
-        if ( memcmp(lan_dst, dev->dev_addr, ETH_ALEN) != 0 )
+        if (compare_ether_addr(lan_dst, dev->dev_addr))
                 return (0);       /* not our mac address */
 
         kfree(priv->tlvs); /* NULL if there was no previous association */
@@ -1798,7 +1798,7 @@ lec_arp_find(struct lec_priv *priv,
   
         to_return = priv->lec_arp_tables[place];
         while(to_return) {
-                if (memcmp(mac_addr, to_return->mac_addr, ETH_ALEN) == 0) {
+                if (!compare_ether_addr(mac_addr, to_return->mac_addr)) {
                         return to_return;
                 }
                 to_return = to_return->next;
@@ -2002,7 +2002,7 @@ lec_arp_resolve(struct lec_priv *priv, unsigned char *mac_to_find,
                         return priv->mcast_vcc;
                         break;
                 case 2:  /* LANE2 wants arp for multicast addresses */
-                        if ( memcmp(mac_to_find, bus_mac, ETH_ALEN) == 0)
+                        if (!compare_ether_addr(mac_to_find, bus_mac))
                                 return priv->mcast_vcc;
                         break;
                 default:
index 526d9531411f5096aff51411115f62e46e1523ad..36b7ae36023261ffec36bf0faf792ec4216dcf7b 100644 (file)
@@ -552,7 +552,7 @@ static int mpc_send_packet(struct sk_buff *skb, struct net_device *dev)
                goto non_ip; /* Multi-Protocol Over ATM :-) */
 
        while (i < mpc->number_of_mps_macs) {
-               if (memcmp(eth->h_dest, (mpc->mps_macs + i*ETH_ALEN), ETH_ALEN) == 0)
+               if (!compare_ether_addr(eth->h_dest, (mpc->mps_macs + i*ETH_ALEN)))
                        if ( send_via_shortcut(skb, mpc) == 0 )           /* try shortcut */
                                return 0;                                 /* success!     */
                i++;
index 682bf20af52db4affd40f5feb221c56f09e7a37d..cbb20c32a6c8f3e9631d92e6f700497c04099d0e 100644 (file)
@@ -75,7 +75,7 @@ static struct bnep_session *__bnep_get_session(u8 *dst)
 
        list_for_each(p, &bnep_session_list) {
                s = list_entry(p, struct bnep_session, list);   
-               if (!memcmp(dst, s->eh.h_source, ETH_ALEN))
+               if (!compare_ether_addr(dst, s->eh.h_source))
                        return s;
        }
        return NULL;
@@ -420,10 +420,10 @@ static inline int bnep_tx_frame(struct bnep_session *s, struct sk_buff *skb)
        iv[il++] = (struct kvec) { &type, 1 };
        len++;
 
-       if (!memcmp(eh->h_dest, s->eh.h_source, ETH_ALEN))
+       if (!compare_ether_addr(eh->h_dest, s->eh.h_source))
                type |= 0x01;
 
-       if (!memcmp(eh->h_source, s->eh.h_dest, ETH_ALEN))
+       if (!compare_ether_addr(eh->h_source, s->eh.h_dest))
                type |= 0x02;
 
        if (type)
index f8a8cdec16ee2c813c6d2432ab8cc613e6646dd8..9d2ef4ffe2762e90e1ff6eb87bcb83fa7eb58a2f 100644 (file)
@@ -164,8 +164,8 @@ static int ebt_stp_check(const char *tablename, unsigned int hookmask,
        if (datalen != len)
                return -EINVAL;
        /* Make sure the match only receives stp frames */
-       if (memcmp(e->destmac, bridge_ula, ETH_ALEN) ||
-           memcmp(e->destmsk, msk, ETH_ALEN) || !(e->bitmask & EBT_DESTMAC))
+       if (compare_ether_addr(e->destmac, bridge_ula) ||
+           compare_ether_addr(e->destmsk, msk) || !(e->bitmask & EBT_DESTMAC))
                return -EINVAL;
 
        return 0;
index 3f25f4aa4e66d558e4113791713c4d4167cdaeea..c5deb365525782cdfe16ba5c9438e60cf03ff069 100644 (file)
@@ -457,7 +457,7 @@ void divert_frame(struct sk_buff *skb)
        unsigned char                   *skb_data_end = skb->data + skb->len;
 
        /* Packet is already aimed at us, return */
-       if (!memcmp(eth, skb->dev->dev_addr, ETH_ALEN))
+       if (!compare_ether_addr(eth, skb->dev->dev_addr))
                return;
        
        /* proto is not IP, do nothing */
index 271ddb35b0b273a005f5315968c1059006252f6b..f88b0affb3b97035450ce57120790dd5b6a74a2f 100644 (file)
@@ -1506,7 +1506,7 @@ void wireless_spy_update(struct net_device *      dev,
 
        /* Update all records that match */
        for(i = 0; i < spydata->spy_number; i++)
-               if(!memcmp(address, spydata->spy_address[i], ETH_ALEN)) {
+               if(!compare_ether_addr(address, spydata->spy_address[i])) {
                        memcpy(&(spydata->spy_stat[i]), wstats,
                               sizeof(struct iw_quality));
                        match = i;
index 4cc6f41c693087484b9876f22b5754bb45af0614..5e33803880469eef972ffdee7ebc4c3404fd16b1 100644 (file)
@@ -76,8 +76,8 @@ static struct ieee80211_frag_entry *ieee80211_frag_cache_find(struct
 
                if (entry->skb != NULL && entry->seq == seq &&
                    (entry->last_frag + 1 == frag || frag == -1) &&
-                   memcmp(entry->src_addr, src, ETH_ALEN) == 0 &&
-                   memcmp(entry->dst_addr, dst, ETH_ALEN) == 0)
+                   !compare_ether_addr(entry->src_addr, src) &&
+                   !compare_ether_addr(entry->dst_addr, dst))
                        return entry;
        }
 
@@ -243,12 +243,12 @@ static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
        /* check that the frame is unicast frame to us */
        if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
            IEEE80211_FCTL_TODS &&
-           memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0 &&
-           memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) {
+           !compare_ether_addr(hdr->addr1, dev->dev_addr) &&
+           !compare_ether_addr(hdr->addr3, dev->dev_addr)) {
                /* ToDS frame with own addr BSSID and DA */
        } else if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
                   IEEE80211_FCTL_FROMDS &&
-                  memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) {
+                  !compare_ether_addr(hdr->addr1, dev->dev_addr)) {
                /* FromDS frame with own addr as DA */
        } else
                return 0;
@@ -505,7 +505,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
        if (ieee->iw_mode == IW_MODE_MASTER && !wds &&
            (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
            IEEE80211_FCTL_FROMDS && ieee->stadev
-           && memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
+           && !compare_ether_addr(hdr->addr2, ieee->assoc_ap_addr)) {
                /* Frame from BSSID of the AP for which we are a client */
                skb->dev = dev = ieee->stadev;
                stats = hostap_get_stats(dev);
@@ -1231,7 +1231,7 @@ static inline int is_same_network(struct ieee80211_network *src,
         * as one network */
        return ((src->ssid_len == dst->ssid_len) &&
                (src->channel == dst->channel) &&
-               !memcmp(src->bssid, dst->bssid, ETH_ALEN) &&
+               !compare_ether_addr(src->bssid, dst->bssid) &&
                !memcmp(src->ssid, dst->ssid, src->ssid_len));
 }
 
index 11a459e33f250bcd59ecca2cd51c8cf32225f21a..1b9bb4559f8045013e365d453b048fcb87fb62b1 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/skbuff.h>
 #include <linux/if_ether.h>
+#include <linux/etherdevice.h>
 
 #include <linux/netfilter_ipv4/ipt_mac.h>
 #include <linux/netfilter_ipv4/ip_tables.h>
@@ -33,8 +34,8 @@ match(const struct sk_buff *skb,
     return (skb->mac.raw >= skb->head
            && (skb->mac.raw + ETH_HLEN) <= skb->data
            /* If so, compare... */
-           && ((memcmp(eth_hdr(skb)->h_source, info->srcaddr, ETH_ALEN)
-               == 0) ^ info->invert));
+           && ((!compare_ether_addr(eth_hdr(skb)->h_source, info->srcaddr))
+               ^ info->invert));
 }
 
 static int
index 526d43e37234449d49e9533d433efada5839900e..ae0b09291d1750900fed84d34b13ddbe3abf1999 100644 (file)
@@ -34,8 +34,8 @@ match(const struct sk_buff *skb,
     return (skb->mac.raw >= skb->head
            && (skb->mac.raw + ETH_HLEN) <= skb->data
            /* If so, compare... */
-           && ((memcmp(eth_hdr(skb)->h_source, info->srcaddr, ETH_ALEN)
-               == 0) ^ info->invert));
+           && ((!compare_ether_addr(eth_hdr(skb)->h_source, info->srcaddr))
+               ^ info->invert));
 }
 
 static int