mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Use net.InterfaceByName to retrieve runsc DUT's device ID.
PiperOrigin-RevId: 413941742
This commit is contained in:
@@ -29,5 +29,4 @@ go_binary(
|
||||
name = "devid",
|
||||
testonly = True,
|
||||
srcs = ["devid.go"],
|
||||
deps = ["@com_github_vishvananda_netlink//:go_default_library"],
|
||||
)
|
||||
|
||||
@@ -21,15 +21,14 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
|
||||
"github.com/vishvananda/netlink"
|
||||
)
|
||||
|
||||
func main() {
|
||||
link, err := netlink.LinkByName(os.Args[1])
|
||||
iface, err := net.InterfaceByName(os.Args[1])
|
||||
if err != nil {
|
||||
log.Fatalf("could not find the link: %s", err)
|
||||
log.Fatalf("could not find link %s: %s", os.Args[1], err)
|
||||
}
|
||||
fmt.Printf("%d", link.Attrs().Index)
|
||||
fmt.Printf("%d", iface.Index)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user