Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[25.0 backport] Remove generated MAC addresses on restart. #47171

Merged

Conversation

thaJeztah
Copy link
Member

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)

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>
@thaJeztah thaJeztah added this to the 25.0.1 milestone Jan 22, 2024
@thaJeztah thaJeztah self-assigned this Jan 22, 2024
Copy link
Contributor

@robmry robmry left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah thaJeztah merged commit f0f5fc9 into moby:25.0 Jan 22, 2024
126 checks passed
@thaJeztah thaJeztah deleted the 25.0_backport_47146-duplicate_mac_addrs branch January 22, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants