-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
route: fix address parsing of messages on Darwin #220
route: fix address parsing of messages on Darwin #220
Conversation
This PR (HEAD: 04c61e3) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/net/+/609577. Important tips:
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Gopher Robot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be During May-July and Nov-Jan the Go project is in a code freeze, during which Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Ian Lance Taylor: Patch Set 1: (4 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Carlos Hernandez: Patch Set 1: (4 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
04c61e3
to
38e2e94
Compare
This PR (HEAD: 38e2e94) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/net/+/609577. Important tips:
|
Message from Carlos Hernandez: Patch Set 1: (4 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
38e2e94
to
af83adb
Compare
Message from Ian Lance Taylor: Patch Set 2: Commit-Queue+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
This PR (HEAD: af83adb) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/net/+/609577. Important tips:
|
Message from Go LUCI: Patch Set 2: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2024-09-04T22:37:34Z","revision":"88bd07d0a1f4211495b6cbdbe45b8b1cfe16e46c"} Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Ian Lance Taylor: Patch Set 2: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Go LUCI: Patch Set 2: This CL has failed the run. Reason: Tryjob golang/try/x_net-gotip-linux-arm64 has failed with summary (view all results):
Build or test failure, click here for results. To reproduce, try Additional links for debugging: Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Go LUCI: Patch Set 2: LUCI-TryBot-Result-1 Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Brad Fitzpatrick: Patch Set 2: (4 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Brad Fitzpatrick: Patch Set 3: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
af83adb
to
9f85924
Compare
This PR (HEAD: 9f85924) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/net/+/609577. Important tips:
|
Message from Carlos Hernandez: Patch Set 3: (3 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Ian Lance Taylor: Patch Set 4: Commit-Queue+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Go LUCI: Patch Set 4: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2024-09-05T21:10:29Z","revision":"094d0537c7b3bd91237b7cc72f7b4e645827ec12"} Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Ian Lance Taylor: Patch Set 4: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Go LUCI: Patch Set 4: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Go LUCI: Patch Set 4: LUCI-TryBot-Result+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Ian Lance Taylor: Patch Set 4: (3 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
9f85924
to
614ebc1
Compare
This PR (HEAD: 614ebc1) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/net/+/609577. Important tips:
|
65ec374
to
2fa5526
Compare
This PR (HEAD: 2fa5526) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/net/+/609577. Important tips:
|
sizeofSockaddrInet is 16, but first byte of sockaddr specifies actual size of sockaddr. Although, 16 works for most cases, it fails for Netmasks addresses. On Darwin only the significant bits of the netmask are in the msg. Take this route message as an example ``` // rt_msg_hdr 88 00 05 01 00 00 00 00 41 08 00 00 07 00 00 00 92 7b 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // metrics 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // SOCKADDRS - DST (100.113.0.0) 10 02 00 00 64 71 00 00 00 00 00 00 00 00 00 00 // GW utun4319 14 12 21 00 01 08 00 00 75 74 75 6e 34 33 31 39 00 00 00 00 // NETMASK 255.255.0.0 06 02 00 00 ff ff // NULL 00 00 ``` i.e. ipv4 ``` 06 02 00 00 ff ff ``` The above byte sequence is for a sockaddr that is 6 bytes long representing an ipv4 for address that is 255.255.0.0. i.e. ipv6 netmask ``` 0e 1e 00 00 00 00 00 00 ff ff ff ff ff ff 00 00 ``` The above is `/48` netmask that should also be parsed using `b[0]` of the sockaddr that contains the length. Confirmed by using `route monitor`. Fixes golang/go#44740 sources: https://github.com/apple/darwin-xnu/blob/main/bsd/net/route.h https://github.com/apple/darwin-xnu/blob/main/bsd/sys/socket.h#L603
2fa5526
to
f7b9253
Compare
This PR (HEAD: f7b9253) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/net/+/609577. Important tips:
|
Message from Carlos Hernandez: Patch Set 10: (3 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Ian Lance Taylor: Patch Set 10: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Ian Lance Taylor: Patch Set 10: Auto-Submit+1 Code-Review+2 Commit-Queue+1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Go LUCI: Patch Set 10: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2024-09-06T17:56:22Z","revision":"1a5ca0ed7214537e1210590e29051351ac0e673c"} Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Ian Lance Taylor: Patch Set 10: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Go LUCI: Patch Set 10: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
Message from Go LUCI: Patch Set 10: LUCI-TryBot-Result+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/609577. |
sizeofSockaddrInet is 16, but first byte of sockaddr specifies actual size of sockaddr. Although, 16 works for most cases, it fails for Netmasks addresses. On Darwin only the significant bits of the netmask are in the msg. Take this route message as an example ``` // rt_msg_hdr 88 00 05 01 00 00 00 00 41 08 00 00 07 00 00 00 92 7b 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // metrics 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // SOCKADDRS - DST (100.113.0.0) 10 02 00 00 64 71 00 00 00 00 00 00 00 00 00 00 // GW utun4319 14 12 21 00 01 08 00 00 75 74 75 6e 34 33 31 39 00 00 00 00 // NETMASK 255.255.0.0 06 02 00 00 ff ff // NULL 00 00 ``` i.e. ipv4 ``` 06 02 00 00 ff ff ``` The above byte sequence is for a sockaddr that is 6 bytes long representing an ipv4 for address that is 255.255.0.0. i.e. ipv6 netmask ``` 0e 1e 00 00 00 00 00 00 ff ff ff ff ff ff 00 00 ``` The above is `/48` netmask that should also be parsed using `b[0]` of the sockaddr that contains the length. Confirmed by using `route monitor`. sources: https://github.com/apple/darwin-xnu/blob/main/bsd/net/route.h https://github.com/apple/darwin-xnu/blob/main/bsd/sys/socket.h#L603 Fixes golang/go#44740 Change-Id: I8153130d02d0a5e547fbf60a85762d3889e1d08c GitHub-Last-Rev: f7b9253 GitHub-Pull-Request: #220 Reviewed-on: https://go-review.googlesource.com/c/net/+/609577 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
This PR is being closed because golang.org/cl/609577 has been merged. |
sizeofSockaddrInet is 16, but first byte of sockaddr specifies actual
size of sockaddr.
Although, 16 works for most cases, it fails for Netmasks addresses. On
Darwin only the significant bits of the netmask are in the msg.
Take this route message as an example
i.e. ipv4
The above byte sequence is for a sockaddr that is 6 bytes long
representing an ipv4 for address that is 255.255.0.0.
i.e. ipv6 netmask
The above is
/48
netmask that should also be parsed usingb[0]
of thesockaddr that contains the length.
Confirmed by using
route monitor
.sources:
https://github.com/apple/darwin-xnu/blob/main/bsd/net/route.h
https://github.com/apple/darwin-xnu/blob/main/bsd/sys/socket.h#L603
Fixes golang/go#44740