}
-int is_bcast(uint8_t *addr)
-{
- return (addr[0] == (uint8_t)0xff) && (addr[1] == (uint8_t)0xff);
-}
-
-int is_mcast(uint8_t *addr)
-{
- return *addr & 0x01;
-}
-
module_init(batman_init);
module_exit(batman_exit);
#include <linux/mutex.h> /* mutex */
#include <linux/module.h> /* needed by all modules */
#include <linux/netdevice.h> /* netdevice */
+#include <linux/etherdevice.h> /* ethernet address classifaction */
#include <linux/if_ether.h> /* ethernet header */
#include <linux/poll.h> /* poll_table */
#include <linux/kthread.h> /* kernel threads */
void inc_module_count(void);
void dec_module_count(void);
int is_my_mac(uint8_t *addr);
-int is_bcast(uint8_t *addr);
-int is_mcast(uint8_t *addr);
#ifdef CONFIG_BATMAN_ADV_DEBUG
int debug_log(struct bat_priv *bat_priv, char *fmt, ...);
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. */
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 */
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 */
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 */
/* TODO: check this for locks */
hna_local_add(soft_iface, ethhdr->h_source);
- if (is_bcast(ethhdr->h_dest) || is_mcast(ethhdr->h_dest)) {
+ if (is_multicast_ether_addr(ethhdr->h_dest)) {
ret = gw_is_target(bat_priv, skb);
if (ret < 0)
spin_lock_bh(&bat_priv->orig_hash_lock);
/* get routing information */
- if (is_bcast(ethhdr->h_dest) || is_mcast(ethhdr->h_dest))
+ if (is_multicast_ether_addr(ethhdr->h_dest))
orig_node = (struct orig_node *)gw_get_selected(bat_priv);
else
orig_node = ((struct orig_node *)hash_find(bat_priv->orig_hash,
int are_target = 0;
/* clients shall not broadcast. */
- if (is_bcast(vis_packet->target_orig))
+ if (is_broadcast_ether_addr(vis_packet->target_orig))
return;
/* Are we the target for this VIS packet? */
ETH_ALEN);
packet->ttl--;
- if (is_bcast(packet->target_orig))
+ if (is_broadcast_ether_addr(packet->target_orig))
broadcast_vis_packet(bat_priv, info);
else
unicast_vis_packet(bat_priv, info);