summaryrefslogtreecommitdiff
path: root/drivers/staging/batman-adv/routing.c
diff options
context:
space:
mode:
authorSven Eckelmann <sven.eckelmann@gmx.de>2010-11-22 00:56:07 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2010-11-29 11:09:14 -0800
commit951c44e0dbfaa580d5b4fb13427ab93ee252636a (patch)
tree76477a2882a4d711bbb734132aaebd0623d77076 /drivers/staging/batman-adv/routing.c
parent8cab2fbe6dacfdd3b122c450d2fffde6ac06a8b6 (diff)
Staging: batman-adv: Use kernel functions to identify broadcasts
linux/etherdevice.h already provides functions to classify different ethernet addresses. These inlineable functions should be used instead of custom functions. The check for multicast together with multicast can also be replaced with a single test for multicast because for every ethernet address x following is always true: is_broadcast_ether_addr(x) => is_multicast_ether_addr(x) or when looking more at the implementation: (FF:FF:FF:FF:FF:FF == x) => [(01:00:00:00:00:00 & x) != 00:00:00:00:00:00] Reported-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/batman-adv/routing.c')
-rw-r--r--drivers/staging/batman-adv/routing.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/staging/batman-adv/routing.c b/drivers/staging/batman-adv/routing.c
index 9f31167a9058..d8b0c5a6d5df 100644
--- a/drivers/staging/batman-adv/routing.c
+++ b/drivers/staging/batman-adv/routing.c
@@ -770,11 +770,11 @@ int recv_bat_packet(struct sk_buff *skb, struct batman_if *batman_if)
ethhdr = (struct ethhdr *)skb_mac_header(skb);
/* packet with broadcast indication but unicast recipient */
- if (!is_bcast(ethhdr->h_dest))
+ if (!is_broadcast_ether_addr(ethhdr->h_dest))
return NET_RX_DROP;
/* packet with broadcast sender address */
- if (is_bcast(ethhdr->h_source))
+ if (is_broadcast_ether_addr(ethhdr->h_source))
return NET_RX_DROP;
/* create a copy of the skb, if needed, to modify it. */
@@ -946,11 +946,11 @@ int recv_icmp_packet(struct sk_buff *skb, struct batman_if *recv_if)
ethhdr = (struct ethhdr *)skb_mac_header(skb);
/* packet with unicast indication but broadcast recipient */
- if (is_bcast(ethhdr->h_dest))
+ if (is_broadcast_ether_addr(ethhdr->h_dest))
return NET_RX_DROP;
/* packet with broadcast sender address */
- if (is_bcast(ethhdr->h_source))
+ if (is_broadcast_ether_addr(ethhdr->h_source))
return NET_RX_DROP;
/* not for me */
@@ -1118,11 +1118,11 @@ static int check_unicast_packet(struct sk_buff *skb, int hdr_size)
ethhdr = (struct ethhdr *)skb_mac_header(skb);
/* packet with unicast indication but broadcast recipient */
- if (is_bcast(ethhdr->h_dest))
+ if (is_broadcast_ether_addr(ethhdr->h_dest))
return -1;
/* packet with broadcast sender address */
- if (is_bcast(ethhdr->h_source))
+ if (is_broadcast_ether_addr(ethhdr->h_source))
return -1;
/* not for me */
@@ -1282,11 +1282,11 @@ int recv_bcast_packet(struct sk_buff *skb, struct batman_if *recv_if)
ethhdr = (struct ethhdr *)skb_mac_header(skb);
/* packet with broadcast indication but unicast recipient */
- if (!is_bcast(ethhdr->h_dest))
+ if (!is_broadcast_ether_addr(ethhdr->h_dest))
return NET_RX_DROP;
/* packet with broadcast sender address */
- if (is_bcast(ethhdr->h_source))
+ if (is_broadcast_ether_addr(ethhdr->h_source))
return NET_RX_DROP;
/* ignore broadcasts sent by myself */