From: Christoph Hellwig <h...@lst.de> Date: Thu, 14 May 2020 16:51:01 +0200
> Instead of going through the ioctl handler from kernel space, use > symbol_get to the newly factored out ipip6_set_dstaddr helper, bypassing > addrconf.c entirely. > > Signed-off-by: Christoph Hellwig <h...@lst.de> ... > - memset(&p, 0, sizeof(p)); > - p.iph.daddr = ireq.ifr6_addr.s6_addr32[3]; > - p.iph.saddr = 0; > - p.iph.version = 4; > - p.iph.ihl = 5; > - p.iph.protocol = IPPROTO_IPV6; > - p.iph.ttl = 64; > - ifr.ifr_ifru.ifru_data = (__force void __user *)&p; > - > - if (ops->ndo_do_ioctl) { > - mm_segment_t oldfs = get_fs(); > - > - set_fs(KERNEL_DS); > - err = ops->ndo_do_ioctl(dev, &ifr, SIOCADDTUNNEL); > - set_fs(oldfs); > - } else > - err = -EOPNOTSUPP; ... > + p.iph.daddr = ireq.ifr6_addr.s6_addr32[3]; > + p.iph.version = 4; > + p.iph.ihl = 5; > + p.iph.protocol = IPPROTO_IPV6; > + p.iph.ttl = 64; > + p.iph.frag_off |= htons(IP_DF); > + > + err = -ENOBUFS; > + if (!ipip6_tunnel_locate(dev_net(tunnel_dev), &p, true)) > + goto out_unlock; You're not undoing one, but two levels of abstraction here. Is this "ipip6_tunnel_locate()" call part of the SIT ioctl implementation? Where did it come from? Why are ->ndo_do_ioctl() implementations no longer allowed from here? Honestly, this feels like a bit much.