[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200514.175355.167885308958584692.davem@davemloft.net>
Date: Thu, 14 May 2020 17:53:55 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: hch@....de
Cc: kuba@...nel.org, kuznet@....inr.ac.ru, yoshfuji@...ux-ipv6.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/4] ipv6: symbol_get to access a sit symbol
From: Christoph Hellwig <hch@....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 <hch@....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.
Powered by blists - more mailing lists