Skip to contentSkip to conversation

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

PATCH Applied Antonio Quartulli 2 participants 2 messages May 2, 2016 Batman advanced

lore
Share & tools
lore
#0 lore raw

PATCH v3 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.

Fixes a4b88af77e28 ("batman-adv: ELP - adding basic infrastructure")

---

Changes from v1:
- Fixes: tag added
- rebased on top of maint

Changes from v2:
- kernel-doc added

 net/batman-adv/bat_v.c | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)
net/batman-adv/bat_v.c +22 -4
index 4026f19..4547fce 100644
@@ -72,16 +72,34 @@ 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);
 }
 
+/**
+ * batadv_v_iface_update_mac - react to hard-interface MAC address change
+ * @hard_iface: the modified interface
+ *
+ * If the modified interface is the primary one, update the originator
+ * address in the ELP and OGM messages to reflect the new MAC address.
+ */
+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.2
#1 lore raw
Quoted 13 lines · On Monday, May 02, 2016 18:27:38 Antonio Quartulli wrote:

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")

---

Changes from v1:
- Fixes: tag added
- rebased on top of maint

Quoted 5 lines

Changes from v2:
- kernel-doc added

 net/batman-adv/bat_v.c | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

Applied in revision a636bf0.

Thanks,
Marek