Upgrade to use latest netlink and add old interface name to alt names

This commit is contained in:
Alex D. 2024-06-25 10:27:25 +00:00
parent 1220119aed
commit d83ba0bff0
Signed by: caskd
GPG Key ID: E5AE8A47B8EFC7ED
2 changed files with 6 additions and 3 deletions

6
go.mod
View File

@ -2,9 +2,9 @@ module git.redxen.eu/caskd/net-predictable
go 1.22.3
require github.com/vishvananda/netlink v1.1.0
require github.com/vishvananda/netlink v1.2.1-beta.2.0.20240524165444-4d4ba1473f21
require (
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df // indirect
golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444 // indirect
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae // indirect
golang.org/x/sys v0.10.0 // indirect
)

View File

@ -73,4 +73,7 @@ func main() {
if err = netlink.LinkSetName(l, nln); err != nil {
mainlog.Fatalf("Could not rename interface %s: %s\n", ifname, err)
}
if err = netlink.LinkAddAltName(l, ifname); err != nil {
mainlog.Printf("Adding original name as interface alias failed for %s: %s\n", ifname, err)
}
}