summaryrefslogtreecommitdiff
path: root/net/batman-adv/distributed-arp-table.c
diff options
context:
space:
mode:
authorAntonio Quartulli <ordex@autistici.org>2012-08-08 20:50:57 +0400
committerAntonio Quartulli <ordex@autistici.org>2012-11-07 23:00:22 +0400
commit33af49ad8ae44de52c0ac30b1a9707dad5e4c418 (patch)
tree8534639935a6962d862d88d7e18a4586ced67951 /net/batman-adv/distributed-arp-table.c
parent172244748204c894864def59133d0133ccfabe30 (diff)
downloadlinux-33af49ad8ae44de52c0ac30b1a9707dad5e4c418.tar.xz
batman-adv: Distributed ARP Table - add runtime switch
This patch adds a runtime switch that enables the user to turn the DAT feature on or off at runtime Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv/distributed-arp-table.c')
-rw-r--r--net/batman-adv/distributed-arp-table.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
index f43bf8e4a2b7..c1a74a126f58 100644
--- a/net/batman-adv/distributed-arp-table.c
+++ b/net/batman-adv/distributed-arp-table.c
@@ -621,6 +621,9 @@ out:
*/
static void batadv_dat_hash_free(struct batadv_priv *bat_priv)
{
+ if (!bat_priv->dat.hash)
+ return;
+
__batadv_dat_purge(bat_priv, NULL);
batadv_hash_destroy(bat_priv->dat.hash);
@@ -790,6 +793,9 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
struct sk_buff *skb_new;
struct batadv_hard_iface *primary_if = NULL;
+ if (!atomic_read(&bat_priv->distributed_arp_table))
+ goto out;
+
type = batadv_arp_get_type(bat_priv, skb, 0);
/* If the node gets an ARP_REQUEST it has to send a DHT_GET unicast
* message to the selected DHT candidates
@@ -861,6 +867,9 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv,
bool ret = false;
int err;
+ if (!atomic_read(&bat_priv->distributed_arp_table))
+ goto out;
+
type = batadv_arp_get_type(bat_priv, skb, hdr_size);
if (type != ARPOP_REQUEST)
goto out;
@@ -924,6 +933,9 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv,
__be32 ip_src, ip_dst;
uint8_t *hw_src, *hw_dst;
+ if (!atomic_read(&bat_priv->distributed_arp_table))
+ return;
+
type = batadv_arp_get_type(bat_priv, skb, 0);
if (type != ARPOP_REPLY)
return;
@@ -959,6 +971,9 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,
uint8_t *hw_src, *hw_dst;
bool ret = false;
+ if (!atomic_read(&bat_priv->distributed_arp_table))
+ goto out;
+
type = batadv_arp_get_type(bat_priv, skb, hdr_size);
if (type != ARPOP_REPLY)
goto out;
@@ -1003,6 +1018,9 @@ bool batadv_dat_drop_broadcast_packet(struct batadv_priv *bat_priv,
bool ret = false;
const size_t bcast_len = sizeof(struct batadv_bcast_packet);
+ if (!atomic_read(&bat_priv->distributed_arp_table))
+ goto out;
+
/* If this packet is an ARP_REQUEST and the node already has the
* information that it is going to ask, then the packet can be dropped
*/