summaryrefslogtreecommitdiffstats
path: root/net/batman-adv/bat_v.c
diff options
context:
space:
mode:
authorAntonio Quartulli2016-05-01 19:14:40 +0200
committerAntonio Quartulli2016-05-18 05:49:41 +0200
commit1653f61d656516aae7130db19561258a847d1e94 (patch)
tree2383946359740a89a61254caeaa3bcab703af08a /net/batman-adv/bat_v.c
parentbatman-adv: Fix unexpected free of bcast_own on add_if error (diff)
downloadkernel-qcow2-linux-1653f61d656516aae7130db19561258a847d1e94.tar.gz
kernel-qcow2-linux-1653f61d656516aae7130db19561258a847d1e94.tar.xz
kernel-qcow2-linux-1653f61d656516aae7130db19561258a847d1e94.zip
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: d6f94d91f766 ("batman-adv: ELP - adding basic infrastructure") Reported-by: Marek Lindner <marek@neomailbox.ch> Signed-off-by: Antonio Quartulli <a@unstable.cc>
Diffstat (limited to 'net/batman-adv/bat_v.c')
-rw-r--r--net/batman-adv/bat_v.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
index 4f626a6b8ebd..31bc57e2a944 100644
--- a/net/batman-adv/bat_v.c
+++ b/net/batman-adv/bat_v.c
@@ -73,16 +73,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)
{