-
Notifications
You must be signed in to change notification settings - Fork 162
net_consomme: Add support for ipv6 #2398
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
base: main
Are you sure you want to change the base?
Conversation
|
This PR modifies files containing For more on why we check whole files, instead of just diffs, check out the Rustonomicon |
|
Before this change goes in, I will update the validate_mana_nic function (in the vmm_tests) to ensure the device with a self-assigned IPv6 address. |
|
This is really cool. |
| }) | ||
| .unwrap_or(false); | ||
|
|
||
| if !client_mac_matches { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see other comment about deciding whether we care about MAC address
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated 7 comments.
Comments suppressed due to low confidence (1)
vm/devices/net/net_consomme/consomme/src/tcp.rs:1256
- The TCP listener implementation only handles IPv4 addresses. The
poll_listenermethod returnsSocketAddrV4and explicitly rejects non-IPv4 addresses. However, the PR adds IPv6 support to TCP (as seen inhandle_tcpandbind_tcp_port), but incoming IPv6 connections won't be accepted because the listener socket is created withDomain::IPV4(line 1221) and only returns IPv4 addresses. This creates an asymmetry where outgoing IPv6 TCP connections work, but incoming IPv6 connections are silently dropped.
) -> Result<Option<(Socket, SocketAddrV4)>, DropReason> {
match self.socket.poll_accept(cx) {
Poll::Ready(r) => match r {
Ok((socket, address)) => match address.as_socket() {
Some(addr) => match address.as_socket_ipv4() {
Some(src_address) => Ok(Some((
socket,
SocketAddrV4::new(*src_address.ip(), addr.port()),
))),
None => {
tracing::warn!(?address, "Not an IPv4 address from accept");
Ok(None)
This PR adds the ability for the net_consomme backend to process IPv6 traffic generated by a guest VM. Without this change, guest VM's would only reporting having an IPv4 address and a link-local IPv6 address assigned to the machine (see the image below). However, with the addition of a minimal DHCPv6 server and handling of the Neighbor Discovery Protocol (NDP) (an extension of ICMPv6 analogous to ARP for IPv4), guest VM's are able to generate their own global unicast IPv6 addresses with SLAAC (Stateless Address Autoconfiguration).
Before:

After:

Proper handling of TCP and UDP traffic over IPv6 was validated by spinning up a netcat server on a host machine that a guest VM would connect to by using the host machines global unicast IPv6 address.
Along with adding IPv6 support, this PR also introduces some changes to remove types that were defined in the net_consomme crate and replace them with types that already exist in various dependencies.
Addresses an item in the consomme backlog: #2313