summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAntonio Quartulli <a@unstable.cc>2016-03-12 05:12:59 -0500
committerAntonio Quartulli <a@unstable.cc>2016-04-29 07:46:10 -0400
commit2871734e85e920503d49b3a8bc0afbe0773b6036 (patch)
tree1e5ae7b54923bdb79c43561eba920a746bc3c59a /net
parent1dfcd832b1a9ed45edac15b31d079b805fa0ae2a (diff)
batman-adv: fix DAT candidate selection (must use vid)
Now that DAT is VLAN aware, it must use the VID when computing the DHT address of the candidate nodes where an entry is going to be stored/retrieved. Fixes: be1db4f6615b ("batman-adv: make the Distributed ARP Table vlan aware") Signed-off-by: Antonio Quartulli <a@unstable.cc> [sven@narfation.org: fix conflicts with current version] Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Diffstat (limited to 'net')
-rw-r--r--net/batman-adv/distributed-arp-table.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
index e96d7c745b4a..3e6b2624f980 100644
--- a/net/batman-adv/distributed-arp-table.c
+++ b/net/batman-adv/distributed-arp-table.c
@@ -568,6 +568,7 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv,
568 * be sent to 568 * be sent to
569 * @bat_priv: the bat priv with all the soft interface information 569 * @bat_priv: the bat priv with all the soft interface information
570 * @ip_dst: ipv4 to look up in the DHT 570 * @ip_dst: ipv4 to look up in the DHT
571 * @vid: VLAN identifier
571 * 572 *
572 * An originator O is selected if and only if its DHT_ID value is one of three 573 * An originator O is selected if and only if its DHT_ID value is one of three
573 * closest values (from the LEFT, with wrap around if needed) then the hash 574 * closest values (from the LEFT, with wrap around if needed) then the hash
@@ -576,7 +577,8 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv,
576 * Return: the candidate array of size BATADV_DAT_CANDIDATE_NUM. 577 * Return: the candidate array of size BATADV_DAT_CANDIDATE_NUM.
577 */ 578 */
578static struct batadv_dat_candidate * 579static struct batadv_dat_candidate *
579batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) 580batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst,
581 unsigned short vid)
580{ 582{
581 int select; 583 int select;
582 batadv_dat_addr_t last_max = BATADV_DAT_ADDR_MAX, ip_key; 584 batadv_dat_addr_t last_max = BATADV_DAT_ADDR_MAX, ip_key;
@@ -592,7 +594,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst)
592 return NULL; 594 return NULL;
593 595
594 dat.ip = ip_dst; 596 dat.ip = ip_dst;
595 dat.vid = 0; 597 dat.vid = vid;
596 ip_key = (batadv_dat_addr_t)batadv_hash_dat(&dat, 598 ip_key = (batadv_dat_addr_t)batadv_hash_dat(&dat,
597 BATADV_DAT_ADDR_MAX); 599 BATADV_DAT_ADDR_MAX);
598 600
@@ -612,6 +614,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst)
612 * @bat_priv: the bat priv with all the soft interface information 614 * @bat_priv: the bat priv with all the soft interface information
613 * @skb: payload to send 615 * @skb: payload to send
614 * @ip: the DHT key 616 * @ip: the DHT key
617 * @vid: VLAN identifier
615 * @packet_subtype: unicast4addr packet subtype to use 618 * @packet_subtype: unicast4addr packet subtype to use
616 * 619 *
617 * This function copies the skb with pskb_copy() and is sent as unicast packet 620 * This function copies the skb with pskb_copy() and is sent as unicast packet
@@ -622,7 +625,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst)
622 */ 625 */
623static bool batadv_dat_send_data(struct batadv_priv *bat_priv, 626static bool batadv_dat_send_data(struct batadv_priv *bat_priv,
624 struct sk_buff *skb, __be32 ip, 627 struct sk_buff *skb, __be32 ip,
625 int packet_subtype) 628 unsigned short vid, int packet_subtype)
626{ 629{
627 int i; 630 int i;
628 bool ret = false; 631 bool ret = false;
@@ -631,7 +634,7 @@ static bool batadv_dat_send_data(struct batadv_priv *bat_priv,
631 struct sk_buff *tmp_skb; 634 struct sk_buff *tmp_skb;
632 struct batadv_dat_candidate *cand; 635 struct batadv_dat_candidate *cand;
633 636
634 cand = batadv_dat_select_candidates(bat_priv, ip); 637 cand = batadv_dat_select_candidates(bat_priv, ip, vid);
635 if (!cand) 638 if (!cand)
636 goto out; 639 goto out;
637 640
@@ -1022,7 +1025,7 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
1022 ret = true; 1025 ret = true;
1023 } else { 1026 } else {
1024 /* Send the request to the DHT */ 1027 /* Send the request to the DHT */
1025 ret = batadv_dat_send_data(bat_priv, skb, ip_dst, 1028 ret = batadv_dat_send_data(bat_priv, skb, ip_dst, vid,
1026 BATADV_P_DAT_DHT_GET); 1029 BATADV_P_DAT_DHT_GET);
1027 } 1030 }
1028out: 1031out:
@@ -1150,8 +1153,8 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv,
1150 /* Send the ARP reply to the candidates for both the IP addresses that 1153 /* Send the ARP reply to the candidates for both the IP addresses that
1151 * the node obtained from the ARP reply 1154 * the node obtained from the ARP reply
1152 */ 1155 */
1153 batadv_dat_send_data(bat_priv, skb, ip_src, BATADV_P_DAT_DHT_PUT); 1156 batadv_dat_send_data(bat_priv, skb, ip_src, vid, BATADV_P_DAT_DHT_PUT);
1154 batadv_dat_send_data(bat_priv, skb, ip_dst, BATADV_P_DAT_DHT_PUT); 1157 batadv_dat_send_data(bat_priv, skb, ip_dst, vid, BATADV_P_DAT_DHT_PUT);
1155} 1158}
1156 1159
1157/** 1160/**