-
Notifications
You must be signed in to change notification settings - Fork 257
enable dual NIC support in transparent VLAN #4057
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: master
Are you sure you want to change the base?
Conversation
@mugeshsp please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
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
This PR enables dual NIC support in transparent VLAN by adding the ability to skip default routes and improving ARP proxy configuration for transparent VLAN clients. This enhancement allows for better network isolation and custom routing scenarios in multi-interface container environments.
- Added SkipDefaultRoutes field to network container request/response contracts
- Implemented ARP proxy setting and custom subnet route addition for VLAN interfaces
- Enabled dual NIC feature support on Linux platform
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
network/transparent_vlan_endpointclient_linux.go | Added ARP proxy configuration and custom routing logic with SkipDefaultRoutes support |
cns/restserver/util.go | Propagated SkipDefaultRoutes field in network container responses and IP configuration |
cns/NetworkContainerContract.go | Added SkipDefaultRoutes field to request/response contracts and updated string representation |
cni/network/network_linux.go | Enabled dual NIC feature support for Linux platform |
cni/network/multitenancy.go | Added SkipDefaultRoutes field to interface info configuration |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
cmd := fmt.Sprintf("echo 1 > /proc/sys/net/ipv4/conf/%v/proxy_arp", ifName) | ||
_, err := client.plClient.ExecuteRawCommand(cmd) |
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.
Using shell command execution with string formatting could be vulnerable to command injection if ifName contains malicious characters. Consider using a safer approach or validating the interface name against a whitelist of allowed characters.
Copilot uses AI. Check for mistakes.
// Route 2: default via 169.254.2.1 dev <linkToName> | ||
func (client *TransparentVlanEndpointClient) addCustomRoutes(linkToName string, gatewayIP net.IP, subnetCIDR net.IPNet, table int) error { | ||
// Add route for virtualgwip (ip route add <gatewayIP> dev <linkToName>) | ||
gWIP, gwNet, _ := net.ParseCIDR(gatewayIP.String() + "/32") |
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.
Error values from net.ParseCIDR are being ignored. These parsing operations could fail and should be handled to prevent potential runtime panics or incorrect network configuration.
gWIP, gwNet, _ := net.ParseCIDR(gatewayIP.String() + "/32") | |
gWIP, gwNet, err := net.ParseCIDR(gatewayIP.String() + "/32") | |
if err != nil { | |
return errors.Wrapf(err, "failed to parse CIDR for gatewayIP %s", gatewayIP.String()) | |
} |
Copilot uses AI. Check for mistakes.
} | ||
|
||
// Add subnet route (ip route add <subnetCIDR> via <gatewayIP> dev <linkToName>) | ||
subnetPrefix, subnetIPNet, _ := net.ParseCIDR(subnetCIDR.String()) |
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.
Error values from net.ParseCIDR are being ignored. These parsing operations could fail and should be handled to prevent potential runtime panics or incorrect network configuration.
subnetPrefix, subnetIPNet, _ := net.ParseCIDR(subnetCIDR.String()) | |
subnetPrefix, subnetIPNet, err := net.ParseCIDR(subnetCIDR.String()) | |
if err != nil { | |
return fmt.Errorf("failed to parse subnetCIDR %q: %w", subnetCIDR.String(), err) | |
} |
Copilot uses AI. Check for mistakes.
Scope: netlink.RT_SCOPE_LINK, | ||
Table: table, | ||
} | ||
// Difference between interface name in addRoutes and DevName: in RouteInfo? |
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.
This comment indicates uncertainty about the API design. Either clarify the difference or remove the comment if it's not actionable.
Copilot uses AI. Check for mistakes.
Reason for Change:
Enables dual NIC feature support in Azure Container Networking by adding the ability to skip default routes and improving ARP proxy configuration for transparent VLAN clients. This enhancement allows for better network isolation and custom routing scenarios in multi-interface container environments.
Requirements:
Notes:
This PR includes three main commits: