From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH] net: arp, ipv6: handle special case of tap device Date: Sat, 29 Sep 2018 11:40:23 -0700 (PDT) Message-ID: <20180929.114023.1370133506922372520.davem@davemloft.net> References: <20180926093018.6646-1-vdronov@redhat.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org, netdev@vger.kernel.org, syzkaller@googlegroups.com, linux-kernel@vger.kernel.org To: vdronov@redhat.com Return-path: In-Reply-To: <20180926093018.6646-1-vdronov@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org From: Vladis Dronov Date: Wed, 26 Sep 2018 11:30:18 +0200 > @@ -187,7 +187,14 @@ EXPORT_SYMBOL(arp_tbl); > > int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir) > { > - switch (dev->type) { > + unsigned short type = dev->type; > + > +#if IS_ENABLED(CONFIG_TAP) > + if (dev->rtnl_link_ops && !strcmp(dev->rtnl_link_ops->kind, "tun")) > + type = ARPHRD_ETHER; > +#endif /* CONFIG_TAP */ This is insanely ugly. dev->type determines the link layer header layout and size. You can fix the kernel, but userspace AF_PACKET applications are still going to be broken by this behavior. And that is just the tip of the iceberg. I'm not applying this, sorry. 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. Sorry.