From: Vladis Dronov <vdronov@redhat.com>
To: David Miller <davem@davemloft.net>
Cc: kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org,
netdev@vger.kernel.org, syzkaller@googlegroups.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: arp, ipv6: handle special case of tap device
Date: Mon, 1 Oct 2018 07:32:32 -0400 (EDT) [thread overview]
Message-ID: <1615981257.17285278.1538393552487.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20180929.114023.1370133506922372520.davem@davemloft.net>
Hello, David, all,
> This is insanely ugly.
> I'm not applying this, sorry.
It is ugly, I agree.
> dev->type determines the link layer header layout and size.
Yes, unfortunately, TUNSETLINK ioctl handler does not adjust all the needed
fields after the tun->dev->type:
[drivers/net/tun.c]
case TUNSETLINK:
...
tun->dev->type = (int) arg; //<--- that's all
Let me share what I see and let me hope to get an advise for a better fix.
(also another related thread: https://marc.info/?t=153797194500007&r=1&w=2)
- So setting just the tun->dev->type makes the dev struct inconsistent.
- There are more field to adjust, at least dev->addr_len and dev->broadcast.
- There is no get_addr_len_by_link_type() or a simple way to get link layer
properties by dev->type. Such settings are scattered in *_setup and
*_init functions, like ipgre_tunnel_init() { ... dev->addr_len = 4; ...}
> I think tun/tap should be prevented from
> allowing the dev->type to be changed, unless it will make those changes
> adjust the link layer headers properly as well.
Probably, this functionality is already used by some userspace, so I believe,
I cannot just remove TUNSETLINK ioctl. Let me try to suggest a patch that
sets dev->addr_len and dev->broadcast (and probably other link-level-related)
fields according to the dev->type.
Best regards,
Vladis Dronov | Red Hat, Inc. | Product Security Engineer
next prev parent reply other threads:[~2018-10-01 11:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-26 9:30 [PATCH] net: arp, ipv6: handle special case of tap device Vladis Dronov
2018-09-29 18:40 ` David Miller
2018-10-01 11:32 ` Vladis Dronov [this message]
2018-10-03 5:25 ` David Miller
2018-10-03 13:25 ` Vladis Dronov
2018-10-03 16:37 ` David Miller
2018-10-04 9:53 ` Kalle Valo
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=1615981257.17285278.1538393552487.JavaMail.zimbra@redhat.com \
--to=vdronov@redhat.com \
--cc=davem@davemloft.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=syzkaller@googlegroups.com \
--cc=yoshfuji@linux-ipv6.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;
as well as URLs for NNTP newsgroup(s).