Skip to content

fix: Backport Docker VLAN gateway fallback to 7.2#2637

Merged
limetech merged 1 commit into
7.2from
codex/7.2-docker-vlan-gateway-fallback
May 14, 2026
Merged

fix: Backport Docker VLAN gateway fallback to 7.2#2637
limetech merged 1 commit into
7.2from
codex/7.2-docker-vlan-gateway-fallback

Conversation

@elibosley
Copy link
Copy Markdown
Member

Summary

Backports the Docker VLAN gateway fallback fix from 7.3 to the 7.2 branch.

Root Cause

rc.docker only used live default routes to determine the gateway for automatically recreated Docker custom networks. VLAN and secondary interfaces can have configured gateways in network.cfg without 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.1 and breaking DHCP or static-IP containers.

What Changed

  • Added configured_gateway() to resolve IPv4 and IPv6 gateways from /boot/config/network.cfg.
  • Mapped bridge and bond network names back to their corresponding eth network config entries.
  • Resolved VLAN IDs to the correct indexed gateway entries.
  • Used the configured gateway as a fallback only when no live default route gateway is found.

Validation

  • bash -n etc/rc.d/rc.docker

Cherry-picked from d56c259d7e4431c97042d5f67d5740f443ee81bb.

- 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)
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9284ed48-fa2f-4564-93c2-0325062d3dbb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/7.2-docker-vlan-gateway-fallback

Comment @coderabbitai help to get the list of available commands and usage tips.

@elibosley elibosley changed the title [codex] Backport Docker VLAN gateway fallback to 7.2 feat: Backport Docker VLAN gateway fallback to 7.2 May 13, 2026
@elibosley elibosley changed the title feat: Backport Docker VLAN gateway fallback to 7.2 fix: Backport Docker VLAN gateway fallback to 7.2 May 13, 2026
@elibosley elibosley requested a review from limetech May 13, 2026 18:22
@elibosley elibosley added the 7.2 label May 13, 2026
@elibosley elibosley marked this pull request as ready for review May 14, 2026 15:12
Copy link
Copy Markdown
Contributor

@limetech limetech left a comment

Choose a reason for hiding this comment

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

LGTM

@limetech limetech merged commit 1cbad60 into 7.2 May 14, 2026
4 checks passed
@limetech limetech deleted the codex/7.2-docker-vlan-gateway-fallback branch May 14, 2026 21:20
@github-actions
Copy link
Copy Markdown

🧹 PR Test Plugin Cleaned Up

The 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants