1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Use netlink.LinkByName instead of net.InterfaceByName

It's x350 time faster.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
Alexander Morozov 2015-10-16 11:33:17 -07:00
parent 604753b43a
commit 537ba03dd1

View file

@ -161,8 +161,8 @@ func GenerateIfaceName(prefix string, len int) (string, error) {
if err != nil {
continue
}
if _, err := net.InterfaceByName(name); err != nil {
if strings.Contains(err.Error(), "no such") {
if _, err := netlink.LinkByName(name); err != nil {
if strings.Contains(err.Error(), "not found") {
return name, nil
}
return "", err