1
0
mirror of https://github.com/golang/go synced 2024-11-17 06:54:48 -07:00

net: explain why we ignore the first line of Plan 9 interface-status files

Change-Id: Ia0847790a597c35ebb572db6fc1b7534ecf8f006
GitHub-Last-Rev: 03f039d0ab
GitHub-Pull-Request: golang/go#30022
Reviewed-on: https://go-review.googlesource.com/c/160446
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Leon Klingele 2019-02-22 15:51:40 +00:00 committed by Brad Fitzpatrick
parent 97f81572c4
commit dc0455225a

View File

@ -152,10 +152,14 @@ func interfaceAddrTable(ifi *Interface) ([]Addr, error) {
}
defer statusf.close()
// Read but ignore first line as it only contains the table header.
// See https://9p.io/magic/man2html/3/ip
if _, ok := statusf.readLine(); !ok {
return nil, errors.New("cannot read header line for interface: " + status)
}
line, ok := statusf.readLine()
line, ok = statusf.readLine()
if !ok {
return nil, errors.New("cannot parse IP address for interface: " + status)
return nil, errors.New("cannot read IP address for interface: " + status)
}
// This assumes only a single address for the interface.