Skip to contentSkip to conversation

batman-adv: invoke ogm_schedule() only when the interface is activated

RFC New Antonio Quartulli 1 participant 1 message Feb 10, 2014

lore
Share & tools
lore
#0 lore raw

RFC 1/1 batman-adv: invoke ogm_schedule() only when the interface is activated

From: Antonio Quartulli <[email protected]>

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. The B.A.T.M.A.N. IV scheduling mechanism works in a way that reschedules the task forever even if the interface is not active and therefore everything works as expected.

Unfortunately this behaviour is not fine for other algorithms which may expect the interface to be active before scheduling the first OGM.

Therefore change this behaviour by scheduling the first OGM on interface activation.

---
 hard-interface.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
hard-interface.c +2 -3
index b851cc5..2a04130 100644
@@ -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;
 
Signature · 1 line
1.8.5.4