Message ID | 1349124808-15995-1-git-send-email-siwu@hrz.tu-chemnitz.de (mailing list archive) |
---|---|
State | RFC, archived |
Headers |
Return-Path: <simon.wunderlich@s2003.tu-chemnitz.de> Received: from nick.hrz.tu-chemnitz.de (nick.hrz.tu-chemnitz.de [134.109.228.11]) by open-mesh.org (Postfix) with ESMTPS id 70909600F38 for <b.a.t.m.a.n@lists.open-mesh.org>; Mon, 1 Oct 2012 22:54:06 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass reason="1024-bit key; insecure key" header.i=@tu-chemnitz.de header.b=JiDQ2fNX; dkim-adsp=none (insecure policy); dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tu-chemnitz.de; s=dkim2010; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=UuQZmB8LNhcKq67kLqrfLexouVLwjj6nHJxlcXRB9vY=; b=JiDQ2fNX+5i4K6ZDtM61ldjAEzmWZx6iadDhLJjFe+7yekipqvY0JT7viT/mB1DZ47N+5i2X3v/8NNWvyKSC/FQWdvJkudORmxPuM2NtudHfCTjjPj6yAFaWqz4Pdhg3S7bx0qFIKLkDnHEpHe3CE7863N8LqBb5PMX8fpZcHPc=; Received: from p57aa07bd.dip0.t-ipconnect.de ([87.170.7.189] helo=pandem0nium) by nick.hrz.tu-chemnitz.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.80) (envelope-from <simon.wunderlich@s2003.tu-chemnitz.de>) id 1TIn09-0006Gr-76; Mon, 01 Oct 2012 22:54:05 +0200 Received: from dotslash by pandem0nium with local (Exim 4.72) (envelope-from <simon.wunderlich@s2003.tu-chemnitz.de>) id 1TImzx-0004Af-65; Mon, 01 Oct 2012 22:53:53 +0200 From: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> To: b.a.t.m.a.n@lists.open-mesh.org Date: Mon, 1 Oct 2012 22:53:28 +0200 Message-Id: <1349124808-15995-1-git-send-email-siwu@hrz.tu-chemnitz.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1347712461-9031-1-git-send-email-ordex@autistici.org> References: <1347712461-9031-1-git-send-email-ordex@autistici.org> X-purgate: clean X-purgate-type: clean X-purgate-ID: 154106::1349124845-00005E5D-9450FCA7/0-0/0-0 X-Scan-AV: nick.hrz.tu-chemnitz.de; 2012-10-01 22:54:05; 7d8f5a125b3c5b7a8fc1785ec6cf5db0 X-Scan-SA: nick.hrz.tu-chemnitz.de; 2012-10-01 22:54:05; 6ead96b075029816c692473b0a23944d X-Spam-Score: -1.0 (-) X-Spam-Report: --- Textanalyse SpamAssassin 3.3.1 (-1.0 Punkte) Fragen an/questions to: Postmaster TU Chemnitz <postmaster@tu-chemnitz.de> * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP --- Ende Textanalyse Cc: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Subject: [B.A.T.M.A.N.] [RFC] batman-adv: dirty hack to recompute mac_len in the rx path X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking <b.a.t.m.a.n@lists.open-mesh.org> List-Id: The list for a Better Approach To Mobile Ad-hoc Networking <b.a.t.m.a.n.lists.open-mesh.org> List-Unsubscribe: <https://lists.open-mesh.org/mm/options/b.a.t.m.a.n>, <mailto:b.a.t.m.a.n-request@lists.open-mesh.org?subject=unsubscribe> List-Archive: <http://lists.open-mesh.org/pipermail/b.a.t.m.a.n/> List-Post: <mailto:b.a.t.m.a.n@lists.open-mesh.org> List-Help: <mailto:b.a.t.m.a.n-request@lists.open-mesh.org?subject=help> List-Subscribe: <https://lists.open-mesh.org/mm/listinfo/b.a.t.m.a.n>, <mailto:b.a.t.m.a.n-request@lists.open-mesh.org?subject=subscribe> X-List-Received-Date: Mon, 01 Oct 2012 20:54:06 -0000 |
Commit Message
Simon Wunderlich
Oct. 1, 2012, 8:53 p.m. UTC
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.
This is done by appending the recompute function to the skb_share_mac()
function, hence the "dirty hack" in the subject. We expect this problem to
be fixed in linux 3.8 and above.
Reported-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
---
this is a rewrite of Antonios patch
"batman-adv: recompute mac_len at the beginning of the rx path". It is
intended to fix the issue for out-of-kernel releases, without hurting
the in-kernel code too much. Obviously, this patch won't go upstream
into the kernel.
---
compat.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
Comments
On Tuesday, October 02, 2012 04:53:28 Simon Wunderlich wrote: > +#define skb_share_check(skb, b) \ > + skb_share_check(skb, b); \ > + if (skb) \ > + skb_reset_mac_len(skb) > + > +#endif /* < KERNEL_VERSION(3, 8, 0) */ Has this patch been tested ? Our skb_share_check() call is this: skb = skb_share_check(skb, GFP_ATOMIC); Now we replace this function call with 2 function calls and 2 return values ? Cheers, Marek
On Monday 01 October 2012 22:53:28 Simon Wunderlich wrote: > 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. > > This is done by appending the recompute function to the skb_share_mac() > function, hence the "dirty hack" in the subject. We expect this problem to > be fixed in linux 3.8 and above. > > Reported-by: Antonio Quartulli <ordex@autistici.org> > Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> > --- > > this is a rewrite of Antonios patch > "batman-adv: recompute mac_len at the beginning of the rx path". It is > intended to fix the issue for out-of-kernel releases, without hurting > the in-kernel code too much. Obviously, this patch won't go upstream > into the kernel. > --- > compat.h | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/compat.h b/compat.h > index 14969e0..dca9685 100644 > --- a/compat.h > +++ b/compat.h > @@ -159,4 +159,19 @@ static inline void eth_hw_addr_random(struct net_device > *dev) > > #endif /* < KERNEL_VERSION(3, 5, 0) */ > > +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0) > + > +/* hack for not correctly set mac_len. This may happen for some special > + * configurations like batman-adv on VLANs. > + * > + * This is pretty dirty, but we only use skb_share_check() in main.c right > + * before mac_len is checked, and the recomputation shouldn't hurt too > much. + */ > +#define skb_share_check(skb, b) \ > + skb_share_check(skb, b); \ > + if (skb) \ > + skb_reset_mac_len(skb) > + > +#endif /* < KERNEL_VERSION(3, 8, 0) */ > + > #endif /* _NET_BATMAN_ADV_COMPAT_H_ */ Can we try a more sane solution like #define skb_share_check(skb, b) \ ({ \ struct sk_buff *_t_skb; \ _t_skb = skb_share_check(skb, b); \ if (_t_skb) \ skb_reset_mac_len(_t_skb); \ _t_skb; \ }) Please test whether this thing really works and compiles. I just wrote it doing something else and never compiled it. Kind regards, Sven
On Sunday, October 14, 2012 20:46:57 Simon Wunderlich wrote: > 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. > > This is done by appending the recompute function to the skb_share_mac() > function, hence the "dirty hack" in the subject. We expect this problem to > be fixed in linux 3.8 and above. > > Reported-by: Antonio Quartulli <ordex@autistici.org> > Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> > --- > > this is a rewrite of Antonios patch > "batman-adv: recompute mac_len at the beginning of the rx path". It is > intended to fix the issue for out-of-kernel releases, without hurting > the in-kernel code too much. Obviously, this patch won't go upstream > into the kernel. > > This version includes Svens "more sane" version, and also has implements > skb_reset_mac_len() for kernels prior to 3.0. > --- > compat.h | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) Applied in revision a6ad857. Thanks, Marek
diff --git a/compat.h b/compat.h index 14969e0..dca9685 100644 --- a/compat.h +++ b/compat.h @@ -159,4 +159,19 @@ static inline void eth_hw_addr_random(struct net_device *dev) #endif /* < KERNEL_VERSION(3, 5, 0) */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0) + +/* hack for not correctly set mac_len. This may happen for some special + * configurations like batman-adv on VLANs. + * + * This is pretty dirty, but we only use skb_share_check() in main.c right + * before mac_len is checked, and the recomputation shouldn't hurt too much. + */ +#define skb_share_check(skb, b) \ + skb_share_check(skb, b); \ + if (skb) \ + skb_reset_mac_len(skb) + +#endif /* < KERNEL_VERSION(3, 8, 0) */ + #endif /* _NET_BATMAN_ADV_COMPAT_H_ */