From: Antonio Quartulli <a@unstable.cc>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
Antonio Quartulli <a@unstable.cc>
Subject: [PATCH 5/8] batman-adv: make sure ELP/OGM orig MAC is updated on address change
Date: Wed, 18 May 2016 13:04:49 +0800 [thread overview]
Message-ID: <1463547892-11290-6-git-send-email-a@unstable.cc> (raw)
In-Reply-To: <1463547892-11290-1-git-send-email-a@unstable.cc>
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>
---
net/batman-adv/bat_v.c | 26 ++++++++++++++++++++++----
1 file 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)
{
--
2.8.2
next prev parent reply other threads:[~2016-05-18 5:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1463547892-11290-1-git-send-email-a@unstable.cc>
2016-05-18 5:04 ` [PATCH 1/8] batman-adv: fix skb deref after free Antonio Quartulli
2016-05-18 5:04 ` [PATCH 2/8] batman-adv: Avoid nullptr derefence in batadv_v_neigh_is_sob Antonio Quartulli
2016-05-18 5:04 ` [PATCH 3/8] batman-adv: Fix refcnt leak in batadv_v_neigh_* Antonio Quartulli
2016-05-18 5:04 ` [PATCH 4/8] batman-adv: Fix unexpected free of bcast_own on add_if error Antonio Quartulli
2016-05-18 5:04 ` Antonio Quartulli [this message]
2016-05-18 5:04 ` [PATCH 6/8] batman-adv: Fix integer overflow in batadv_iv_ogm_calc_tq Antonio Quartulli
2016-05-18 5:04 ` [PATCH 7/8] batman-adv: Avoid duplicate neigh_node additions Antonio Quartulli
2016-05-18 5:04 ` [PATCH 8/8] batman-adv: initialize ELP orig address on secondary interfaces Antonio Quartulli
[not found] ` <1463547892-11290-1-git-send-email-a-2CpIooy/SPIKlTDg6p0iyA@public.gmane.org>
2016-05-18 8:00 ` pull request: batman-adv 20160518 Sven Eckelmann
2016-05-19 18:51 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1463547892-11290-6-git-send-email-a@unstable.cc \
--to=a@unstable.cc \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).