aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Lindner <mareklindner@neomailbox.ch>2016-05-07 07:54:17 -0400
committerAntonio Quartulli <a@unstable.cc>2016-05-17 23:49:44 -0400
commitebe24cea95ab969f76f2922032f6c390fdc816f2 (patch)
tree74a7b66238dd55bed64c3d3f7815c3642ddd7382
parente123705e58bf171be8c6eb0902ebfb5d6ed255ad (diff)
batman-adv: initialize ELP orig address on secondary interfaces
This fix prevents nodes to wrongly create a 00:00:00:00:00:00 originator which can potentially interfere with the rest of the neighbor statistics. Fixes: d6f94d91f766 ("batman-adv: ELP - adding basic infrastructure") Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Antonio Quartulli <a@unstable.cc>
-rw-r--r--net/batman-adv/bat_v.c10
-rw-r--r--net/batman-adv/bat_v_elp.c31
-rw-r--r--net/batman-adv/bat_v_elp.h2
3 files changed, 34 insertions, 9 deletions
diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
index 31bc57e2a944..0a12e5cdd65d 100644
--- a/net/batman-adv/bat_v.c
+++ b/net/batman-adv/bat_v.c
@@ -40,6 +40,16 @@
40 40
41static void batadv_v_iface_activate(struct batadv_hard_iface *hard_iface) 41static void batadv_v_iface_activate(struct batadv_hard_iface *hard_iface)
42{ 42{
43 struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
44 struct batadv_hard_iface *primary_if;
45
46 primary_if = batadv_primary_if_get_selected(bat_priv);
47
48 if (primary_if) {
49 batadv_v_elp_iface_activate(primary_if, hard_iface);
50 batadv_hardif_put(primary_if);
51 }
52
43 /* B.A.T.M.A.N. V does not use any queuing mechanism, therefore it can 53 /* B.A.T.M.A.N. V does not use any queuing mechanism, therefore it can
44 * set the interface as ACTIVE right away, without any risk of race 54 * set the interface as ACTIVE right away, without any risk of race
45 * condition 55 * condition
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index 3844e7efd0b0..df42eb1365a0 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -377,6 +377,27 @@ void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface)
377} 377}
378 378
379/** 379/**
380 * batadv_v_elp_iface_activate - update the ELP buffer belonging to the given
381 * hard-interface
382 * @primary_iface: the new primary interface
383 * @hard_iface: interface holding the to-be-updated buffer
384 */
385void batadv_v_elp_iface_activate(struct batadv_hard_iface *primary_iface,
386 struct batadv_hard_iface *hard_iface)
387{
388 struct batadv_elp_packet *elp_packet;
389 struct sk_buff *skb;
390
391 if (!hard_iface->bat_v.elp_skb)
392 return;
393
394 skb = hard_iface->bat_v.elp_skb;
395 elp_packet = (struct batadv_elp_packet *)skb->data;
396 ether_addr_copy(elp_packet->orig,
397 primary_iface->net_dev->dev_addr);
398}
399
400/**
380 * batadv_v_elp_primary_iface_set - change internal data to reflect the new 401 * batadv_v_elp_primary_iface_set - change internal data to reflect the new
381 * primary interface 402 * primary interface
382 * @primary_iface: the new primary interface 403 * @primary_iface: the new primary interface
@@ -384,8 +405,6 @@ void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface)
384void batadv_v_elp_primary_iface_set(struct batadv_hard_iface *primary_iface) 405void batadv_v_elp_primary_iface_set(struct batadv_hard_iface *primary_iface)
385{ 406{
386 struct batadv_hard_iface *hard_iface; 407 struct batadv_hard_iface *hard_iface;
387 struct batadv_elp_packet *elp_packet;
388 struct sk_buff *skb;
389 408
390 /* update orig field of every elp iface belonging to this mesh */ 409 /* update orig field of every elp iface belonging to this mesh */
391 rcu_read_lock(); 410 rcu_read_lock();
@@ -393,13 +412,7 @@ void batadv_v_elp_primary_iface_set(struct batadv_hard_iface *primary_iface)
393 if (primary_iface->soft_iface != hard_iface->soft_iface) 412 if (primary_iface->soft_iface != hard_iface->soft_iface)
394 continue; 413 continue;
395 414
396 if (!hard_iface->bat_v.elp_skb) 415 batadv_v_elp_iface_activate(primary_iface, hard_iface);
397 continue;
398
399 skb = hard_iface->bat_v.elp_skb;
400 elp_packet = (struct batadv_elp_packet *)skb->data;
401 ether_addr_copy(elp_packet->orig,
402 primary_iface->net_dev->dev_addr);
403 } 416 }
404 rcu_read_unlock(); 417 rcu_read_unlock();
405} 418}
diff --git a/net/batman-adv/bat_v_elp.h b/net/batman-adv/bat_v_elp.h
index e95f1bca0785..cc130b2d05e5 100644
--- a/net/batman-adv/bat_v_elp.h
+++ b/net/batman-adv/bat_v_elp.h
@@ -25,6 +25,8 @@ struct work_struct;
25 25
26int batadv_v_elp_iface_enable(struct batadv_hard_iface *hard_iface); 26int batadv_v_elp_iface_enable(struct batadv_hard_iface *hard_iface);
27void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface); 27void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface);
28void batadv_v_elp_iface_activate(struct batadv_hard_iface *primary_iface,
29 struct batadv_hard_iface *hard_iface);
28void batadv_v_elp_primary_iface_set(struct batadv_hard_iface *primary_iface); 30void batadv_v_elp_primary_iface_set(struct batadv_hard_iface *primary_iface);
29int batadv_v_elp_packet_recv(struct sk_buff *skb, 31int batadv_v_elp_packet_recv(struct sk_buff *skb,
30 struct batadv_hard_iface *if_incoming); 32 struct batadv_hard_iface *if_incoming);