Skip to content

Commit

Permalink
Merge pull request networkservicemesh#330 from Nordix/if-rename-fix
Browse files Browse the repository at this point in the history
fix for interface renaming
  • Loading branch information
denis-tingaikin authored Sep 3, 2021
2 parents 1b22e52 + c41baa3 commit 02b4e9a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/kernel/networkservice/inject/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,18 @@ func renameInterface(origIfName, desiredIfName string, curNetNS, targetNetNS net
return errors.Wrapf(err, "failed to get net interface: %v", origIfName)
}

if err = netlink.LinkSetDown(link); err != nil {
return errors.Wrapf(err, "failed to rename net interface: %v -> %v", origIfName, desiredIfName)
}

if err = netlink.LinkSetName(link, desiredIfName); err != nil {
return errors.Wrapf(err, "failed to rename net interface: %v -> %v", origIfName, desiredIfName)
}

if err = netlink.LinkSetUp(link); err != nil {
return errors.Wrapf(err, "failed to rename net interface: %v -> %v", origIfName, desiredIfName)
}

return nil
})
}
Expand Down

0 comments on commit 02b4e9a

Please sign in to comment.