Skip to contentSkip to conversation

batman-adv: make sure ELP/OGM orig MAC is updated on address change

PATCH Superseded Antonio Quartulli 2 participants 4 messages May 1, 2016 – May 2, 2016 Batman advanced

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 batman-adv: make sure ELP/OGM orig MAC is updated on address change

When the MAC address of the primary interface is changed, update the originator address in the ELP and OGM skb buffers as well in order to reflect the change.

---
 net/batman-adv/bat_v.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
net/batman-adv/bat_v.c +15 -4
index 3ff8bd1..554ccd5 100644
@@ -72,16 +72,27 @@ static void batadv_v_iface_disable(struct batadv_hard_iface *hard_iface)
 	batadv_v_elp_iface_disable(hard_iface);
 }
 
-static void batadv_v_iface_update_mac(struct batadv_hard_iface *hard_iface)
-{
-}
-
 static void batadv_v_primary_iface_set(struct batadv_hard_iface *hard_iface)
 {
 	batadv_v_elp_primary_iface_set(hard_iface);
 	batadv_v_ogm_primary_iface_set(hard_iface);
 }
 
+static void batadv_v_iface_update_mac(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 != hard_iface)
+		goto out;
+
+	batadv_v_primary_iface_set(hard_iface);
+out:
+	if (primary_if)
+		batadv_hardif_put(primary_if);
+}
+
 static void
 batadv_v_hardif_neigh_init(struct batadv_hardif_neigh_node *hardif_neigh)
 {
Signature · 1 line
2.8.1
#2 lore raw

PATCH v2 1/1 batman-adv: make sure ELP/OGM orig MAC is updated on address change

In reply to Antonio Quartulli

When the MAC address of the primary interface is changed, update the originator address in the ELP and OGM skb buffers as well in order to reflect the change.

Fixes a4b88af77e28 ("batman-adv: ELP - adding basic infrastructure")
---
 net/batman-adv/bat_v.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
net/batman-adv/bat_v.c +15 -4
index 4026f19..4ed3d5e 100644
@@ -72,16 +72,27 @@ static void batadv_v_iface_disable(struct batadv_hard_iface *hard_iface)
 	batadv_v_elp_iface_disable(hard_iface);
 }
 
-static void batadv_v_iface_update_mac(struct batadv_hard_iface *hard_iface)
-{
-}
-
 static void batadv_v_primary_iface_set(struct batadv_hard_iface *hard_iface)
 {
 	batadv_v_elp_primary_iface_set(hard_iface);
 	batadv_v_ogm_primary_iface_set(hard_iface);
 }
 
+static void batadv_v_iface_update_mac(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 != hard_iface)
+		goto out;
+
+	batadv_v_primary_iface_set(hard_iface);
+out:
+	if (primary_if)
+		batadv_hardif_put(primary_if);
+}
+
 static void
 batadv_v_hardif_neigh_init(struct batadv_hardif_neigh_node *hardif_neigh)
 {
Signature · 1 line
2.8.1
#3 lore raw
Quoted 4 lines · On Monday, May 02, 2016 05:23:28 Antonio Quartulli wrote:
net/batman-adv/bat_v.c +4 -0
+static void batadv_v_iface_update_mac(struct batadv_hard_iface *hard_iface)
+{
+       struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
+       struct batadv_hard_iface *primary_if;

net/batman-adv/bat_v.c static void batadv_v_iface_disable(struct batadv_hard_iface *hard_iface) · line 94

Quoted 10 lines
net/batman-adv/bat_v.c +10 -0
+
+       primary_if = batadv_primary_if_get_selected(bat_priv);
+       if (primary_if != hard_iface)
+               goto out;
+
+       batadv_v_primary_iface_set(hard_iface);
+out:
+       if (primary_if)
+               batadv_hardif_put(primary_if);
+}

Please provide kernel doc.

Thanks,
Marek