Skip to content

pcap support#24

Merged
zestrada merged 8 commits intomainfrom
pcap
May 1, 2025
Merged

pcap support#24
zestrada merged 8 commits intomainfrom
pcap

Conversation

@zestrada
Copy link
Member

@zestrada zestrada commented Apr 28, 2025

This PR adds pcap support for traffic over vpnguin. In an attempt to reduce guest resource demand, we synthesize packets received/transmitted over vsock from the host rather than leaning on the guest to capture traffic. TCP, UDP, IPv4, and IPv6 are supported.

Some thoughts:

  • We make a fake TCP stream by doing the handshake and then managing sequence numbers. This makes wireshark analyses happier, but anything other than the payload is totally fake.
    • Technically some code existed for teardown, but vpnguin tends to just leave things open so it is untested.
  • We use bogus MAC addresses. We could grab the guest MAC address for a given IP by introducing a new HostRequest for doing that if desired. Unclear if that is useful since we define static MAC addresses to make direction of transmission (e.g., host->guest) clear.
  • The host VPN is currently torn down by SIGTERM, which currently don't do anything with. I didn't think it was worth tightening up guarantees around whether packets are committed to disk before existing, but we can do that if desired
  • An effort was made to be consistent with support specifying source address #19 for the source IP address

@zestrada
Copy link
Member Author

One other change: since we now require even more libraries for the host, we don't build the host for every architecture, only x86_64 and aarch64.

@zestrada
Copy link
Member Author

Updated to define static MAC addresses for the host and guest. Using 47:55:45:53:54:00 "GUEST" for the guest and 48:4f:53:54:00:00 "HOST" for the host. Note that all IPs will share those MACs, but now it's straightforward to see which direction each packet was sent (by default everything is 127.0.0.1<=>127.0.0.1, so previously could do stuff like look at ephemeral vs. non-ephemeral for known services).

@zestrada
Copy link
Member Author

zestrada commented May 1, 2025

Squashed the pre Packetbuilder stuff into one commit just so history is there for anyone that might find it interesting

@zestrada zestrada merged commit ea1a2ed into main May 1, 2025
1 check passed
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.

1 participant