[25.0 backport] Remove generated MAC addresses on restart.#47171
Merged
[25.0 backport] Remove generated MAC addresses on restart.#47171
Conversation
The MAC address of a running container was stored in the same place as the configured address for a container. When starting a stopped container, a generated address was treated as a configured address. If that generated address (based on an IPAM-assigned IP address) had been reused, the containers ended up with duplicate MAC addresses. So, remember whether the MAC address was explicitly configured, and clear it if not. Signed-off-by: Rob Murray <rob.murray@docker.com> (cherry picked from commit cd53b73) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
corhere
approved these changes
Jan 22, 2024
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.
Since #45905 - the MAC address of a running container is stored in the same place as the configured address for a container.
So, when starting a stopped container, a generated address was treated as a configured address. If that generated address (based on an IPAM-assigned IP address) had been reused, the containers ended up with duplicate MAC addresses.
- How I did it
Remember whether the MAC address was explicitly configured, and clear it if not.
A similar approach is used for IPAM data (flag
IPAMOperational). The plan is to refactor, to separate configured and operational state.- How to verify it
New integration test.
- Description for the changelog
Ensure that a MAC address based on a container's IP address is re-generated when the container is stopped and restarted, in case the generated IP/MAC addresses have been reused.
- A picture of a cute animal (not mandatory but encouraged)