From 709336a2c3fab942e8e0a403dd078f0c7e86ebea Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 16 Oct 2025 18:35:45 +0200 Subject: [PATCH] api/types/network: EndpointSettings: make MacAddress "operational data" The MacAddress field currently reflects _either_ the user-specified (DesiredMacAddress) _or_ the actual / assigned MacAddress (when running). Internal structs already have a separate DesiredMacAddres field, but this field is not (yet) reflected in the API response. The intent is to move towards better separation of config ("desired state") and operational ("actual state") data. Let's move the MacAddress field under "operational" data; the field's description still describes its dual-personality, but potentially we can move towards separate fields in future. Signed-off-by: Sebastiaan van Stijn --- api/types/network/endpoint.go | 25 +++++++++++-------- .../moby/moby/api/types/network/endpoint.go | 25 +++++++++++-------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/api/types/network/endpoint.go b/api/types/network/endpoint.go index ee5223d052..ee98fab01f 100644 --- a/api/types/network/endpoint.go +++ b/api/types/network/endpoint.go @@ -8,14 +8,10 @@ import ( // EndpointSettings stores the network endpoint details type EndpointSettings struct { - // Configurations + // Configuration data IPAMConfig *EndpointIPAMConfig Links []string Aliases []string // Aliases holds the list of extra, user-specified DNS names for this endpoint. - // MacAddress may be used to specify a MAC address when the container is created. - // Once the container is running, it becomes operational data (it may contain a - // generated address). - MacAddress string DriverOpts map[string]string // GwPriority determines which endpoint will provide the default gateway @@ -23,17 +19,24 @@ type EndpointSettings struct { // If multiple endpoints have the same priority, they are lexicographically // sorted based on their network name, and the one that sorts first is picked. GwPriority int + // Operational data - NetworkID string - EndpointID string - Gateway netip.Addr - IPAddress netip.Addr + + NetworkID string + EndpointID string + Gateway netip.Addr + IPAddress netip.Addr + + // MacAddress may be used to specify a MAC address when the container is created. + // Once the container is running, it becomes operational data (it may contain a + // generated address). + MacAddress string IPPrefixLen int IPv6Gateway netip.Addr GlobalIPv6Address netip.Addr GlobalIPv6PrefixLen int - // DNSNames holds all the (non fully qualified) DNS names associated to this endpoint. First entry is used to - // generate PTR records. + // DNSNames holds all the (non fully qualified) DNS names associated to this + // endpoint. The first entry is used to generate PTR records. DNSNames []string } diff --git a/vendor/github.com/moby/moby/api/types/network/endpoint.go b/vendor/github.com/moby/moby/api/types/network/endpoint.go index ee5223d052..ee98fab01f 100644 --- a/vendor/github.com/moby/moby/api/types/network/endpoint.go +++ b/vendor/github.com/moby/moby/api/types/network/endpoint.go @@ -8,14 +8,10 @@ import ( // EndpointSettings stores the network endpoint details type EndpointSettings struct { - // Configurations + // Configuration data IPAMConfig *EndpointIPAMConfig Links []string Aliases []string // Aliases holds the list of extra, user-specified DNS names for this endpoint. - // MacAddress may be used to specify a MAC address when the container is created. - // Once the container is running, it becomes operational data (it may contain a - // generated address). - MacAddress string DriverOpts map[string]string // GwPriority determines which endpoint will provide the default gateway @@ -23,17 +19,24 @@ type EndpointSettings struct { // If multiple endpoints have the same priority, they are lexicographically // sorted based on their network name, and the one that sorts first is picked. GwPriority int + // Operational data - NetworkID string - EndpointID string - Gateway netip.Addr - IPAddress netip.Addr + + NetworkID string + EndpointID string + Gateway netip.Addr + IPAddress netip.Addr + + // MacAddress may be used to specify a MAC address when the container is created. + // Once the container is running, it becomes operational data (it may contain a + // generated address). + MacAddress string IPPrefixLen int IPv6Gateway netip.Addr GlobalIPv6Address netip.Addr GlobalIPv6PrefixLen int - // DNSNames holds all the (non fully qualified) DNS names associated to this endpoint. First entry is used to - // generate PTR records. + // DNSNames holds all the (non fully qualified) DNS names associated to this + // endpoint. The first entry is used to generate PTR records. DNSNames []string }