On 11/17/20 1:53 PM, Mahesh Bandewar (महेश बंडेवार) wrote: > On Tue, Nov 17, 2020 at 9:18 AM Ido Schimmel <ido...@idosch.org> wrote: >> >> On Mon, Nov 16, 2020 at 01:03:32PM -0800, Mahesh Bandewar (महेश बंडेवार) >> wrote: >>> On Mon, Nov 16, 2020 at 12:34 PM Jakub Kicinski <k...@kernel.org> wrote: >>>> >>>> On Mon, 16 Nov 2020 12:02:48 -0800 Mahesh Bandewar (महेश बंडेवार) wrote: >>>>>>> diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c >>>>>>> index a1c77cc00416..76dc92ac65a2 100644 >>>>>>> --- a/drivers/net/loopback.c >>>>>>> +++ b/drivers/net/loopback.c >>>>>>> @@ -219,6 +219,13 @@ static __net_init int loopback_net_init(struct net >>>>>>> *net) >>>>>>> >>>>>>> BUG_ON(dev->ifindex != LOOPBACK_IFINDEX); >>>>>>> net->loopback_dev = dev; >>>>>>> + >>>>>>> + if (sysctl_netdev_loopback_state) { >>>>>>> + /* Bring loopback device UP */ >>>>>>> + rtnl_lock(); >>>>>>> + dev_open(dev, NULL); >>>>>>> + rtnl_unlock(); >>>>>>> + } >>>>>> >>>>>> The only concern I have here is that it breaks notification ordering. >>>>>> Is there precedent for NETDEV_UP to be generated before all pernet ops >>>>>> ->init was called? >>>>> I'm not sure if any and didn't see any issues in our usage / tests. >>>>> I'm not even sure anyone is watching/monitoring for lo status as such. >>>> >>>> Ido, David, how does this sound to you? >>>> >>>> I can't think of any particular case where bringing the device up (and >>>> populating it's addresses) before per netns init is finished could be >>>> problematic. But if this is going to make kernel coding harder the >>>> minor convenience of the knob is probably not worth it. >>> >>> +Eric Dumazet >>> >>> I'm not sure why kernel coding should get harder, but happy to listen >>> to the opinions. >> >> Hi, >> >> Sorry for the delay. Does not occur to me as a problematic change. I ran >> various tests with 'sysctl -qw net.core.netdev_loopback_state=1' and a >> debug config. Looks OK. > > Thanks for the confirmation Ido. I think Jian is getting powerpc > config build fixed to address the build-bots findings and then he can > push the updated version. >
If there is no harm in just creating lo in the up state, why not just do it vs relying on a sysctl? It only affects 'local' networking so no real impact to containers that do not do networking (ie., packets can't escape). Linux has a lot of sysctl options; is this one really needed?