diff options
Diffstat (limited to 'libgo/go/net/interface_linux.go')
-rw-r--r-- | libgo/go/net/interface_linux.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libgo/go/net/interface_linux.go b/libgo/go/net/interface_linux.go index 15c2f3781b1..825b20227ae 100644 --- a/libgo/go/net/interface_linux.go +++ b/libgo/go/net/interface_linux.go @@ -7,14 +7,13 @@ package net import ( - "fmt" "os" "syscall" "unsafe" ) // If the ifindex is zero, interfaceTable returns mappings of all -// network interfaces. Otheriwse it returns a mapping of a specific +// network interfaces. Otherwise it returns a mapping of a specific // interface. func interfaceTable(ifindex int) ([]Interface, error) { tab, err := syscall.NetlinkRIB(syscall.RTM_GETLINK, syscall.AF_UNSPEC) @@ -194,7 +193,9 @@ func parseProcNetIGMP(path string, ifi *Interface) []Addr { name = f[1] case len(f[0]) == 8: if ifi == nil || name == ifi.Name { - fmt.Sscanf(f[0], "%08x", &b) + for i := 0; i+1 < len(f[0]); i += 2 { + b[i/2], _ = xtoi2(f[0][i:i+2], 0) + } ifma := IPAddr{IP: IPv4(b[3], b[2], b[1], b[0])} ifmat = append(ifmat, ifma.toAddr()) } @@ -218,10 +219,11 @@ func parseProcNetIGMP6(path string, ifi *Interface) []Addr { continue } if ifi == nil || f[1] == ifi.Name { - fmt.Sscanf(f[2], "%32x", &b) + for i := 0; i+1 < len(f[2]); i += 2 { + b[i/2], _ = xtoi2(f[2][i:i+2], 0) + } ifma := IPAddr{IP: IP{b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8], b[9], b[10], b[11], b[12], b[13], b[14], b[15]}} ifmat = append(ifmat, ifma.toAddr()) - } } return ifmat |