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 IP_TTL/IPV6_UNICAST_HOPS SockOpts #1515

Merged
merged 1 commit into from
Sep 12, 2021
Merged

Conversation

cemeyer
Copy link
Contributor

@cemeyer cemeyer commented Sep 7, 2021

Test: cargo test --test test test_ttl_opts

@cemeyer
Copy link
Contributor Author

cemeyer commented Sep 7, 2021

(Oops, initial version of the test was not cfg-limited to the same targets as the SockOpts.)

Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

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

Is there anything you can do to test that the sockopts actually work?

@cemeyer
Copy link
Contributor Author

cemeyer commented Sep 8, 2021

Is there anything you can do to test that the sockopts actually work?

Like, unit tests, or have I verified it works?

For unit tests, I'm not sure we can (or want to) rely on any particular internet host, and I don't know of any good way to simulate it.

Manually, yes, I've written a little traceroute program (using this new TTL functionality) and it works:

tracer_t to 8.8.8.8, 12 hops max
 1  192.168.0.1: EHOSTUNREACH, false.
 2  63.231.10.66: EHOSTUNREACH, false.
 3  63.226.198.9: EHOSTUNREACH, false.
 4  67.14.41.158: EHOSTUNREACH, false.
 5  72.14.221.110: EHOSTUNREACH, false.
 6  10.252.161.62: EHOSTUNREACH, false.
 7  142.251.55.203: EHOSTUNREACH, false.
 8  8.8.8.8: ECONNREFUSED, true.

I observe, e.g., ICMP "Time Exceeded - TTL expired in transit" errors from hops 1-7 and "Unreachable - Port unreachable" from hop 8. All of the UDP packets are sent to the destination (8.8.8.8), but the ICMP responses from all other addresses in the path are due to TTL expiration.

Test: `cargo test --test test test_ttl_opts`
@cemeyer
Copy link
Contributor Author

cemeyer commented Sep 8, 2021

(Rebased over #1516, no changes.)

Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

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

bors r+

@bors bors bot merged commit bf4f273 into nix-rust:master Sep 12, 2021
@cemeyer
Copy link
Contributor Author

cemeyer commented Sep 12, 2021

Thanks!

@cemeyer cemeyer deleted the ttl_sockopts branch September 13, 2021 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants