Skip to contentSkip to conversation

batman-adv: deselect current GW on client mode switch off

PATCH Superseded Antonio Quartulli 2 participants 3 messages Oct 26, 2013 – Oct 27, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 batman-adv: deselect current GW on client mode switch off

From: Antonio Quartulli <[email protected]>

When switching from gw_mode client to either off or server the current selected gateway has to be deselected. In this way when client mode is enabled again a gateway re-election is forced and a GW_ADD event is consequently sent.

The current behaviour instead is to keep the current gateway leading to no GW_ADD event when gw_mode client is selected for a second time

---
 gateway_client.c | 4 ++++
 1 file changed, 4 insertions(+)
gateway_client.c +4 -0
index 2449afa..2903bdb 100644
@@ -207,6 +207,10 @@ void batadv_gw_check_client_stop(struct batadv_priv *bat_priv)
 	if (!curr_gw)
 		return;
 
+	/* deselect the current gateway so that next time that client mode is
+	 * enabled a proper GW_ADD event can be sent */
+	batadv_gw_select(bat_priv, NULL);
+
 	/* if batman-adv is switching the gw client mode off and a gateway was
 	 * already selected, send a DEL uevent
 	 */
Signature · 1 line
1.8.4
#1 lore raw
Quoted 5 lines · On Saturday 26 October 2013 09:59:03 Antonio Quartulli wrote:
gateway_client.c +0 -0
index 2449afa..2903bdb 100644

gateway_client.c void batadv_gw_check_client_stop(struct batadv_priv · line 216

Quoted 10 lines
gateway_client.c +4 -0
@@ -207,6 +207,10 @@ void batadv_gw_check_client_stop(struct batadv_priv
 *bat_priv) if (!curr_gw)
 		return;
 
+	/* deselect the current gateway so that next time that client mode is
+	 * enabled a proper GW_ADD event can be sent */
+	batadv_gw_select(bat_priv, NULL);
+
 	/* if batman-adv is switching the gw client mode off and a gateway was
 	 * already selected, send a DEL uevent
 	 */

Right above the batadv_gw_check_client_stop() call in batadv_store_gw_mode() a very similar function is called: batadv_gw_deselect().

Calling batadv_gw_deselect() is not enough to ensure an ADD event is sent ? In case the old gateway == new gateway we have no event ? If so, that should be documented somehwere ..

Cheers,
Marek

#2 lore raw
Quoted 20 lines · Marek Lindner
Quoted 5 lines · On Saturday 26 October 2013 09:59:03 Antonio Quartulli wrote:
gateway_client.c +0 -0
index 2449afa..2903bdb 100644

gateway_client.c void batadv_gw_check_client_stop(struct batadv_priv · line 216

Quoted 10 lines
gateway_client.c +4 -0
@@ -207,6 +207,10 @@ void batadv_gw_check_client_stop(struct batadv_priv
 *bat_priv) if (!curr_gw)
 		return;
 
+	/* deselect the current gateway so that next time that client mode is
+	 * enabled a proper GW_ADD event can be sent */
+	batadv_gw_select(bat_priv, NULL);
+
 	/* if batman-adv is switching the gw client mode off and a gateway was
 	 * already selected, send a DEL uevent
 	 */

Right above the batadv_gw_check_client_stop() call in batadv_store_gw_mode() a very similar function is called: batadv_gw_deselect().

Quoted 1 line

Calling batadv_gw_deselect() is not enough to ensure an ADD event is sent ?

no. this function is used in several points and it is just an indicator that tells the GW code to perform a re-election. It does not guarantee that an event is going to be sent (on re-election the same GW could be elected once again..)

Quoted 3 lines

In
case the old gateway == new gateway we have no event ? If so, that should be documented somehwere ..

did you expect an event in case of (old gw == new gw) ? It's neither an ADD nor a CHANGE nor a DEL...

Cheers,

Signature · 1 line
Antonio Quartulli