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: recompute mac_len at the beginning of the rx path
@ 2012-09-15 12:34 Antonio Quartulli
  2012-09-29 11:27 ` Antonio Quartulli
  2012-10-01 20:53 ` [B.A.T.M.A.N.] [RFC] batman-adv: dirty hack to recompute mac_len in " Simon Wunderlich
  0 siblings, 2 replies; 9+ messages in thread
From: Antonio Quartulli @ 2012-09-15 12:34 UTC (permalink / raw)
  To: b.a.t.m.a.n

It is possible that the mac_len is not properly exported because of strange
device configuration (this behaviour has been observed when using batman-adv on
top of a vlan interface). Therefore it is needed to explicitly recompute it at
the very beginning of the rx path

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/main.c b/main.c
index f9bcfa1..4ef39b6 100644
--- a/main.c
+++ b/main.c
@@ -245,6 +245,12 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
 	if (unlikely(!pskb_may_pull(skb, 2)))
 		goto err_free;
 
+	/* sometimes the mac_len value is not properly computed (e.g. when using
+	 * batman-adv on top of a vlan interface), therefore we need to
+	 * explicitly recompute it here
+	 */
+	skb_reset_mac_len(skb);
+
 	/* expect a valid ethernet header here. */
 	if (unlikely(skb->mac_len != ETH_HLEN || !skb_mac_header(skb)))
 		goto err_free;
-- 
1.7.12


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

end of thread, other threads:[~2012-10-14 18:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-15 12:34 [B.A.T.M.A.N.] [PATCH] batman-adv: recompute mac_len at the beginning of the rx path Antonio Quartulli
2012-09-29 11:27 ` Antonio Quartulli
2012-10-01 20:56   ` Simon Wunderlich
2012-10-01 20:53 ` [B.A.T.M.A.N.] [RFC] batman-adv: dirty hack to recompute mac_len in " Simon Wunderlich
2012-10-02  5:16   ` Marek Lindner
2012-10-02  9:37     ` Simon Wunderlich
2012-10-06 16:45   ` Sven Eckelmann
2012-10-14 12:46     ` [B.A.T.M.A.N.] [PATCH] " Simon Wunderlich
2012-10-14 18:53       ` Marek Lindner

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