consomme: filter guest network traffic based on destination#3157
Open
damanm24 wants to merge 2 commits intomicrosoft:mainfrom
Open
consomme: filter guest network traffic based on destination#3157damanm24 wants to merge 2 commits intomicrosoft:mainfrom
damanm24 wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens consomme’s NAT behavior by defaulting to drop guest-originated packets targeting host-local destinations, with an opt-in parameter to restore the previous behavior when needed.
Changes:
- Add
allow_guest_loopback_accesstoConsommeParamsand gate destination filtering on it. - Drop guest TX to loopback/unspecified/link-local destinations (new
DropReason::DestinationNotAllowed) and plumb this intonet_consommestats. - Add unit tests covering the new destination-filter behavior and update TCP tests to opt into loopback access.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| vm/devices/net/net_consomme/consomme/src/lib.rs | Adds allow_guest_loopback_access, introduces DestinationNotAllowed, and implements destination filtering in IPv4/IPv6 handlers. |
| vm/devices/net/net_consomme/src/lib.rs | Treats DestinationNotAllowed as a TX drop for stats reporting. |
| vm/devices/net/net_consomme/consomme/src/tests.rs | New tests validating default blocking and opt-in behavior. |
| vm/devices/net/net_consomme/consomme/src/tcp/tests.rs | Updates TCP harness to opt in to loopback access to keep tests working. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
By default, drop guest-originated packets destined for loopback, unspecified, and link-local addresses in the
consomme NAT layer. A new
allow_guest_loopback_accessparameter onConsommeParamscan be set to opt in to theprevious behavior when needed.