loopback: Force LOOPBACK_IFINDEX for registration
Subsystems (2)
PATCH 1/1 loopback: Force LOOPBACK_IFINDEX for registration
Now with commit 9c7dafb (net: Allow to create links with given ifindex) support registration of network devices with specific ifindex is added.
We can force loopback network device index before call to register_netdev() to ensure we always configure it with LOOPBACK_IFINDEX.
Kill BUG_ON() since system can continue without network namespace failed in loopback init path, unless it is init_net namespace where we panic() anyway.
--- drivers/net/loopback.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/loopback.c +2 -1
@@ -210,12 +210,13 @@ static __net_init int loopback_net_init(struct net *net)if (!dev) goto out; + dev->ifindex =LOOPBACK_IFINDEX ; +dev_net_set (dev, net); err =register_netdev (dev);if (err) goto out_free_netdev; -BUG_ON (dev->ifindex !=LOOPBACK_IFINDEX ); net->loopback_dev = dev;return 0 ;
Signature · 1 line
1.8.3.1
Hello!
Quoted 1 line · Serhey Popovych
Now with commit 9c7dafb (net: Allow to create links with
The commit citing style is standardized: 12-digit SHA1 and the summary
enclosed in ("").
Quoted 1 line
given ifindex) support registration of network devices
Support for.
Quoted 1 line
with specific ifindex is added.
Was added.
Quoted 9 lines
We can force loopback network device index before call to
register_netdev()to ensure we always configure it withLOOPBACK_IFINDEX.Kill
BUG_ON()since system can continue without network namespace failed in loopback init path, unless it isinit_netnamespace where wepanic()anyway.Signed-off-by Serhey Popovych <[email protected]>
[...]
MBR, Sergei
David Miller
maintainerFrom: Serhey Popovych <[email protected]>
Date: Fri, 16 Jun 2017 15:10:03 +0300
Quoted 8 lines
Now with commit 9c7dafb (net: Allow to create links with given ifindex) support registration of network devices with specific ifindex is added.
We can force loopback network device index before call to
register_netdev()to ensure we always configure it withLOOPBACK_IFINDEX.
Quoted 5 lines
Kill
BUG_ON()since system can continue without network namespace failed in loopback init path, unless it isinit_netnamespace where wepanic()anyway.Signed-off-by Serhey Popovych <[email protected]>
Is the BUG_ON() triggering, if so why?
It looks to me that unless there is a bug, this assignment is unnecessary.
Quoted 16 lines
From: Serhey Popovych <[email protected]>
Date: Fri, 16 Jun 2017 15:10:03 +0300Quoted 12 lines
Now with commit 9c7dafb (net: Allow to create links with given ifindex) support registration of network devices with specific ifindex is added.
We can force loopback network device index before call to
register_netdev()to ensure we always configure it withLOOPBACK_IFINDEX.Kill
BUG_ON()since system can continue without network namespace failed in loopback init path, unless it isinit_netnamespace where wepanic()anyway.
Quoted 7 lines
Quoted 1 line
Signed-off-by Serhey Popovych <[email protected]>Is the
BUG_ON()triggering, if so why?It looks to me that unless there is a bug, this assignment is unnecessary.
Okay, get your position, thanks!
Signature · 1 line
Thanks, Serhey
Quoted 17 lines
Quoted 17 lines
From: Serhey Popovych <[email protected]>
Date: Fri, 16 Jun 2017 15:10:03 +0300Quoted 12 lines
Now with commit 9c7dafb (net: Allow to create links with given ifindex) support registration of network devices with specific ifindex is added.
We can force loopback network device index before call to
register_netdev()to ensure we always configure it withLOOPBACK_IFINDEX.Kill
BUG_ON()since system can continue without network namespace failed in loopback init path, unless it isinit_netnamespace where wepanic()anyway.
Quoted 9 lines
Quoted 7 lines
Quoted 1 line
Signed-off-by Serhey Popovych <[email protected]>Is the
BUG_ON()triggering, if so why?It looks to me that unless there is a bug, this assignment is unnecessary.
Okay, get your position, thanks!
Sorry for raising again, but my objectives following:
BUG_ON() might be compiled out when CONFIG_BUG=n. That's open possibility in buggy setups to have "lo" with ->ifindex other than LOOPBACK_IFINDEX.
By forcing register_netdevice() via setting ifindex = LOOPBACK_IFINDEX we address CONFIG_BUG=n case.
We can leave BUG_ON(), but add ifindex = LOOPBACK_IFINDEX to ensure register_netdevice() operates properly.
What do you think?
Signature · 1 line
Thanks, Serhey
David Miller
maintainerFrom: Serhey Popovych <[email protected]>
Date: Wed, 21 Jun 2017 12:35:12 +0300
Quoted 33 lines
Quoted 17 lines
Quoted 17 lines
From: Serhey Popovych <[email protected]>
Date: Fri, 16 Jun 2017 15:10:03 +0300Quoted 12 lines
Now with commit 9c7dafb (net: Allow to create links with given ifindex) support registration of network devices with specific ifindex is added.
We can force loopback network device index before call to
register_netdev()to ensure we always configure it withLOOPBACK_IFINDEX.Kill
BUG_ON()since system can continue without network namespace failed in loopback init path, unless it isinit_netnamespace where wepanic()anyway.Quoted 9 lines
Quoted 7 lines
Quoted 1 line
Signed-off-by Serhey Popovych <[email protected]>Is the
BUG_ON()triggering, if so why?It looks to me that unless there is a bug, this assignment is unnecessary.
Okay, get your position, thanks!
Sorry for raising again, but my objectives following:
BUG_ON()might be compiled out whenCONFIG_BUG=n. That's open possibility in buggy setups to have "lo" with ->ifindex other thanLOOPBACK_IFINDEX.
Quoted 8 lines
By forcing
register_netdevice()via setting ifindex =LOOPBACK_IFINDEXwe addressCONFIG_BUG=ncase.We can leave
BUG_ON(), but add ifindex =LOOPBACK_IFINDEXto ensureregister_netdevice()operates properly.What do you think?
I don't understand what you are trying to achieve.
BUG_ON() is an assertion.
It checks that an invariant holds.
Whether the check is enabled or not has no bearing on the invariant.
There is no reason to make the assignment if it is supposed to be set properly already, period. The assertion states that it is supposed to be set properly when we get to this code.