public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: deselect current GW on client mode switch off
@ 2013-10-26  7:59 Antonio Quartulli
  2013-10-27  9:46 ` Marek Lindner
  0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2013-10-26  7:59 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Antonio Quartulli

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

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

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
---
 gateway_client.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gateway_client.c b/gateway_client.c
index 2449afa..2903bdb 100644
--- a/gateway_client.c
+++ b/gateway_client.c
@@ -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
 	 */
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: deselect current GW on client mode switch off
  2013-10-26  7:59 [B.A.T.M.A.N.] [PATCH] batman-adv: deselect current GW on client mode switch off Antonio Quartulli
@ 2013-10-27  9:46 ` Marek Lindner
  2013-10-27  9:53   ` Antonio Quartulli
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Lindner @ 2013-10-27  9:46 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 941 bytes --]

On Saturday 26 October 2013 09:59:03 Antonio Quartulli wrote:
> diff --git a/gateway_client.c b/gateway_client.c
> index 2449afa..2903bdb 100644
> --- a/gateway_client.c
> +++ b/gateway_client.c
> @@ -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

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: deselect current GW on client mode switch off
  2013-10-27  9:46 ` Marek Lindner
@ 2013-10-27  9:53   ` Antonio Quartulli
  0 siblings, 0 replies; 3+ messages in thread
From: Antonio Quartulli @ 2013-10-27  9:53 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 1449 bytes --]

On Sun, Oct 27, 2013 at 05:46:13PM +0800, Marek Lindner wrote:
> On Saturday 26 October 2013 09:59:03 Antonio Quartulli wrote:
> > diff --git a/gateway_client.c b/gateway_client.c
> > index 2449afa..2903bdb 100644
> > --- a/gateway_client.c
> > +++ b/gateway_client.c
> > @@ -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 ?

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..)

> 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,

-- 
Antonio Quartulli

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-10-27  9:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-26  7:59 [B.A.T.M.A.N.] [PATCH] batman-adv: deselect current GW on client mode switch off Antonio Quartulli
2013-10-27  9:46 ` Marek Lindner
2013-10-27  9:53   ` Antonio Quartulli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox