-
Notifications
You must be signed in to change notification settings - Fork 18k
net, x/net/route: ParseRIB fail to parse utun up InterfaceMessage #71064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
CC @neild, @ianlancetaylor. |
Currently the code ensures that |
We've identified some possible problems with your issue report. Please review
I'm just a bot; you probably know better than I do whether these findings really need fixing. |
Hi, this message can be easily reproduced in my mbp(macOS 15.2).
package main
import (
"fmt"
"os"
"golang.org/x/sys/unix"
)
func main() {
routeSocket, err := unix.Socket(unix.AF_ROUTE, unix.SOCK_RAW, unix.AF_UNSPEC)
if err != nil {
return
}
data := make([]byte, os.Getpagesize())
for {
n, err := unix.Read(routeSocket, data)
if err != nil {
return
}
if data[3] != unix.RTM_IFINFO {
continue
}
fmt.Printf("%d:%v\n", n, data[:n])
}
}
BTW, i have test for many times in my mbp, all message from NET_RT_IFLIST with RTM_IFINFO type has RTA_IFP, not guarantee in all platform. Maybe filter work should after getting interfaceMessages in standard library? ParseRIB itself just return basic message |
What does the ifconfig program print for the interface? Does it give it a name? |
ifconfig print nothing, it didn't give interface a name. utun0 exists when the system starts, it already has a name. |
Change https://go.dev/cl/641855 mentions this issue: |
Change https://go.dev/cl/646675 mentions this issue: |
On DragonFly it seems that we can see an unnamed interface, but be unable to retrieve it. Skip unnamed interface cases. For #71064 Change-Id: Ie9af74bd656d403ddc19cc5f14062cd8e0fa2571 Reviewed-on: https://go-review.googlesource.com/c/go/+/646675 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Damien Neil <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Commit-Queue: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]>
Go version
go version go1.22.6 darwin/amd64
Output of
go env
in your module/workspace:What did you do?
try parse message from AF_ROUTE socket.
unix.Socket(unix.AF_ROUTE, unix.SOCK_RAW, unix.AF_UNSPEC)
msgs, err := route.ParseRIB(route.RIBTypeRoute, data[:n])
What did you see happen?
ParseRIB skip Interface message that indicate utun interface up
since no RTA_IFP flag
not sure if it is intended
What did you expect to see?
should return InterfaceMessage with Index and flags?
The text was updated successfully, but these errors were encountered: