route: avoid parsing rt_msghdr2 fields as pid, seq, errno#247
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
6980776 to
c46439b
Compare
|
This PR (HEAD: c46439b) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/net/+/773120. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/773120. |
|
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/773120. |
On Darwin, NET_RT_DUMP2 returns RTM_GET2 messages backed by rt_msghdr2. That header is not a superset of rt_msghdr: the offsets used by rt_msghdr for rtm_pid, rtm_seq, and rtm_errno are instead rtm_refcnt, rtm_parentflags, and rtm_use in rt_msghdr2. The current classic parser unconditionally reads those offsets into RouteMessage.ID, RouteMessage.Seq, and RouteMessage.Err. Valid RIB entries with non-zero rtm_use are therefore reported as errors. Represent pid, seq, and errno offsets in wireFormat and leave them unset for Darwin's rt_msghdr2 format. This fixes the incorrect Err value and avoids exposing rt_msghdr2 ref counts and parent flags through unrelated fields. The inspected XNU route.h sources, from xnu-2422.1.72 through xnu-12377.101.15, use the same rt_msghdr2 layout and have no rtm_errno field. See bsd/net/route.h in apple-oss-distributions/xnu at those tags. This change does not add API for rt_msghdr2-specific fields such as rtm_refcnt, rtm_parentflags, rtm_use, or rtm_inits. They need a separate API decision; preserving rtm_use via RouteMessage.Err would keep valid routes looking like failed operations. Fixes golang/go#70593 Change-Id: I7011355e6b9643e7756557b34518b26c9f3e7749
c46439b to
46cbc72
Compare
|
Message from 오지환: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/773120. |
|
This PR (HEAD: 46cbc72) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/net/+/773120. Important tips:
|
On Darwin, NET_RT_DUMP2 returns RTM_GET2 messages backed by rt_msghdr2. That header is not a superset of rt_msghdr: the offsets used by rt_msghdr for rtm_pid, rtm_seq, and rtm_errno are instead rtm_refcnt, rtm_parentflags, and rtm_use in rt_msghdr2.
The current classic parser unconditionally reads those offsets into RouteMessage.ID, RouteMessage.Seq, and RouteMessage.Err. Valid RIB entries with non-zero rtm_use are therefore reported as errors.
Represent pid, seq, and errno offsets in wireFormat and leave them unset for Darwin's rt_msghdr2 format. This fixes the incorrect Err value and avoids exposing rt_msghdr2 ref counts and parent flags through unrelated fields.
The inspected XNU route.h sources, from xnu-2422.1.72 through xnu-12377.101.15, use the same rt_msghdr2 layout and have no rtm_errno field. See bsd/net/route.h in apple-oss-distributions/xnu at those tags.
This change does not add API for rt_msghdr2-specific fields such as rtm_refcnt, rtm_parentflags, rtm_use, or rtm_inits. They need a separate API decision; preserving rtm_use via RouteMessage.Err would keep valid routes looking like failed operations.
Fixes golang/go#70593
Change-Id: I7011355e6b9643e7756557b34518b26c9f3e7749