On Mon, 23 May 2016 17:47:28 +0200 Martin Pieuchot <m...@openbsd.org> wrote: > On 23/05/16(Mon) 16:51, Gerhard Roth wrote: > > On Mon, 23 May 2016 16:18:29 +0200 Martin Pieuchot <m...@openbsd.org> wrote: > > > On 23/05/16(Mon) 15:38, Gerhard Roth wrote: > > > > > > This is crazy :) No driver should ever modify `ia' directly. This > > > code should call in_control() via the ioctl path. > > > > As mentioned in a previous mail: this was mostly copied from > > if_spppsubr.c:sppp_set_ip_addrs(). But doing an SIOCSIFADDR > > ioctl() from inside the kernel seems weird, too. > > SIOCAIFADDR/SIOCDIFADDR It is the way to go. The driver should not > manipulate addresses or route entry.
Not manipulating the route entries is simple to fix. Will do that. But using SIOCAIFADDR/SIOCDIFADDR seems rather awkward since in_control() requires a 'struct socket *so' argument (even though it does nothing with it, except checking 'so->so_state & SS_PRIV'). Creating a socket inside the driver for this sole purpose seems just as weird as setting up a fake struct socket. Are you really sure, this is the better way to go?