Jelajahi Sumber

Added mac address to EndpointInfo

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
Jana Radhakrishnan 10 tahun lalu
induk
melakukan
a983569c0c
1 mengubah file dengan 6 tambahan dan 0 penghapusan
  1. 6 0
      libnetwork/drivers/bridge/bridge.go

+ 6 - 0
libnetwork/drivers/bridge/bridge.go

@@ -61,6 +61,7 @@ type ContainerConfiguration struct {
 type bridgeEndpoint struct {
 	id          types.UUID
 	intf        *sandbox.Interface
+	macAddress  net.HardwareAddr
 	config      *EndpointConfiguration // User specified parameters
 	portMapping []netutils.PortBinding // Operation port bindings
 }
@@ -424,6 +425,7 @@ func (d *driver) CreateEndpoint(nid, eid types.UUID, epOptions map[string]interf
 	if err != nil {
 		return nil, err
 	}
+	endpoint.macAddress = mac
 
 	// Add bridge inherited attributes to pipe interfaces
 	if config.Mtu != 0 {
@@ -614,6 +616,10 @@ func (d *driver) EndpointInfo(nid, eid types.UUID) (map[string]interface{}, erro
 		m[options.PortMap] = pmc
 	}
 
+	if len(ep.macAddress) != 0 {
+		m[options.MacAddress] = ep.macAddress
+	}
+
 	return m, nil
 }