diff options
author | Joe Perches <joe@perches.com> | 2013-09-01 14:51:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-09-03 22:28:04 -0400 |
commit | 7367d0b573d149550d2ae25c402984b98f8f422e (patch) | |
tree | 7979dd25d2883f5ca9835f9d447795f3163a1037 /drivers/net/vxlan.c | |
parent | c9b37458e95629b1d1171457afdcc1bf1eb7881d (diff) |
drivers/net: Convert uses of compare_ether_addr to ether_addr_equal
Use the new bool function ether_addr_equal to add
some clarity and reduce the likelihood for misuse
of compare_ether_addr for sorting.
Done via cocci script: (and a little typing)
$ cat compare_ether_addr.cocci
@@
expression a,b;
@@
- !compare_ether_addr(a, b)
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- compare_ether_addr(a, b)
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- !ether_addr_equal(a, b) == 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- !ether_addr_equal(a, b) != 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- ether_addr_equal(a, b) == 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- ether_addr_equal(a, b) != 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- !!ether_addr_equal(a, b)
+ ether_addr_equal(a, b)
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vxlan.c')
-rw-r--r-- | drivers/net/vxlan.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 6b560f373fc3..8f6d6c1153ce 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -478,7 +478,7 @@ static struct vxlan_fdb *__vxlan_find_mac(struct vxlan_dev *vxlan, | |||
478 | struct vxlan_fdb *f; | 478 | struct vxlan_fdb *f; |
479 | 479 | ||
480 | hlist_for_each_entry_rcu(f, head, hlist) { | 480 | hlist_for_each_entry_rcu(f, head, hlist) { |
481 | if (compare_ether_addr(mac, f->eth_addr) == 0) | 481 | if (ether_addr_equal(mac, f->eth_addr)) |
482 | return f; | 482 | return f; |
483 | } | 483 | } |
484 | 484 | ||
@@ -1049,8 +1049,7 @@ static void vxlan_rcv(struct vxlan_sock *vs, | |||
1049 | skb->protocol = eth_type_trans(skb, vxlan->dev); | 1049 | skb->protocol = eth_type_trans(skb, vxlan->dev); |
1050 | 1050 | ||
1051 | /* Ignore packet loops (and multicast echo) */ | 1051 | /* Ignore packet loops (and multicast echo) */ |
1052 | if (compare_ether_addr(eth_hdr(skb)->h_source, | 1052 | if (ether_addr_equal(eth_hdr(skb)->h_source, vxlan->dev->dev_addr)) |
1053 | vxlan->dev->dev_addr) == 0) | ||
1054 | goto drop; | 1053 | goto drop; |
1055 | 1054 | ||
1056 | /* Re-examine inner Ethernet packet */ | 1055 | /* Re-examine inner Ethernet packet */ |
@@ -1320,7 +1319,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb) | |||
1320 | if (n) { | 1319 | if (n) { |
1321 | bool diff; | 1320 | bool diff; |
1322 | 1321 | ||
1323 | diff = compare_ether_addr(eth_hdr(skb)->h_dest, n->ha) != 0; | 1322 | diff = !ether_addr_equal(eth_hdr(skb)->h_dest, n->ha); |
1324 | if (diff) { | 1323 | if (diff) { |
1325 | memcpy(eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest, | 1324 | memcpy(eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest, |
1326 | dev->addr_len); | 1325 | dev->addr_len); |