}
fields := getFields(line)
+
+ // If the interface has no device file then we see two spaces between "device" and
+ // "maxtu" and and getFields treats the two spaces as one delimiter.
+ // Insert a gap for the missing device name.
+ // See https://go.dev/issue/72060.
+ if stringslite.HasPrefix(line, "device maxtu ") {
+ fields = append(fields, "")
+ copy(fields[2:], fields[1:])
+ fields[1] = ""
+ }
+
if len(fields) < 4 {
return nil, errors.New("invalid interface status file: " + ifcstat)
}
for line, ok := statusf.readLine(); ok; line, ok = statusf.readLine() {
fields := getFields(line)
if len(fields) < 1 {
- return nil, errors.New("cannot parse IP address for interface: " + status)
+ continue
}
addr := fields[0]
ip := ParseIP(addr)