From: Eric Dumazet <eric.dumazet@gmail.com>
To: artem.bityutskiy@linux.intel.com
Cc: Eric Dumazet <edumazet@google.com>,
Johannes Berg <johannes@sipsolutions.net>,
linux-wireless@vger.kernel.org, netdev <netdev@vger.kernel.org>
Subject: Re: regression: tethering fails in 3.5 with iwlwifi
Date: Thu, 20 Sep 2012 16:25:49 +0200 [thread overview]
Message-ID: <1348151149.31352.109.camel@edumazet-glaptop> (raw)
In-Reply-To: <1348147353.2388.19.camel@sauron.fi.intel.com>
On Thu, 2012-09-20 at 16:22 +0300, Artem Bityutskiy wrote:
> On Thu, 2012-09-20 at 15:04 +0200, Eric Dumazet wrote:
> > Try to pull 40 bytes : Thats OK for tcp performance, because 40 bytes
> > is the minimum size of IP+TCP headers
> >
> > pskb_may_pull(skb, 40);
>
> OK, I've tried almost this (see below) and it solves my issue:
>
> diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
> index 965e6ec..7f079d0 100644
> --- a/net/mac80211/rx.c
> +++ b/net/mac80211/rx.c
> @@ -1798,9 +1798,13 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
>
> if (skb) {
> /* deliver to local stack */
> - skb->protocol = eth_type_trans(skb, dev);
> - memset(skb->cb, 0, sizeof(skb->cb));
> - netif_receive_skb(skb);
> + if (pskb_may_pull(skb, 40)) {
> + skb->protocol = eth_type_trans(skb, dev);
> + memset(skb->cb, 0, sizeof(skb->cb));
> + netif_receive_skb(skb);
> + } else {
> + kfree_skb(skb);
> + }
> }
> }
>
Please remove this hack and try the following bugfix in raw handler
icmp_filter() should not modify skb, or else its caller should not
assume ip_hdr() is unchanged.
net/ipv4/raw.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index f242578..3fa8c96 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -128,25 +128,30 @@ found:
}
/*
- * 0 - deliver
- * 1 - block
+ * false - deliver
+ * true - block
*/
-static __inline__ int icmp_filter(struct sock *sk, struct sk_buff *skb)
+static bool icmp_filter(struct sock *sk, const struct sk_buff *skb)
{
- int type;
-
- if (!pskb_may_pull(skb, sizeof(struct icmphdr)))
- return 1;
-
- type = icmp_hdr(skb)->type;
- if (type < 32) {
+ __u8 _type;
+ const __u8 *type;
+
+ type = skb_header_pointer(skb,
+ skb_transport_offset(skb) +
+ offsetof(struct icmphdr, type),
+ sizeof(_type),
+ &_type);
+ if (!type)
+ return true;
+
+ if (*type < 32) {
__u32 data = raw_sk(sk)->filter.data;
- return ((1 << type) & data) != 0;
+ return ((1U << *type) & data) != 0;
}
/* Do not block unknown ICMP types */
- return 0;
+ return false;
}
/* IP input processing comes here for RAW socket delivery.
next prev parent reply other threads:[~2012-09-20 14:25 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1347361823.26457.3.camel@sauron.fi.intel.com>
[not found] ` <1DC40B07CD6EC041A66726C271A73AE6195AE9C8@IRSMSX102.ger.corp.intel.com>
[not found] ` <1347631355.5263.19.camel@sauron.fi.intel.com>
[not found] ` <1347640763.5263.24.camel@sauron.fi.intel.com>
[not found] ` <1347892887.7112.9.camel@sauron.fi.intel.com>
[not found] ` <1348142775.2388.10.camel@sauron.fi.intel.com>
2012-09-20 12:35 ` regression: tethering fails in 3.5 with iwlwifi Johannes Berg
[not found] ` <1348144524.4161.26.camel-8Nb76shvtaUJvtFkdXX2HixXY32XiHfO@public.gmane.org>
2012-09-20 12:40 ` Eric Dumazet
2012-09-20 12:45 ` Eric Dumazet
2012-09-20 12:46 ` Eric Dumazet
[not found] ` <CANn89iLnv2kWLd_hTpMXjMJ=r+hOvb2q2Oy6L-s5+6SzqxYvjA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-20 12:50 ` Johannes Berg
2012-09-20 12:47 ` Johannes Berg
[not found] ` <1348145269.4161.28.camel-8Nb76shvtaUJvtFkdXX2HixXY32XiHfO@public.gmane.org>
2012-09-20 12:48 ` Eric Dumazet
2012-09-20 12:50 ` Johannes Berg
[not found] ` <1348145450.4161.31.camel-8Nb76shvtaUJvtFkdXX2HixXY32XiHfO@public.gmane.org>
2012-09-20 12:51 ` Eric Dumazet
[not found] ` <CANn89iLudX29yU8ziNyN+8gN3b2L55L9m5p6ob_wnfZ3fp_TDg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-20 12:54 ` Johannes Berg
2012-09-20 12:51 ` Johannes Berg
[not found] ` <CANn89iKStHAwVZtpgQMzEpByGYG2FKpjSQsJFT-9qQmjw+KJ8g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-20 12:58 ` Artem Bityutskiy
[not found] ` <1348145936.2388.18.camel-Bxnoe/o8FG+Ef9UqXRslZEEOCMrvLtNR@public.gmane.org>
2012-09-20 13:04 ` Eric Dumazet
[not found] ` <CANn89i+9Th=xVgDgoy7tHwKtLNpOC8rgJkA09nQ1Yf0zvqBw6w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-20 13:15 ` Eric Dumazet
2012-09-20 13:22 ` Artem Bityutskiy
2012-09-20 13:22 ` Eric Dumazet
2012-09-20 14:25 ` Eric Dumazet [this message]
2012-09-21 17:24 ` David Miller
[not found] ` <CANn89iJkXrZPB14KU8xA-Dn8_n=H3J4-R60BTZFV+STF9_ASdA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-20 12:47 ` Johannes Berg
2013-03-21 19:34 ` Johannes Berg
2013-03-21 21:24 ` David Miller
[not found] ` <1363894451.8181.4.camel-8Nb76shvtaUJvtFkdXX2HixXY32XiHfO@public.gmane.org>
2013-03-22 7:01 ` Artem Bityutskiy
2013-03-23 15:45 ` Luis Henriques
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1348151149.31352.109.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=artem.bityutskiy@linux.intel.com \
--cc=edumazet@google.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox