* [PATCH maint v2] batman-adv: Fix duplicated OGMs on NETDEV_UP
@ 2019-06-02 9:51 Sven Eckelmann
2019-06-02 10:16 ` Marek Lindner
2019-06-02 10:52 ` Linus Lüssing
0 siblings, 2 replies; 3+ messages in thread
From: Sven Eckelmann @ 2019-06-02 9:51 UTC (permalink / raw)
To: b.a.t.m.a.n
Cc: Sven Eckelmann, Linus Lüssing, Antonio Quartulli,
Marek Lindner
The state of slave interfaces are handled differently depending on whether
the interface is up or not. All active interfaces (IFF_UP) will transmit
OGMs. But for B.A.T.M.A.N. IV, also non-active interfaces are scheduling
(low TTL) OGMs on active interfaces. The code which setups and schedules
the OGMs must therefore already be called when the interfaces gets added as
slave interface and the transmit function must then check whether it has to
send out the OGM or not on the specific slave interface.
But the commit 0d8468553c3c ("batman-adv: remove ogm_emit and ogm_schedule
API calls") moved the setup code from the enable function to the activate
function. The latter is called either when the added slave was already up
when batadv_hardif_enable_interface processed the new interface or when a
NETDEV_UP event was received for this slave interfac. As result, each
NETDEV_UP would schedule a new OGM worker for the interface and thus OGMs
would be send a lot more than expected.
Fixes: 0d8468553c3c ("batman-adv: remove ogm_emit and ogm_schedule API calls")
Reported-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
Cc: Antonio Quartulli <a@unstable.cc>
Cc: Marek Lindner <mareklindner@neomailbox.ch>
v2:
* added "(optional)" mark to kerneldoc of enabled function pointer
Here are the backports:
* 2019.2 backport: https://github.com/openwrt-routing/packages/pull/475
* 2018.1 backport: https://github.com/openwrt-routing/packages/pull/474
* 2016.5 backport: https://github.com/openwrt-routing/packages/pull/473
net/batman-adv/bat_iv_ogm.c | 4 ++--
net/batman-adv/hard-interface.c | 3 +++
net/batman-adv/types.h | 3 +++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index bd4138dd..240ed709 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -2337,7 +2337,7 @@ batadv_iv_ogm_neigh_is_sob(struct batadv_neigh_node *neigh1,
return ret;
}
-static void batadv_iv_iface_activate(struct batadv_hard_iface *hard_iface)
+static void batadv_iv_iface_enabled(struct batadv_hard_iface *hard_iface)
{
/* begin scheduling originator messages on that interface */
batadv_iv_ogm_schedule(hard_iface);
@@ -2683,8 +2683,8 @@ static void batadv_iv_gw_dump(struct sk_buff *msg, struct netlink_callback *cb,
static struct batadv_algo_ops batadv_batman_iv __read_mostly = {
.name = "BATMAN_IV",
.iface = {
- .activate = batadv_iv_iface_activate,
.enable = batadv_iv_ogm_iface_enable,
+ .enabled = batadv_iv_iface_enabled,
.disable = batadv_iv_ogm_iface_disable,
.update_mac = batadv_iv_ogm_iface_update_mac,
.primary_set = batadv_iv_ogm_primary_iface_set,
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 79d1731b..3719cfd0 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -795,6 +795,9 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
batadv_hardif_recalc_extra_skbroom(soft_iface);
+ if (bat_priv->algo_ops->iface.enabled)
+ bat_priv->algo_ops->iface.enabled(hard_iface);
+
out:
return 0;
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 74b64473..e0b25104 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -2129,6 +2129,9 @@ struct batadv_algo_iface_ops {
/** @enable: init routing info when hard-interface is enabled */
int (*enable)(struct batadv_hard_iface *hard_iface);
+ /** @enabled: notification when hard-interface was enabled (optional) */
+ void (*enabled)(struct batadv_hard_iface *hard_iface);
+
/** @disable: de-init routing info when hard-interface is disabled */
void (*disable)(struct batadv_hard_iface *hard_iface);
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH maint v2] batman-adv: Fix duplicated OGMs on NETDEV_UP
2019-06-02 9:51 [PATCH maint v2] batman-adv: Fix duplicated OGMs on NETDEV_UP Sven Eckelmann
@ 2019-06-02 10:16 ` Marek Lindner
2019-06-02 10:52 ` Linus Lüssing
1 sibling, 0 replies; 3+ messages in thread
From: Marek Lindner @ 2019-06-02 10:16 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Antonio Quartulli
[-- Attachment #1: Type: text/plain, Size: 1364 bytes --]
On Sunday, 2 June 2019 17:51:35 HKT Sven Eckelmann wrote:
> The state of slave interfaces are handled differently depending on whether
> the interface is up or not. All active interfaces (IFF_UP) will transmit
> OGMs. But for B.A.T.M.A.N. IV, also non-active interfaces are scheduling
> (low TTL) OGMs on active interfaces. The code which setups and schedules
> the OGMs must therefore already be called when the interfaces gets added as
> slave interface and the transmit function must then check whether it has to
> send out the OGM or not on the specific slave interface.
>
> But the commit 0d8468553c3c ("batman-adv: remove ogm_emit and ogm_schedule
> API calls") moved the setup code from the enable function to the activate
> function. The latter is called either when the added slave was already up
> when batadv_hardif_enable_interface processed the new interface or when a
> NETDEV_UP event was received for this slave interfac. As result, each
> NETDEV_UP would schedule a new OGM worker for the interface and thus OGMs
> would be send a lot more than expected.
>
> Fixes: 0d8468553c3c ("batman-adv: remove ogm_emit and ogm_schedule API
> calls") Reported-by: Linus Lüssing <linus.luessing@c0d3.blue>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
Acked-by: Marek Lindner <mareklindner@neomailbox.ch>
Cheers,
Marek
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH maint v2] batman-adv: Fix duplicated OGMs on NETDEV_UP
2019-06-02 9:51 [PATCH maint v2] batman-adv: Fix duplicated OGMs on NETDEV_UP Sven Eckelmann
2019-06-02 10:16 ` Marek Lindner
@ 2019-06-02 10:52 ` Linus Lüssing
1 sibling, 0 replies; 3+ messages in thread
From: Linus Lüssing @ 2019-06-02 10:52 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
Cc: Antonio Quartulli, Marek Lindner
On Sun, Jun 02, 2019 at 11:51:35AM +0200, Sven Eckelmann wrote:
> The state of slave interfaces are handled differently depending on whether
> the interface is up or not. All active interfaces (IFF_UP) will transmit
> OGMs. But for B.A.T.M.A.N. IV, also non-active interfaces are scheduling
> (low TTL) OGMs on active interfaces. The code which setups and schedules
> the OGMs must therefore already be called when the interfaces gets added as
> slave interface and the transmit function must then check whether it has to
> send out the OGM or not on the specific slave interface.
>
> But the commit 0d8468553c3c ("batman-adv: remove ogm_emit and ogm_schedule
> API calls") moved the setup code from the enable function to the activate
> function. The latter is called either when the added slave was already up
> when batadv_hardif_enable_interface processed the new interface or when a
> NETDEV_UP event was received for this slave interfac. As result, each
> NETDEV_UP would schedule a new OGM worker for the interface and thus OGMs
> would be send a lot more than expected.
>
> Fixes: 0d8468553c3c ("batman-adv: remove ogm_emit and ogm_schedule API calls")
> Reported-by: Linus Lüssing <linus.luessing@c0d3.blue>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
Tested-by: Linus Lüssing <linus.luessing@c0d3.blue>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-02 10:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-02 9:51 [PATCH maint v2] batman-adv: Fix duplicated OGMs on NETDEV_UP Sven Eckelmann
2019-06-02 10:16 ` Marek Lindner
2019-06-02 10:52 ` Linus Lüssing
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox