-
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 parsing network address of length zero #230
route: fix parsing network address of length zero #230
Conversation
cc @raggi |
This PR (HEAD: 21a12d8) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/net/+/646555. Important tips:
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/646555. |
Message from Ian Lance Taylor: Patch Set 1: (7 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/646555. |
Chapter 18 of UNIX® Network Programming Volume 1, Third Edition: The Sockets Networking API: The socket address structures are variable-length, but this code assumes that each has an sa_len field specifying its length. There are two complications that must be handled. First, the two masks, the network mask and the cloning mask, can be returned in a socket address structure with an sa_len of 0, but this really occupies the size of an unsigned long. (Chapter 19 of TCPv2 discusses the cloning feature of the 4.4BSD routing table). This value represents a mask of all zero bits, which we printed as 0.0.0.0 for the network mask of the default route in our earlier example. There are other references in the book which also state sa_len of 0 is valid. fixes #70528
21a12d8
to
df63086
Compare
This PR (HEAD: df63086) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/net/+/646555. Important tips:
|
Message from Carlos Hernandez: Patch Set 3: (8 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/646555. |
Message from Ian Lance Taylor: Patch Set 4: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/646555. |
Message from Carlos Hernandez: Patch Set 4: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/646555. |
Message from Ian Lance Taylor: Patch Set 5: Commit-Queue+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/646555. |
Message from Go LUCI: Patch Set 5: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2025-02-04T19:01:50Z","revision":"863efec411f3754edabedc55776803d1ae05bf13"} Please don’t reply on this GitHub thread. Visit golang.org/cl/646555. |
Message from Ian Lance Taylor: Patch Set 5: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/646555. |
Message from Go LUCI: Patch Set 5: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/646555. |
Message from Go LUCI: Patch Set 5: LUCI-TryBot-Result+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/646555. |
Message from Ian Lance Taylor: Patch Set 5: Auto-Submit+1 Code-Review+2 Commit-Queue+1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/646555. |
Message from Go LUCI: Patch Set 5: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2025-02-04T19:07:56Z","revision":"863efec411f3754edabedc55776803d1ae05bf13"} Please don’t reply on this GitHub thread. Visit golang.org/cl/646555. |
Message from Ian Lance Taylor: Patch Set 5: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/646555. |
Message from Go LUCI: Patch Set 5: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/646555. |
sa_len of 0 should be valid, for Chapter 18 of UNIX® Network Programming Volume 1, Third Edition: The Sockets Networking API, states: The socket address structures are variable-length, but this code assumes that each has an sa_len field specifying its length. There are two complications that must be handled. First, the two masks, the network mask and the cloning mask, can be returned in a socket address structure with an sa_len of 0, but this really occupies the size of an unsigned long. (Chapter 19 of TCPv2 discusses the cloning feature of the 4.4BSD routing table). This value represents a mask of all zero bits, which we printed as 0.0.0.0 for the network mask of the default route in our earlier example. There are other references in the book which also state sa_len of 0 is valid. Fixes golang/go#70528 Change-Id: I9205a674f9cdf8091b1cc8b8a56609cd1cf4c670 GitHub-Last-Rev: df63086 GitHub-Pull-Request: #230 Reviewed-on: https://go-review.googlesource.com/c/net/+/646555 Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Damien Neil <dneil@google.com>
This PR is being closed because golang.org/cl/646555 has been merged. |
sa_len of 0 should be valid, for Chapter 18 of UNIX® Network Programming
Volume 1, Third Edition: The Sockets Networking API, states:
The socket address structures are variable-length, but this code assumes
that each has an sa_len field specifying its length. There are two
complications that must be handled. First, the two masks, the network
mask and the cloning mask, can be returned in a socket address structure
with an sa_len of 0, but this really occupies the size of an unsigned
long. (Chapter 19 of TCPv2 discusses the cloning feature of the 4.4BSD
routing table). This value represents a mask of all zero bits, which we
printed as 0.0.0.0 for the network mask of the default route in our
earlier example.
There are other references in the book which also state sa_len of 0 is
valid.
Fixes golang/go#70528