When there is a ptype handler holding a clone of this skb, whose
destination MAC addresse is overwritten, the owner of this handler may
get a corrupted packet.
Signed-off-by: Changli Gao <redacted>
---
v2: fix the bug in the previous one. Thank him.
drivers/net/bonding/bond_main.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
From: Eric Dumazet <hidden> Date: 2011-03-03 07:55:06
Le jeudi 03 mars 2011 à 15:07 +0800, Changli Gao a écrit :
quoted hunk
When there is a ptype handler holding a clone of this skb, whose
destination MAC addresse is overwritten, the owner of this handler may
get a corrupted packet.
Signed-off-by: Changli Gao <redacted>
---
v2: fix the bug in the previous one. Thank him.
drivers/net/bonding/bond_main.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Thats minor, but using :
u16 *dest = eth_hdr(skb)->h_dest;
memcpy(dest, ptr, ETH_ALEN);
Is better because compiler knows both destination and source are at
least aligned on shorts.
On some arches, it helps to not using 6 bytes copy, but 3 shorts.
On Thu, Mar 3, 2011 at 3:55 PM, Eric Dumazet [off-list ref] wrote:
Thats minor, but using :
u16 *dest = eth_hdr(skb)->h_dest;
memcpy(dest, ptr, ETH_ALEN);
Is better because compiler knows both destination and source are at
least aligned on shorts.
On some arches, it helps to not using 6 bytes copy, but 3 shorts.
Is it still true if ptr isn't aligned on shorts? And
net_device.dev_addr is an unsigned char *pointer. Thanks.
--
Regards,
Changli Gao(xiaosuo@gmail.com)
From: Eric Dumazet <hidden> Date: 2011-03-03 08:35:08
Le jeudi 03 mars 2011 à 16:21 +0800, Changli Gao a écrit :
On Thu, Mar 3, 2011 at 3:55 PM, Eric Dumazet [off-list ref] wrote:
quoted
Thats minor, but using :
u16 *dest = eth_hdr(skb)->h_dest;
memcpy(dest, ptr, ETH_ALEN);
Is better because compiler knows both destination and source are at
least aligned on shorts.
On some arches, it helps to not using 6 bytes copy, but 3 shorts.
Is it still true if ptr isn't aligned on shorts? And
net_device.dev_addr is an unsigned char *pointer. Thanks.
dev_addr[] was aligned to word boundaries (because of natural structure
alignment), but the recent changes made it a char *pointer, so gcc is
not able to make this true anymore.
This could change if dev_addr was a pointer to struct netdev_hw_addr
When there is a ptype handler holding a clone of this skb, whose
destination MAC addresse is overwritten, the owner of this handler may
get a corrupted packet.
Signed-off-by: Changli Gao <redacted>