b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: Fix change mac address of soft iface.
@ 2012-09-18 14:41 Def
  2012-09-18 14:55 ` Sven Eckelmann
  0 siblings, 1 reply; 7+ messages in thread
From: Def @ 2012-09-18 14:41 UTC (permalink / raw)
  To: b.a.t.m.a.n

 Into function interface_set_mac_addr, the function tt_local_add
 was invoked before updating dev->dev_addr. The new MAC
 addresse was not tagged as NoPurge.

---
 soft-interface.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/soft-interface.c b/soft-interface.c
index cf26e41..1345b86
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -100,18 +100,21 @@ static int batadv_interface_set_mac_addr(struct
net_device *dev, void *p)
 {
 	struct batadv_priv *bat_priv = netdev_priv(dev);
 	struct sockaddr *addr = p;
+	uint8_t old_addr[ETH_ALEN];

 	if (!is_valid_ether_addr(addr->sa_data))
 		return -EADDRNOTAVAIL;

+	memcpy(old_addr, dev->dev_addr, ETH_ALEN);
+	memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+
 	/* only modify transtable if it has been initialized before */
 	if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE) {
-		batadv_tt_local_remove(bat_priv, dev->dev_addr,
+		batadv_tt_local_remove(bat_priv, old_addr,
 				       "mac address changed", false);
 		batadv_tt_local_add(dev, addr->sa_data, BATADV_NULL_IFINDEX);
 	}
-
-	memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+	
 	dev->addr_assign_type &= ~NET_ADDR_RANDOM;
 	return 0;
 }
-- 
1.7.10.4

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

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: Fix change mac address of soft iface.
  2012-09-18 14:41 [B.A.T.M.A.N.] [PATCH] batman-adv: Fix change mac address of soft iface Def
@ 2012-09-18 14:55 ` Sven Eckelmann
  2012-09-20 11:42   ` Antonio Quartulli
  0 siblings, 1 reply; 7+ messages in thread
From: Sven Eckelmann @ 2012-09-18 14:55 UTC (permalink / raw)
  To: b.a.t.m.a.n

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

On Tuesday 18 September 2012 16:41:58 Def wrote:
>  Into function interface_set_mac_addr, the function tt_local_add
>  was invoked before updating dev->dev_addr. The new MAC
>  addresse was not tagged as NoPurge.
> 

Please don't add extra whitespaces before your commit message.

Your Signed-off-by: is missing.

[...]
> -
> -	memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
> +	

Please don't add trailing whitespaces.

I have no idea whether this works... *looks at Antonio*. But thanks for
bringing this up in the issue tracker and sending this first version of the
patch.

The problems mentioned here can be found using
checkpatch/cppcheck/sparse/smatch [1]. We need to drop this patch due to these
problems because the next authorities (David S. Miller/Linus Torvalds/...)
would not be happy when we forward them this version of the patch.

Kind regards,
	Sven

[1] http://www.open-mesh.org/projects/open-mesh/wiki/Contribute#Submitting-patches

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

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

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: Fix change mac address of soft iface.
  2012-09-18 14:55 ` Sven Eckelmann
@ 2012-09-20 11:42   ` Antonio Quartulli
  2012-09-20 12:56     ` [B.A.T.M.A.N.] [PATCHv2] " Def
  0 siblings, 1 reply; 7+ messages in thread
From: Antonio Quartulli @ 2012-09-20 11:42 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

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

Hello Def,


On Tue, Sep 18, 2012 at 04:55:32PM +0200, Sven Eckelmann wrote:
> On Tuesday 18 September 2012 16:41:58 Def wrote:
> >  Into function interface_set_mac_addr, the function tt_local_add
> >  was invoked before updating dev->dev_addr. The new MAC
> >  addresse was not tagged as NoPurge.
> > 
> 
> Please don't add extra whitespaces before your commit message.
> 
> Your Signed-off-by: is missing.
> 
> [...]
> > -
> > -	memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
> > +	
> 
> Please don't add trailing whitespaces.
> 
> I have no idea whether this works... *looks at Antonio*. But thanks for
> bringing this up in the issue tracker and sending this first version of the
> patch.

sorry for the delay. Overall the patch is correct, I also tested it and it
correctly fixes the problem.

Please, address what Sven just said so that the patch is clean (you can also use
checkpatch.pl --strict to check for this style things..it is in your
linux/scripts/ directory as documented in the file cited by Sven)

Cheers,


-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

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

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

* [B.A.T.M.A.N.] [PATCHv2] batman-adv: Fix change mac address of soft iface.
  2012-09-20 11:42   ` Antonio Quartulli
@ 2012-09-20 12:56     ` Def
  2012-09-20 18:10       ` Antonio Quartulli
                         ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Def @ 2012-09-20 12:56 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

Into function interface_set_mac_addr, the function tt_local_add was
invoked before updating dev->dev_addr. The new MAC address was not
tagged as NoPurge.

Signed-off-by: Def <def@laposte.net>
---
 soft-interface.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/soft-interface.c b/soft-interface.c
index cf26e41..1345b86
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -100,18 +100,21 @@ static int batadv_interface_set_mac_addr(struct
net_device *dev, void *p)
 {
 	struct batadv_priv *bat_priv = netdev_priv(dev);
 	struct sockaddr *addr = p;
+	uint8_t old_addr[ETH_ALEN];

 	if (!is_valid_ether_addr(addr->sa_data))
 		return -EADDRNOTAVAIL;

+	memcpy(old_addr, dev->dev_addr, ETH_ALEN);
+	memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+
 	/* only modify transtable if it has been initialized before */
 	if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE) {
-		batadv_tt_local_remove(bat_priv, dev->dev_addr,
+		batadv_tt_local_remove(bat_priv, old_addr,
 				       "mac address changed", false);
 		batadv_tt_local_add(dev, addr->sa_data, BATADV_NULL_IFINDEX);
 	}
-
-	memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+
 	dev->addr_assign_type &= ~NET_ADDR_RANDOM;
 	return 0;
 }
-- 
1.7.10.4

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

* Re: [B.A.T.M.A.N.] [PATCHv2] batman-adv: Fix change mac address of soft iface.
  2012-09-20 12:56     ` [B.A.T.M.A.N.] [PATCHv2] " Def
@ 2012-09-20 18:10       ` Antonio Quartulli
  2012-09-23  8:42       ` Sven Eckelmann
  2012-09-23  9:34       ` Marek Lindner
  2 siblings, 0 replies; 7+ messages in thread
From: Antonio Quartulli @ 2012-09-20 18:10 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

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

On Thu, Sep 20, 2012 at 02:56:13PM +0200, Def wrote:
> Into function interface_set_mac_addr, the function tt_local_add was
> invoked before updating dev->dev_addr. The new MAC address was not
> tagged as NoPurge.
> 
> Signed-off-by: Def <def@laposte.net>

Acked by: Antonio Quartulli <ordex@autistici.org>


-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

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

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

* Re: [B.A.T.M.A.N.] [PATCHv2] batman-adv: Fix change mac address of soft iface.
  2012-09-20 12:56     ` [B.A.T.M.A.N.] [PATCHv2] " Def
  2012-09-20 18:10       ` Antonio Quartulli
@ 2012-09-23  8:42       ` Sven Eckelmann
  2012-09-23  9:34       ` Marek Lindner
  2 siblings, 0 replies; 7+ messages in thread
From: Sven Eckelmann @ 2012-09-23  8:42 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

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

On Thursday 20 September 2012 14:56:13 Def wrote:
> Into function interface_set_mac_addr, the function tt_local_add was
> invoked before updating dev->dev_addr. The new MAC address was not
> tagged as NoPurge.
> 
> Signed-off-by: Def <def@laposte.net>
> ---
>  soft-interface.c |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/soft-interface.c b/soft-interface.c
> index cf26e41..1345b86
> --- a/soft-interface.c
> +++ b/soft-interface.c
> @@ -100,18 +100,21 @@ static int batadv_interface_set_mac_addr(struct
> net_device *dev, void *p)
>  {
>  	struct batadv_priv *bat_priv = netdev_priv(dev);
>  	struct sockaddr *addr = p;
> +	uint8_t old_addr[ETH_ALEN];
> 
>  	if (!is_valid_ether_addr(addr->sa_data))
>  		return -EADDRNOTAVAIL;
> 
> +	memcpy(old_addr, dev->dev_addr, ETH_ALEN);
> +	memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
> +
>  	/* only modify transtable if it has been initialized before */
>  	if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE) {
> -		batadv_tt_local_remove(bat_priv, dev->dev_addr,
> +		batadv_tt_local_remove(bat_priv, old_addr,
>  				       "mac address changed", false);
>  		batadv_tt_local_add(dev, addr->sa_data, BATADV_NULL_IFINDEX);
>  	}
> -
> -	memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
> +
>  	dev->addr_assign_type &= ~NET_ADDR_RANDOM;
>  	return 0;
>  }


Your patch is malformed:

Applying: batman-adv: Fix change mac address of soft iface.
fatal: corrupt patch at line 10
Patch failed at 0001 batman-adv: Fix change mac address of soft iface.
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".

Please use a mailer that doesn't eat the patch. For more information read 
http://os1a.cs.columbia.edu/lxr/source/Documentation/email-clients.txt

I personally prefer to use git-send-email with msmtp

Kind regards,
	Sven

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

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

* Re: [B.A.T.M.A.N.] [PATCHv2] batman-adv: Fix change mac address of soft iface.
  2012-09-20 12:56     ` [B.A.T.M.A.N.] [PATCHv2] " Def
  2012-09-20 18:10       ` Antonio Quartulli
  2012-09-23  8:42       ` Sven Eckelmann
@ 2012-09-23  9:34       ` Marek Lindner
  2 siblings, 0 replies; 7+ messages in thread
From: Marek Lindner @ 2012-09-23  9:34 UTC (permalink / raw)
  To: Def; +Cc: The list for a Better Approach To Mobile Ad-hoc Networking

On Thursday, September 20, 2012 20:56:13 Def wrote:
> Into function interface_set_mac_addr, the function tt_local_add was
> invoked before updating dev->dev_addr. The new MAC address was not
> tagged as NoPurge.
> 
> Signed-off-by: Def <def@laposte.net>
> ---
>  soft-interface.c |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

As Sven already mentioned there is a small problem with your patch. I manually 
fixed it and applied the patch in revision 86fa71a. Please send correct 
patches next time.

Thanks for your fix!

Cheers,
Marek

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

end of thread, other threads:[~2012-09-23  9:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-18 14:41 [B.A.T.M.A.N.] [PATCH] batman-adv: Fix change mac address of soft iface Def
2012-09-18 14:55 ` Sven Eckelmann
2012-09-20 11:42   ` Antonio Quartulli
2012-09-20 12:56     ` [B.A.T.M.A.N.] [PATCHv2] " Def
2012-09-20 18:10       ` Antonio Quartulli
2012-09-23  8:42       ` Sven Eckelmann
2012-09-23  9:34       ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).