libnet, daemon: Recreate docker0 when unsetting default-address-pools #49363
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.
Fixes:
- What I did
Commit 268d418 added persistence to the bridge driver, and added logic to not delete the bridge interface if it's used by the default bridge network when the later is deleted (as part of the networking initialization steps).
Later on, commit 6bd1539 refined this logic to not delete the bridge interface if it's user-managed. But it didn't touch the original condition (ie. do not delete the bridge interface if it's used by the default network).
And then, commit 173b3c3 added support for the
default-address-pools
parameter. It also added some code to delete the bridge interface used by the default network, but in the daemon instead of leveraging the usual delete flow in the bridge driver. It also skips the deletion if nodefault-address-pools
are defined.This leads to a corner case where the bridge interface isn't recreated when
default-address-pools
is unset.Tidy this up by letting the bridge driver delete the bridge interface even when it's used by the default network. There are two exceptions where the underlying interface shall not be deleted:
Note that the 2nd exception could be refined to only apply when there are active sandboxes attached to that network, but this is out of scope.
- How to verify it
- Description for the changelog