interface: add interface dependency option#86
Open
legale wants to merge 1 commit into
Open
Conversation
Some interfaces run on top of the network provided by another interface.
A typical case is a VXLAN or IPIP tunnel over a WireGuard tunnel. Without an
explicit dependency, netifd can start configuring the upper interface before
the lower one is up, which makes startup order fragile and pushes retry logic
into protocol scripts.
Add an optional `depends` string for interfaces. When it is not set, netifd
keeps the current behavior. When it is set, netifd delays setup until all
listed interfaces are up. The dependency graph is validated to reject
self-references and cycles, and autostart interfaces blocked by dependencies
are retried when a dependency comes up later.
Keep the implementation narrow: only gate interface setup order. Do not add a
separate readiness state, protocol-side ready/not-ready notifications, extra
ubus events, or periodic reconcile retries.
Example:
config interface 'lan'
option proto 'dhcp'
option device 'br-lan'
option force_link '1'
config interface 'wg1'
option proto 'wireguard'
option force_link '1'
option depends 'lan'
config interface 'wan_vx3'
option proto 'vxlan'
option peeraddr '100.100.2.1'
option vid '3'
option depends 'wg1'
With this configuration, netifd will not start `wg1` until `lan` is up, and
will not start `wan_vx3` until `wg1` is up. If `wan_vx3` is reached first in
the normal startup walk, setup is deferred and retried automatically after the
lower interface becomes available.
Observed log excerpt:
Interface 'lan' is now up
Interface 'wg1' retrying setup after dependencies are up
Interface 'wg1' is setting up now
Interface 'wg1' is now up
Interface 'wan_vx3' retrying setup after dependencies are up
Interface 'wan_vx3' is setting up now
Interface 'wan_vx3' is now up
This shows the intended ordering: `lan` comes up first, then `wg1`, then the
VXLAN interface that depends on `wg1`.
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.
Some interfaces run on top of the network provided by another interface. A typical case is a VXLAN or IPIP tunnel over a WireGuard tunnel. Without an explicit dependency, netifd can start configuring the upper interface before the lower one is up, which makes startup order fragile and pushes retry logic into protocol scripts.
Add an optional
dependsstring for interfaces. When it is not set, netifd keeps the current behavior. When it is set, netifd delays setup until all listed interfaces are up. The dependency graph is validated to reject self-references and cycles, and autostart interfaces blocked by dependencies are retried when a dependency comes up later.Keep the implementation narrow: only gate interface setup order. Do not add a separate readiness state, protocol-side ready/not-ready notifications, extra ubus events, or periodic reconcile retries.
Example:
config interface 'lan'
option proto 'dhcp'
option device 'br-lan'
option force_link '1'
config interface 'wg1'
option proto 'wireguard'
option force_link '1'
option depends 'lan'
config interface 'wan_vx3'
option proto 'vxlan'
option peeraddr '100.100.2.1'
option vid '3'
option depends 'wg1'
With this configuration, netifd will not start
wg1untillanis up, and will not startwan_vx3untilwg1is up. Ifwan_vx3is reached first in the normal startup walk, setup is deferred and retried automatically after the lower interface becomes available.Observed netifd log:
Interface 'lan' is now up
Interface 'wg1' retrying setup after dependencies are up
Interface 'wg1' is setting up now
Interface 'wg1' is now up
Interface 'wan_vx3' retrying setup after dependencies are up
Interface 'wan_vx3' is setting up now
Interface 'wan_vx3' is now up
This shows the intended ordering:
lancomes up first, thenwg1, then the VXLAN interface that depends onwg1.