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

Fix ICMP and UDP traceroute #302

Merged
merged 5 commits into from
Nov 2, 2017
Merged

Fix ICMP and UDP traceroute #302

merged 5 commits into from
Nov 2, 2017

Conversation

djs55
Copy link
Collaborator

@djs55 djs55 commented Nov 2, 2017

This PR fixes ICMP and UDP traceroute (on Mac) by:

  • setting the TTL on outgoing ICMP and UDP
  • forwarding ICMP Destination unreachable and TTL exceeded messages

On windows we don't receive the ICMP messages for an unknown reason.

Fixes #193
Fixes #194

djs55 added 5 commits November 2, 2017 14:52
An ICMP datagram with TTL exceeded contains a truncated copy of
the original IPv4 datagram. In our case this will contain a truncated
ICMP echo request. This patch parses the packet and rewrites both
the destination and the id in the nested copy because

- the destination we receive from the host will have the host's IP
  in it, we need to use the VM's IP
- the id we receive from the host is chosen by us in the NAT
  translation, so we have to translate it back

With these changes, ICMP traceroute works.

Signed-off-by: David Scott <[email protected]>
We expect to receive ICMP when the TTL on the outgoing packets is exceeded.
This patch forwards these ICMP messages to the application.

Note this exposes a a global mapping of external UDP port number to internal
address, introducing a dependency from the Hostnet_icmp module to the
Hostnet_udp.

Signed-off-by: David Scott <[email protected]>
When using UDP traceroute the client expects to receive a "Destination
unreachable" from the final target.

Signed-off-by: David Scott <[email protected]>
@MagnusS
Copy link
Collaborator

MagnusS commented Nov 2, 2017

Nice - I guess this also fixes #194, at least partially

@djs55
Copy link
Collaborator Author

djs55 commented Nov 2, 2017

@MagnusS good point. Although it's not 100% fixed it's probably good enough for most people, so I think I'll declare it fixed with caveats.

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.

TTL not preserved ICMP messages not forwarded to guest
2 participants