Skip to content
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

add methods to TCP and UDP sockets to modify hop limit #94678

Closed
wants to merge 7 commits into from

Conversation

kckeiks
Copy link
Contributor

@kckeiks kckeiks commented Mar 6, 2022

  • adds methods to set value of IPV6_UNICAST_HOPS and IPV6_MULTICAST_HOPS on ipv6 sockets
  • I added some noop methods for different systems to keep things consistent. Maybe someone could please clarify if these noop funcs are needed? and, if so, why? Just for my own learning.

This is my first addition of a new feature so let me know if I missed something in the process. I read the rustc dev guide about implementing new features but since the change here is simple, it suggested that a PR would be enough.

Fixes #47727

@rust-highfive
Copy link
Collaborator

r? @kennytm

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 6, 2022
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@kckeiks kckeiks changed the title add methods to TCP and UDP sockets modify hop limit add methods to TCP and UDP sockets to modify hop limit Mar 6, 2022
/// stream.set_multicast_hlim_v6(88).expect("set_hop_limit_v6 call failed");
/// ```
#[unstable(feature = "ipv6_hop_limit", issue = "47727")]
pub fn set_multicast_hlim_v6(&self, limit: u32) -> io::Result<()> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why thi is "hlim" here but "hop_limit" for unicast

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to keep the length of the method name from being too long. Should I change it to "hop_limit"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Rust doesn't generally abbreviate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the method names.

@kckeiks kckeiks requested review from kennytm and joshtriplett March 15, 2022 21:08
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 24, 2022
@apiraino apiraino added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label May 19, 2022
@the8472 the8472 added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 21, 2022
@the8472
Copy link
Member

the8472 commented May 21, 2022

IPV6_UNICAST_HOPS and IPV6_MULTICAST_HOPS are standardized in IETF RFC 3493 so this should be a good cross-platform addition.

Since it adds new API surface: r? rust-lang/libs-api

@bors
Copy link
Contributor

bors commented Jun 7, 2022

☔ The latest upstream changes (presumably #95565) made this pull request unmergeable. Please resolve the merge conflicts.

@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 3, 2022
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 13, 2022
@joshtriplett
Copy link
Member

This seems fine, assuming it passes CI. Let's see if the requisite constants are defined on all platforms...

@bors r+

@bors
Copy link
Contributor

bors commented Oct 3, 2022

📌 Commit b3e9e94 has been approved by joshtriplett

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 3, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 3, 2022
…joshtriplett

add methods to TCP and UDP sockets to modify hop limit

* adds methods to set value of IPV6_UNICAST_HOPS and IPV6_MULTICAST_HOPS on ipv6 sockets
* I added some noop methods for different systems to keep things consistent. Maybe someone could please clarify if these noop funcs are needed? and, if so, why? Just for my own learning.

This is my first addition of a new feature so let me know if I missed something in the process. I read the rustc dev guide about implementing new features but since the change here is simple, it suggested that a PR would be enough.

Fixes rust-lang#47727
@bors
Copy link
Contributor

bors commented Oct 4, 2022

⌛ Testing commit b3e9e94 with merge f5cfbb23b1def2ab0d4dfe01c13340628b453cd6...

@bors
Copy link
Contributor

bors commented Oct 4, 2022

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 4, 2022
@rust-log-analyzer
Copy link
Collaborator

The job dist-various-2 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

error: unused variable: `limit`
   --> library/std/src/sys/sgx/net.rs:456:36
    |
456 |     pub fn set_hop_limit_v6(&self, limit: u32) -> io::Result<()> {
    |                                    ^^^^^ help: if this is intentional, prefix it with an underscore: `_limit`
    |
    = note: `-D unused-variables` implied by `-D warnings`
error: unused variable: `limit`
   --> library/std/src/sys/sgx/net.rs:464:46
    |
    |
464 |     pub fn set_multicast_hop_limit_v6(&self, limit: u32) -> io::Result<()> {
    |                                              ^^^^^ help: if this is intentional, prefix it with an underscore: `_limit`
[RUSTC-TIMING] std test:false 3.547
warning: `std` (lib) generated 1 warning
error: could not compile `std` due to 2 previous errors; 1 warning emitted
Build completed unsuccessfully in 0:22:44

@pietroalbini
Copy link
Member

@bors r-

Queue got messed up after a synchronize.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 5, 2022
@bors
Copy link
Contributor

bors commented Oct 15, 2022

☔ The latest upstream changes (presumably #98033) made this pull request unmergeable. Please resolve the merge conflicts.

/// stream.set_hop_limit_v6(88).expect("set_hop_limit_v6 call failed");
/// ```
#[unstable(feature = "ipv6_hop_limit", issue = "47727")]
pub fn set_hop_limit_v6(&self, limit: u32) -> io::Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hop Limit is an 8bit header field. So using u8 instead of u32 would reflect that better and avoid API misusage like #73158.

@Dylan-DPC
Copy link
Member

@kckeiks any updates on this?

@kckeiks
Copy link
Contributor Author

kckeiks commented Nov 12, 2022

@kckeiks any updates on this?

Sorry, I've been super busy, I will push an update sometime this week though.

@kckeiks
Copy link
Contributor Author

kckeiks commented Jan 20, 2023

Just following up. My apologies, work has been keeping me exceedingly busy so I'm not sure when I'll have some bandwidth to resolve this. :/

@Dylan-DPC
Copy link
Member

Just following up. My apologies, work has been keeping me exceedingly busy so I'm not sure when I'll have some bandwidth to resolve this. :/

That's fine, can understand. I am going to close this as it is inactive. If you find the time feel free to reöpen it or preferably create a new PR and we can take it from there. Thanks

@Dylan-DPC Dylan-DPC closed this Jan 20, 2023
@Dylan-DPC Dylan-DPC added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UdpSocket::set_ttl does not set IPv6 hoplimit field