From: Max Krasnyansky <maxk@qualcomm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: steve.zabele@baesystems.com, bugme-daemon@bugzilla.kernel.org,
netdev@vger.kernel.org
Subject: Re: [Bugme-new] [Bug 9888] New: tun device without protocol info header fails under IPv6
Date: Thu, 07 Feb 2008 20:58:04 -0800 [thread overview]
Message-ID: <47ABE15C.3090606@qualcomm.com> (raw)
In-Reply-To: <20080204145304.f4921bf4.akpm@linux-foundation.org>
Andrew Morton wrote:
> On Mon, 4 Feb 2008 13:46:13 -0800 (PST)
> bugme-daemon@bugzilla.kernel.org wrote:
>>
>> Open a tun device as type TUN, set the TUN_NO_PI flag, and try sending an IPv6
>> packet. The packet appears at the interface under tcpdumps, but propagates no
>> further. This is because the default protocol info used for tun devices where
>> the TUN_NO_PI flag is set assumes IPv4 as can be seen by the initialization at
>> the top of the tun_get_user function in drivers/net/tun.c file given by
>>
>> struct tun_pi pi = { 0, __constant_htons(ETH_P_IP) };
>>
>> This can easily be fixed by adding a quick check at the top of tun_get_user.
>> Basically the code that used to read
>>
>> if (!(tun->flags & TUN_NO_PI)) {
>> if ((len -= sizeof(pi)) > count)
>> return -EINVAL;
>>
>> if(memcpy_fromiovec((void *)&pi, iv, sizeof(pi)))
>> return -EFAULT;
>> }
>>
>> when changed to read
>>
>> if (!(tun->flags & TUN_NO_PI)) {
>> if ((len -= sizeof(pi)) > count)
>> return -EINVAL;
>>
>> if(memcpy_fromiovec((void *)&pi, iv, sizeof(pi)))
>> return -EFAULT;
>> }
>> else {
>> /* Fixup default pi if IPv6 rather than IPv4 */
>> if (((tun->flags & TUN_TYPE_MASK) == TUN_TUN_DEV) &&
>> (*(char *)(iv->iov_base) == 0x60)) {
>> pi.proto = __constant_htons(ETH_P_IPV6);
>> }
>> }
>>
>> fixes the problem.
>>
>> How do we get this in as part of the maintained codebase??
>>
>
> Please email a tested patch prepared as described in
>
> Documentation/SubmittingPatches
> Documentation/SubmitChecklist
> http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt
>
> to
>
> Maxim Krasnyansky <maxk@qualcomm.com>
> "David S. Miller" <davem@davemloft.net>
> Andrew Morton <akpm@linux-foundation.org>
> netdev@vger.kernel.org
btw I'd be ok with this fix. But I guess the questions is why not use
struct tun_pi in the apps instead ?
Max
prev parent reply other threads:[~2008-02-08 5:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-9888-10286@http.bugzilla.kernel.org/>
2008-02-04 22:53 ` [Bugme-new] [Bug 9888] New: tun device without protocol info header fails under IPv6 Andrew Morton
2008-02-08 4:58 ` Max Krasnyansky [this message]
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=47ABE15C.3090606@qualcomm.com \
--to=maxk@qualcomm.com \
--cc=akpm@linux-foundation.org \
--cc=bugme-daemon@bugzilla.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=steve.zabele@baesystems.com \
/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;
as well as URLs for NNTP newsgroup(s).