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 maint] batman-adv: properly push NET_IP_ALIGN bytes more
@ 2013-04-02 11:59 Antonio Quartulli
  2013-04-02 15:19 ` Antonio Quartulli
  0 siblings, 1 reply; 2+ messages in thread
From: Antonio Quartulli @ 2013-04-02 11:59 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Antonio Quartulli

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

every batman-adv encapsulated packet is supposed to begin
with an Ethernet header plus 2 bytes for correct alignment
on 4 bytes boundary.

However, even if allocations are made correctly, the final
encapsulation is not made properly since the encapsulating
function does not push NET_IP_ALIGN bytes other than
ETH_HLEN.

Fix it by pushing the correct amount of bytes.

Introduced by 7f91790974c258e71a62f6dee8cb1dbe5dff36c3
("batman-adv: Reserve extra bytes in skb for better alignment")

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
---

Please review this patch as I am not 100% sure this is correct.
What I understood is that any batman-adv should have this shape:

+--------------+
| ETH_HEADER   |
|              |
+--------------+
| NET_IP_ALIGN |
+--------------+
| BATADV_HEADER|
+--------------+
| ...          |

but by pushing ETH_HLEN only, we end up in a shorter packet, because the head
pointer is not moved up enough to contain the NET_IP_ALIGN bytes too (so we are
back to the situation where our headers are not properly placed in memory).

Cheers,


 send.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/send.c b/send.c
index a67cffd..a338093 100644
--- a/send.c
+++ b/send.c
@@ -54,7 +54,7 @@ int batadv_send_skb_packet(struct sk_buff *skb,
 	}
 
 	/* push to the ethernet header. */
-	if (batadv_skb_head_push(skb, ETH_HLEN) < 0)
+	if (batadv_skb_head_push(skb, ETH_HLEN + NET_IP_ALIGN) < 0)
 		goto send_skb_err;
 
 	skb_reset_mac_header(skb);
-- 
1.8.1.5


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

* Re: [B.A.T.M.A.N.] [PATCH maint] batman-adv: properly push NET_IP_ALIGN bytes more
  2013-04-02 11:59 [B.A.T.M.A.N.] [PATCH maint] batman-adv: properly push NET_IP_ALIGN bytes more Antonio Quartulli
@ 2013-04-02 15:19 ` Antonio Quartulli
  0 siblings, 0 replies; 2+ messages in thread
From: Antonio Quartulli @ 2013-04-02 15:19 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Antonio Quartulli

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

On Tue, Apr 02, 2013 at 01:59:35PM +0200, Antonio Quartulli wrote:
> From: Antonio Quartulli <antonio@open-mesh.com>
> 
> every batman-adv encapsulated packet is supposed to begin
> with an Ethernet header plus 2 bytes for correct alignment
> on 4 bytes boundary.
> 
> However, even if allocations are made correctly, the final
> encapsulation is not made properly since the encapsulating
> function does not push NET_IP_ALIGN bytes other than
> ETH_HLEN.
> 
> Fix it by pushing the correct amount of bytes.
> 
> Introduced by 7f91790974c258e71a62f6dee8cb1dbe5dff36c3
> ("batman-adv: Reserve extra bytes in skb for better alignment")
> 
> Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>

This patch can be dropped.
We don't want to send those two extra bytes, we use them only for local memory
alignment.

Sorry about that.

Cheers,

-- 
Antonio Quartulli

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

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

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

end of thread, other threads:[~2013-04-02 15:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-02 11:59 [B.A.T.M.A.N.] [PATCH maint] batman-adv: properly push NET_IP_ALIGN bytes more Antonio Quartulli
2013-04-02 15:19 ` Antonio Quartulli

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