aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2010-11-10 20:08:26 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-11-10 20:08:26 -0500
commit6174c3496d43b78969d4a989e1aabfbc55acbf15 (patch)
tree1229fbe1ecd94ae14f9ff25ac968d028c2bb7d88 /drivers
parent3701befc44eb9b0e5a0e0b7169448658919b9850 (diff)
Revert "staging: batman-adv: Use linux/etherdevice.h address helper functions"
This reverts commit 5712dc7fc812d1bdbc5e634d389bc759d4e7550c. Turns out the batman maintainers didn't like the implementation of it, and the original author was going to rework it to meet their approval, and I applied it without fully realizing all of this. My fault. Cc: Marek Lindner <lindner_marek@yahoo.de> Cc: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Cc: Andrew Lunn <andrew@lunn.ch> Cc: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/batman-adv/main.c12
-rw-r--r--drivers/staging/batman-adv/main.h3
-rw-r--r--drivers/staging/batman-adv/routing.c16
-rw-r--r--drivers/staging/batman-adv/soft-interface.c2
-rw-r--r--drivers/staging/batman-adv/vis.c4
5 files changed, 24 insertions, 13 deletions
diff --git a/drivers/staging/batman-adv/main.c b/drivers/staging/batman-adv/main.c
index 6ea64200ad16..0587940d2723 100644
--- a/drivers/staging/batman-adv/main.c
+++ b/drivers/staging/batman-adv/main.c
@@ -149,7 +149,7 @@ void dec_module_count(void)
149 149
150int compare_orig(void *data1, void *data2) 150int compare_orig(void *data1, void *data2)
151{ 151{
152 return (compare_ether_addr(data1, data2) == 0 ? 1 : 0); 152 return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0);
153} 153}
154 154
155/* hashfunction to choose an entry in a hash table of given size */ 155/* hashfunction to choose an entry in a hash table of given size */
@@ -192,6 +192,16 @@ int is_my_mac(uint8_t *addr)
192 192
193} 193}
194 194
195int is_bcast(uint8_t *addr)
196{
197 return (addr[0] == (uint8_t)0xff) && (addr[1] == (uint8_t)0xff);
198}
199
200int is_mcast(uint8_t *addr)
201{
202 return *addr & 0x01;
203}
204
195module_init(batman_init); 205module_init(batman_init);
196module_exit(batman_exit); 206module_exit(batman_exit);
197 207
diff --git a/drivers/staging/batman-adv/main.h b/drivers/staging/batman-adv/main.h
index 14d567d4911a..5e3f51681f5e 100644
--- a/drivers/staging/batman-adv/main.h
+++ b/drivers/staging/batman-adv/main.h
@@ -109,7 +109,6 @@
109#include <linux/mutex.h> /* mutex */ 109#include <linux/mutex.h> /* mutex */
110#include <linux/module.h> /* needed by all modules */ 110#include <linux/module.h> /* needed by all modules */
111#include <linux/netdevice.h> /* netdevice */ 111#include <linux/netdevice.h> /* netdevice */
112#include <linux/etherdevice.h>
113#include <linux/if_ether.h> /* ethernet header */ 112#include <linux/if_ether.h> /* ethernet header */
114#include <linux/poll.h> /* poll_table */ 113#include <linux/poll.h> /* poll_table */
115#include <linux/kthread.h> /* kernel threads */ 114#include <linux/kthread.h> /* kernel threads */
@@ -139,6 +138,8 @@ void dec_module_count(void);
139int compare_orig(void *data1, void *data2); 138int compare_orig(void *data1, void *data2);
140int choose_orig(void *data, int32_t size); 139int choose_orig(void *data, int32_t size);
141int is_my_mac(uint8_t *addr); 140int is_my_mac(uint8_t *addr);
141int is_bcast(uint8_t *addr);
142int is_mcast(uint8_t *addr);
142 143
143#ifdef CONFIG_BATMAN_ADV_DEBUG 144#ifdef CONFIG_BATMAN_ADV_DEBUG
144int debug_log(struct bat_priv *bat_priv, char *fmt, ...); 145int debug_log(struct bat_priv *bat_priv, char *fmt, ...);
diff --git a/drivers/staging/batman-adv/routing.c b/drivers/staging/batman-adv/routing.c
index d42c16559dff..90102631330b 100644
--- a/drivers/staging/batman-adv/routing.c
+++ b/drivers/staging/batman-adv/routing.c
@@ -756,11 +756,11 @@ int recv_bat_packet(struct sk_buff *skb, struct batman_if *batman_if)
756 ethhdr = (struct ethhdr *)skb_mac_header(skb); 756 ethhdr = (struct ethhdr *)skb_mac_header(skb);
757 757
758 /* packet with broadcast indication but unicast recipient */ 758 /* packet with broadcast indication but unicast recipient */
759 if (!is_broadcast_ether_addr(ethhdr->h_dest)) 759 if (!is_bcast(ethhdr->h_dest))
760 return NET_RX_DROP; 760 return NET_RX_DROP;
761 761
762 /* packet with broadcast sender address */ 762 /* packet with broadcast sender address */
763 if (is_broadcast_ether_addr(ethhdr->h_source)) 763 if (is_bcast(ethhdr->h_source))
764 return NET_RX_DROP; 764 return NET_RX_DROP;
765 765
766 /* create a copy of the skb, if needed, to modify it. */ 766 /* create a copy of the skb, if needed, to modify it. */
@@ -933,11 +933,11 @@ int recv_icmp_packet(struct sk_buff *skb, struct batman_if *recv_if)
933 ethhdr = (struct ethhdr *)skb_mac_header(skb); 933 ethhdr = (struct ethhdr *)skb_mac_header(skb);
934 934
935 /* packet with unicast indication but broadcast recipient */ 935 /* packet with unicast indication but broadcast recipient */
936 if (is_broadcast_ether_addr(ethhdr->h_dest)) 936 if (is_bcast(ethhdr->h_dest))
937 return NET_RX_DROP; 937 return NET_RX_DROP;
938 938
939 /* packet with broadcast sender address */ 939 /* packet with broadcast sender address */
940 if (is_broadcast_ether_addr(ethhdr->h_source)) 940 if (is_bcast(ethhdr->h_source))
941 return NET_RX_DROP; 941 return NET_RX_DROP;
942 942
943 /* not for me */ 943 /* not for me */
@@ -1107,11 +1107,11 @@ static int check_unicast_packet(struct sk_buff *skb, int hdr_size)
1107 ethhdr = (struct ethhdr *)skb_mac_header(skb); 1107 ethhdr = (struct ethhdr *)skb_mac_header(skb);
1108 1108
1109 /* packet with unicast indication but broadcast recipient */ 1109 /* packet with unicast indication but broadcast recipient */
1110 if (is_broadcast_ether_addr(ethhdr->h_dest)) 1110 if (is_bcast(ethhdr->h_dest))
1111 return -1; 1111 return -1;
1112 1112
1113 /* packet with broadcast sender address */ 1113 /* packet with broadcast sender address */
1114 if (is_broadcast_ether_addr(ethhdr->h_source)) 1114 if (is_bcast(ethhdr->h_source))
1115 return -1; 1115 return -1;
1116 1116
1117 /* not for me */ 1117 /* not for me */
@@ -1283,11 +1283,11 @@ int recv_bcast_packet(struct sk_buff *skb, struct batman_if *recv_if)
1283 ethhdr = (struct ethhdr *)skb_mac_header(skb); 1283 ethhdr = (struct ethhdr *)skb_mac_header(skb);
1284 1284
1285 /* packet with broadcast indication but unicast recipient */ 1285 /* packet with broadcast indication but unicast recipient */
1286 if (!is_broadcast_ether_addr(ethhdr->h_dest)) 1286 if (!is_bcast(ethhdr->h_dest))
1287 return NET_RX_DROP; 1287 return NET_RX_DROP;
1288 1288
1289 /* packet with broadcast sender address */ 1289 /* packet with broadcast sender address */
1290 if (is_broadcast_ether_addr(ethhdr->h_source)) 1290 if (is_bcast(ethhdr->h_source))
1291 return NET_RX_DROP; 1291 return NET_RX_DROP;
1292 1292
1293 /* ignore broadcasts sent by myself */ 1293 /* ignore broadcasts sent by myself */
diff --git a/drivers/staging/batman-adv/soft-interface.c b/drivers/staging/batman-adv/soft-interface.c
index 820e14159dd3..3904db9ce7b1 100644
--- a/drivers/staging/batman-adv/soft-interface.c
+++ b/drivers/staging/batman-adv/soft-interface.c
@@ -140,7 +140,7 @@ int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
140 hna_local_add(soft_iface, ethhdr->h_source); 140 hna_local_add(soft_iface, ethhdr->h_source);
141 141
142 /* ethernet packet should be broadcasted */ 142 /* ethernet packet should be broadcasted */
143 if (is_multicast_ether_addr(ethhdr->h_dest)) { 143 if (is_bcast(ethhdr->h_dest) || is_mcast(ethhdr->h_dest)) {
144 if (!bat_priv->primary_if) 144 if (!bat_priv->primary_if)
145 goto dropped; 145 goto dropped;
146 146
diff --git a/drivers/staging/batman-adv/vis.c b/drivers/staging/batman-adv/vis.c
index 395f1109d606..4473cc8ed6b0 100644
--- a/drivers/staging/batman-adv/vis.c
+++ b/drivers/staging/batman-adv/vis.c
@@ -469,7 +469,7 @@ void receive_client_update_packet(struct bat_priv *bat_priv,
469 int are_target = 0; 469 int are_target = 0;
470 470
471 /* clients shall not broadcast. */ 471 /* clients shall not broadcast. */
472 if (is_broadcast_ether_addr(vis_packet->target_orig)) 472 if (is_bcast(vis_packet->target_orig))
473 return; 473 return;
474 474
475 /* Are we the target for this VIS packet? */ 475 /* Are we the target for this VIS packet? */
@@ -746,7 +746,7 @@ static void send_vis_packet(struct bat_priv *bat_priv, struct vis_info *info)
746 ETH_ALEN); 746 ETH_ALEN);
747 packet->ttl--; 747 packet->ttl--;
748 748
749 if (is_broadcast_ether_addr(packet->target_orig)) 749 if (is_bcast(packet->target_orig))
750 broadcast_vis_packet(bat_priv, info); 750 broadcast_vis_packet(bat_priv, info);
751 else 751 else
752 unicast_vis_packet(bat_priv, info); 752 unicast_vis_packet(bat_priv, info);