mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
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: d6f94d91f7
("batman-adv: ELP - adding basic infrastructure")
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
This commit is contained in:
parent
e123705e58
commit
ebe24cea95
@ -40,6 +40,16 @@
|
|||||||
|
|
||||||
static void batadv_v_iface_activate(struct batadv_hard_iface *hard_iface)
|
static void batadv_v_iface_activate(struct batadv_hard_iface *hard_iface)
|
||||||
{
|
{
|
||||||
|
struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
|
||||||
|
struct batadv_hard_iface *primary_if;
|
||||||
|
|
||||||
|
primary_if = batadv_primary_if_get_selected(bat_priv);
|
||||||
|
|
||||||
|
if (primary_if) {
|
||||||
|
batadv_v_elp_iface_activate(primary_if, hard_iface);
|
||||||
|
batadv_hardif_put(primary_if);
|
||||||
|
}
|
||||||
|
|
||||||
/* B.A.T.M.A.N. V does not use any queuing mechanism, therefore it can
|
/* B.A.T.M.A.N. V does not use any queuing mechanism, therefore it can
|
||||||
* set the interface as ACTIVE right away, without any risk of race
|
* set the interface as ACTIVE right away, without any risk of race
|
||||||
* condition
|
* condition
|
||||||
|
@ -376,6 +376,27 @@ void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface)
|
|||||||
hard_iface->bat_v.elp_skb = NULL;
|
hard_iface->bat_v.elp_skb = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* batadv_v_elp_iface_activate - update the ELP buffer belonging to the given
|
||||||
|
* hard-interface
|
||||||
|
* @primary_iface: the new primary interface
|
||||||
|
* @hard_iface: interface holding the to-be-updated buffer
|
||||||
|
*/
|
||||||
|
void batadv_v_elp_iface_activate(struct batadv_hard_iface *primary_iface,
|
||||||
|
struct batadv_hard_iface *hard_iface)
|
||||||
|
{
|
||||||
|
struct batadv_elp_packet *elp_packet;
|
||||||
|
struct sk_buff *skb;
|
||||||
|
|
||||||
|
if (!hard_iface->bat_v.elp_skb)
|
||||||
|
return;
|
||||||
|
|
||||||
|
skb = hard_iface->bat_v.elp_skb;
|
||||||
|
elp_packet = (struct batadv_elp_packet *)skb->data;
|
||||||
|
ether_addr_copy(elp_packet->orig,
|
||||||
|
primary_iface->net_dev->dev_addr);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* batadv_v_elp_primary_iface_set - change internal data to reflect the new
|
* batadv_v_elp_primary_iface_set - change internal data to reflect the new
|
||||||
* primary interface
|
* primary interface
|
||||||
@ -384,8 +405,6 @@ void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface)
|
|||||||
void batadv_v_elp_primary_iface_set(struct batadv_hard_iface *primary_iface)
|
void batadv_v_elp_primary_iface_set(struct batadv_hard_iface *primary_iface)
|
||||||
{
|
{
|
||||||
struct batadv_hard_iface *hard_iface;
|
struct batadv_hard_iface *hard_iface;
|
||||||
struct batadv_elp_packet *elp_packet;
|
|
||||||
struct sk_buff *skb;
|
|
||||||
|
|
||||||
/* update orig field of every elp iface belonging to this mesh */
|
/* update orig field of every elp iface belonging to this mesh */
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
@ -393,13 +412,7 @@ void batadv_v_elp_primary_iface_set(struct batadv_hard_iface *primary_iface)
|
|||||||
if (primary_iface->soft_iface != hard_iface->soft_iface)
|
if (primary_iface->soft_iface != hard_iface->soft_iface)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!hard_iface->bat_v.elp_skb)
|
batadv_v_elp_iface_activate(primary_iface, hard_iface);
|
||||||
continue;
|
|
||||||
|
|
||||||
skb = hard_iface->bat_v.elp_skb;
|
|
||||||
elp_packet = (struct batadv_elp_packet *)skb->data;
|
|
||||||
ether_addr_copy(elp_packet->orig,
|
|
||||||
primary_iface->net_dev->dev_addr);
|
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,8 @@ struct work_struct;
|
|||||||
|
|
||||||
int batadv_v_elp_iface_enable(struct batadv_hard_iface *hard_iface);
|
int batadv_v_elp_iface_enable(struct batadv_hard_iface *hard_iface);
|
||||||
void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface);
|
void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface);
|
||||||
|
void batadv_v_elp_iface_activate(struct batadv_hard_iface *primary_iface,
|
||||||
|
struct batadv_hard_iface *hard_iface);
|
||||||
void batadv_v_elp_primary_iface_set(struct batadv_hard_iface *primary_iface);
|
void batadv_v_elp_primary_iface_set(struct batadv_hard_iface *primary_iface);
|
||||||
int batadv_v_elp_packet_recv(struct sk_buff *skb,
|
int batadv_v_elp_packet_recv(struct sk_buff *skb,
|
||||||
struct batadv_hard_iface *if_incoming);
|
struct batadv_hard_iface *if_incoming);
|
||||||
|
Loading…
Reference in New Issue
Block a user