fix: Backport Docker VLAN gateway fallback to 7.2#2637
Conversation
- Purpose: keep Docker custom networks on VLAN and secondary interfaces from losing their configured gateway during automatic network recreation. - Before: rc.docker only read the gateway from a default route on the interface, so VLANs without an interface-specific default route created Docker networks without --gateway. - Why that was a problem: Docker could claim the first subnet address as the macvlan/ipvlan gateway, colliding with real VLAN gateways such as 192.168.10.1 and breaking DHCP or static-IP containers. - What the new change accomplishes: automatic Docker network creation now falls back to the configured IPv4 or IPv6 gateway stored in network.ini when no live default route exists. - How it works: configured_gateway maps br/bond network names back to their eth network.ini section, resolves VLAN IDs to their indexed entries, and returns the matching GATEWAY or GATEWAY6 value before network create arguments are assembled. (cherry picked from commit d56c259)
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
🧹 PR Test Plugin Cleaned UpThe test plugin and associated files for this PR have been removed from the preview environment. 🤖 This comment is automatically generated when a PR is closed. |
Summary
Backports the Docker VLAN gateway fallback fix from 7.3 to the 7.2 branch.
Root Cause
rc.dockeronly used live default routes to determine the gateway for automatically recreated Docker custom networks. VLAN and secondary interfaces can have configured gateways innetwork.cfgwithout an interface-specific live default route, so Docker networks could be recreated without--gateway.When Docker omitted the gateway, it could claim the first address in the subnet as the macvlan/ipvlan gateway, colliding with real VLAN gateways such as
192.168.10.1and breaking DHCP or static-IP containers.What Changed
configured_gateway()to resolve IPv4 and IPv6 gateways from/boot/config/network.cfg.ethnetwork config entries.Validation
bash -n etc/rc.d/rc.dockerCherry-picked from
d56c259d7e4431c97042d5f67d5740f443ee81bb.