aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/distributed-arp-table.c
diff options
context:
space:
mode:
authorAntonio Quartulli <ordex@autistici.org>2012-08-08 12:50:57 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-11-07 14:00:22 -0500
commit33af49ad8ae44de52c0ac30b1a9707dad5e4c418 (patch)
tree8534639935a6962d862d88d7e18a4586ced67951 /net/batman-adv/distributed-arp-table.c
parent172244748204c894864def59133d0133ccfabe30 (diff)
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:
621 */ 621 */
622static void batadv_dat_hash_free(struct batadv_priv *bat_priv) 622static void batadv_dat_hash_free(struct batadv_priv *bat_priv)
623{ 623{
624 if (!bat_priv->dat.hash)
625 return;
626
624 __batadv_dat_purge(bat_priv, NULL); 627 __batadv_dat_purge(bat_priv, NULL);
625 628
626 batadv_hash_destroy(bat_priv->dat.hash); 629 batadv_hash_destroy(bat_priv->dat.hash);
@@ -790,6 +793,9 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
790 struct sk_buff *skb_new; 793 struct sk_buff *skb_new;
791 struct batadv_hard_iface *primary_if = NULL; 794 struct batadv_hard_iface *primary_if = NULL;
792 795
796 if (!atomic_read(&bat_priv->distributed_arp_table))
797 goto out;
798
793 type = batadv_arp_get_type(bat_priv, skb, 0); 799 type = batadv_arp_get_type(bat_priv, skb, 0);
794 /* If the node gets an ARP_REQUEST it has to send a DHT_GET unicast 800 /* If the node gets an ARP_REQUEST it has to send a DHT_GET unicast
795 * message to the selected DHT candidates 801 * message to the selected DHT candidates
@@ -861,6 +867,9 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv,
861 bool ret = false; 867 bool ret = false;
862 int err; 868 int err;
863 869
870 if (!atomic_read(&bat_priv->distributed_arp_table))
871 goto out;
872
864 type = batadv_arp_get_type(bat_priv, skb, hdr_size); 873 type = batadv_arp_get_type(bat_priv, skb, hdr_size);
865 if (type != ARPOP_REQUEST) 874 if (type != ARPOP_REQUEST)
866 goto out; 875 goto out;
@@ -924,6 +933,9 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv,
924 __be32 ip_src, ip_dst; 933 __be32 ip_src, ip_dst;
925 uint8_t *hw_src, *hw_dst; 934 uint8_t *hw_src, *hw_dst;
926 935
936 if (!atomic_read(&bat_priv->distributed_arp_table))
937 return;
938
927 type = batadv_arp_get_type(bat_priv, skb, 0); 939 type = batadv_arp_get_type(bat_priv, skb, 0);
928 if (type != ARPOP_REPLY) 940 if (type != ARPOP_REPLY)
929 return; 941 return;
@@ -959,6 +971,9 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,
959 uint8_t *hw_src, *hw_dst; 971 uint8_t *hw_src, *hw_dst;
960 bool ret = false; 972 bool ret = false;
961 973
974 if (!atomic_read(&bat_priv->distributed_arp_table))
975 goto out;
976
962 type = batadv_arp_get_type(bat_priv, skb, hdr_size); 977 type = batadv_arp_get_type(bat_priv, skb, hdr_size);
963 if (type != ARPOP_REPLY) 978 if (type != ARPOP_REPLY)
964 goto out; 979 goto out;
@@ -1003,6 +1018,9 @@ bool batadv_dat_drop_broadcast_packet(struct batadv_priv *bat_priv,
1003 bool ret = false; 1018 bool ret = false;
1004 const size_t bcast_len = sizeof(struct batadv_bcast_packet); 1019 const size_t bcast_len = sizeof(struct batadv_bcast_packet);
1005 1020
1021 if (!atomic_read(&bat_priv->distributed_arp_table))
1022 goto out;
1023
1006 /* If this packet is an ARP_REQUEST and the node already has the 1024 /* If this packet is an ARP_REQUEST and the node already has the
1007 * information that it is going to ask, then the packet can be dropped 1025 * information that it is going to ask, then the packet can be dropped
1008 */ 1026 */