[lxc-devel] [lxc/lxc] 4810a7: Improve efficiency of lxc_ifname_alnum_case_sensitive
Christian Brauner
noreply at github.com
Fri Jul 17 12:13:44 UTC 2020
Branch: refs/heads/master
Home: https://github.com/lxc/lxc
Commit: 4810a7a3e6423c85690676474976ee54c3733c9e
https://github.com/lxc/lxc/commit/4810a7a3e6423c85690676474976ee54c3733c9e
Author: Sam Boyles <sam.boyles42 at gmail.com>
Date: 2020-07-17 (Fri, 17 Jul 2020)
Changed paths:
M src/lxc/network.c
Log Message:
-----------
Improve efficiency of lxc_ifname_alnum_case_sensitive
To detect if a newly generated interface name is a duplicate of an existing interface lxc_ifname_alnum_case_sensitive() currently gets a list of all interfaces using netns_getifaddrs(). When the system has a small number of interfaces this works fine, however when there are thousands or tens of thousands of interfaces this quickly becomes less than optimal.
As we only need to check if an interface name exists, and do not need the detailed information about the interfaces provided by netns_getifaddrs(), we can instead use the if_nametoindex() function, which is much more efficient.
Signed-off-by: Sam Boyles <sam.boyles at alliedtelesis.co.nz>
Commit: 8bbca3ccf221b064a1e6ff975d4f952d6a5d15df
https://github.com/lxc/lxc/commit/8bbca3ccf221b064a1e6ff975d4f952d6a5d15df
Author: Christian Brauner <christian.brauner at ubuntu.com>
Date: 2020-07-17 (Fri, 17 Jul 2020)
Changed paths:
M src/lxc/network.c
Log Message:
-----------
Merge pull request #3487 from samboyles1/master
Improve efficiency of lxc_ifname_alnum_case_sensitive
Compare: https://github.com/lxc/lxc/compare/19be19a35249...8bbca3ccf221
More information about the lxc-devel
mailing list