[B.A.T.M.A.N.] [RFC 01/23] batman-adv: invoke ogm_schedule() only when the interface is activated

Antonio Quartulli
2014-02-11T12:48:01Z

From: Antonio Quartulli <antonio@open-mesh.com>

In the current implementation the first OGM is scheduled
when a new hard-interface is enabled, no matter if it is
active (thus ready for sending packets) or not.

However, the B.A.T.M.A.N. IV OGM scheduling mechanism works
in a way that reschedules the task forever even if the
interface is not yet ready and therefore everything works as
expected.

Unfortunately this behaviour is not fine in general and
other algorithms may pretend the interface to be active
before scheduling the first OGM.

Change this behaviour by scheduling the first OGM upon
interface activation.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
---
hard-interface.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/hard-interface.c b/hard-interface.c
index b851cc5..2a04130 100644
--- a/hard-interface.c
+++ b/hard-interface.c
@@ -320,6 +320,8 @@ batadv_hardif_activate_interface(struct batadv_hard_iface *hard_iface)

batadv_update_min_mtu(hard_iface->soft_iface);

+ /* begin scheduling originator messages on that interface */
+ batadv_schedule_bat_ogm(hard_iface);
out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
@@ -459,9 +461,6 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
"Not using interface %s (retrying later): interface not active\n",
hard_iface->net_dev->name);

- /* begin scheduling originator messages on that interface */
- batadv_schedule_bat_ogm(hard_iface);
-
out:
return 0;

--
1.8.5.3