[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAej5NZMBTsoSMh2RJF19WwZNDxq5cLE2dy3TC0Od+yh05VP=A@mail.gmail.com>
Date: Thu, 21 May 2020 23:55:12 +0200
From: Ferenc Fejes <fejes@....elte.hu>
To: sdf@...gle.com
Cc: netdev@...r.kernel.org, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org, Martin KaFai Lau <kafai@...com>,
Lawrence Brakmo <brakmo@...com>,
"David S . Miller" <davem@...emloft.net>
Subject: Re: [PATCH net-next] Extending bpf_setsockopt with SO_BINDTODEVICE sockopt
> Any specific reason you're not reusing sock_setbindtodevice or at least
> sock_setbindtodevice_locked here? I think, historically, we've
> reimplemented some of the sockopts because they were 'easy' (i.e.
> were just setting a flag in the socket), this one looks more involved.
Yes, there is a copy_from_user in the sock_setbindtodevice for copying
the ioctl netdev name from the user which (I think) not necessary
here. However sock_setbindtodevice_locked is the way to go but I was
afraid to forward declare it in sock.h, change the linkage and export
it in sock.c (I find that a little bit too intrusive).
> I'd suggest, add an optional 'lock_sk' argument to sock_setbindtodevice,
> call it with 'true' from real setsockopt, and call it with 'false'
> here.
Thanks for the advice. However I think I'll wait what happens with
this patch: https://lore.kernel.org/netdev/20200520195509.2215098-8-hch@lst.de/T/#u
Very strange coincidence that patch was submitted a few hours before
mine (but I noticed just now) and refactor the sock_setbindtodevice in
a way that will useful in my case (also define it in sock.h).
> And, as Andrii pointed out, it would be nice to have a selftest
> that exercises this new option.
Thanks, I will implement them in the next iteration.
Powered by blists - more mailing lists