Skip to content

net_consomme: Add support for ipv6#2398

Merged
damanm24 merged 52 commits intomicrosoft:mainfrom
damanm24:consomme_ipv6
Feb 9, 2026
Merged

net_consomme: Add support for ipv6#2398
damanm24 merged 52 commits intomicrosoft:mainfrom
damanm24:consomme_ipv6

Conversation

@damanm24
Copy link
Contributor

@damanm24 damanm24 commented Nov 12, 2025

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:
image

After:
image

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

Copilot AI review requested due to automatic review settings November 12, 2025 01:15
@damanm24 damanm24 requested review from a team as code owners November 12, 2025 01:15
@github-actions github-actions bot added the unsafe Related to unsafe code label Nov 12, 2025
@github-actions
Copy link

⚠️ Unsafe Code Detected

This PR modifies files containing unsafe Rust code. Extra scrutiny is required during review.

For more on why we check whole files, instead of just diffs, check out the Rustonomicon

@damanm24
Copy link
Contributor Author

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.

Copy link
Contributor

Copilot AI left a 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 6 comments.

Comment on lines +560 to +566
let next_header = ipv6.next_header();
let inner = &payload[smoltcp::wire::IPV6_HEADER_LEN..];
let addresses = Ipv6Addresses {
src_addr: ipv6.src_addr(),
dst_addr: ipv6.dst_addr(),
};

Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

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

IPv6 packets can also be fragmented, but this implementation does not check for or reject fragmented IPv6 packets like it does for IPv4. IPv6 uses extension headers for fragmentation (Fragment Header, next header type 44). Without handling this, fragmented IPv6 packets will be processed as if they were complete, which could lead to incorrect behavior.

Consider adding a check for IPv6 fragmentation similar to the IPv4 check. You should verify that the next_header is not HopByHop (0), indicating extension headers might be present, and specifically check for the Fragment extension header (44). If fragmentation is detected, return DropReason::FragmentedPacket.

Copilot uses AI. Check for mistakes.
damanm24 added a commit that referenced this pull request Feb 4, 2026
The following PRs: #2633 and #2398 require features that are only
available in a newer version of smoltcp. Since the linked PRs are
already large in size, it makes sense to do the version upgrade and
corresponding build fixes in a separate PR. Unfortunately, there have
been some changes in smoltcp that add bloat to our dependency list.
Despite trying a myriad of combinations to turn off various features, I
wasn't able to reduce the number of requisite dependencies that we have
to pull in as a result of doing this upgrade.
@github-actions
Copy link

github-actions bot commented Feb 5, 2026

@jstarks
Copy link
Member

jstarks commented Feb 5, 2026

Looks good, just a few nits.

@github-actions
Copy link

github-actions bot commented Feb 5, 2026

jstarks
jstarks previously approved these changes Feb 5, 2026
@github-actions
Copy link

github-actions bot commented Feb 6, 2026

@github-actions
Copy link

github-actions bot commented Feb 7, 2026

@damanm24 damanm24 merged commit 5ce7c6d into microsoft:main Feb 9, 2026
80 of 82 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

unsafe Related to unsafe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants