Skip to content

Conversation

QxBytes
Copy link
Contributor

@QxBytes QxBytes commented Aug 15, 2025

Reason for Change:

In transparent-vlan mode, removes the vnet veth interface and container veth interface in the vm namespace if they exist prior to creating the pair in the vm namespace. This won't disrupt existing connections because these pairs are one per container, and if either side of the veth pair were in the vm namespace, the container's networking would be broken. The vnet veth interface must be in the vnet namespace and the container veth interface must be in the container namespace in a working setup (otherwise it is broken and we need to clean up). Removing one side of the veth should remove the other.

The above shouldn't be necessary since we already validate the existence of the veth interfaces on ADD, but it seems like sometimes the veth creation can pass validation, but then disappear for a short period of time before re-appearing, bypassing the cleanup logic during the add.

Also fixes an improper validation check after moving the vnet veth into the vnet namespace (though this did not cause the issue that triggered this fix). Previously it would check the wrong interface name, now it will check the interface name passed in the namespace passed in.

Issue Fixed:

See above

Requirements:

Notes:
Tested on a multitenancy linux transparent vlan setup with no issues
0c99864, consolidate logic and improve uts

@QxBytes QxBytes self-assigned this Aug 15, 2025
@QxBytes QxBytes added cni Related to CNI. fix Fixes something. multitenancy labels Aug 15, 2025
@QxBytes QxBytes requested a review from Copilot August 15, 2025 20:04
Copilot

This comment was marked as outdated.

@QxBytes
Copy link
Contributor Author

QxBytes commented Aug 15, 2025

/azp run Azure Container Networking PR

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@QxBytes QxBytes marked this pull request as ready for review August 15, 2025 21:11
@QxBytes QxBytes requested a review from a team as a code owner August 15, 2025 21:11
@QxBytes QxBytes requested review from nairashu and behzad-mir August 15, 2025 21:11
@QxBytes QxBytes force-pushed the alew/transparent-vlan-clean-vnet-container-nic branch from 33e3145 to 4db2645 Compare August 15, 2025 22:34
behzad-mir
behzad-mir previously approved these changes Aug 20, 2025
behzad-mir
behzad-mir previously approved these changes Aug 21, 2025
Copy link
Contributor

@behzad-mir behzad-mir left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@Copilot 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

This PR fixes issues in transparent-vlan mode by proactively cleaning up leaked veth interfaces and improving validation error messages. The changes prevent network setup failures caused by stale veth pairs that may exist in the wrong namespaces.

  • Adds proactive cleanup of vnet and container veth interfaces before creating new veth pairs
  • Fixes validation logic to check the correct interface name in the correct namespace
  • Updates error messages to be more descriptive and consistent throughout the codebase

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
network/transparent_vlan_endpointclient_linux.go Adds cleanup function for leaked interfaces, fixes validation parameters, and updates error messages
network/transparent_vlan_endpointclient_linux_test.go Updates test cases to reflect new validation function signature and improved error messages
network/networkutils/networkutils_linux.go Adds interface name to logging for better debugging

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@QxBytes QxBytes enabled auto-merge August 25, 2025 17:19
@QxBytes
Copy link
Contributor Author

QxBytes commented Aug 25, 2025

/azp run Azure Container Networking PR

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@QxBytes QxBytes added this pull request to the merge queue Aug 25, 2025
Merged via the queue into master with commit 4106639 Aug 25, 2025
16 checks passed
@QxBytes QxBytes deleted the alew/transparent-vlan-clean-vnet-container-nic branch August 25, 2025 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cni Related to CNI. fix Fixes something. multitenancy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants