Skip to content

Commit 1f542d5

Browse files
committed
Set EnableIPv4 for predefined networks
Signed-off-by: Rob Murray <[email protected]>
1 parent 903daa4 commit 1f542d5

4 files changed

Lines changed: 6 additions & 0 deletions

File tree

daemon/cluster/executor/container/container.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,13 +626,15 @@ func (c *containerConfig) networkCreateRequest(name string) (clustertypes.Networ
626626
return clustertypes.NetworkCreateRequest{}, errors.New("container: unknown network referenced")
627627
}
628628

629+
ipv4Enabled := true
629630
ipv6Enabled := na.Network.Spec.Ipv6Enabled
630631
options := network.CreateOptions{
631632
// ID: na.Network.ID,
632633
Labels: na.Network.Spec.Annotations.Labels,
633634
Internal: na.Network.Spec.Internal,
634635
Attachable: na.Network.Spec.Attachable,
635636
Ingress: convert.IsIngressNetwork(na.Network),
637+
EnableIPv4: &ipv4Enabled,
636638
EnableIPv6: &ipv6Enabled,
637639
Scope: scope.Swarm,
638640
}

daemon/daemon_unix.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,7 @@ func initBridgeDriver(controller *libnetwork.Controller, cfg config.BridgeConfig
10511051
}
10521052
// Initialize default network on "bridge" with the same name
10531053
_, err = controller.NewNetwork("bridge", network.NetworkBridge, "",
1054+
libnetwork.NetworkOptionEnableIPv4(true),
10541055
libnetwork.NetworkOptionEnableIPv6(cfg.EnableIPv6),
10551056
libnetwork.NetworkOptionDriverOpts(netOption),
10561057
libnetwork.NetworkOptionIpam("default", "", v4Conf, v6Conf, nil),

daemon/daemon_windows.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ func (daemon *Daemon) initNetworkController(daemonCfg *config.Config, activeSand
386386
_, err := daemon.netController.NewNetwork(strings.ToLower(v.Type), name, nid,
387387
libnetwork.NetworkOptionGeneric(options.Generic{
388388
netlabel.GenericData: netOption,
389+
netlabel.EnableIPv4: true,
389390
}),
390391
libnetwork.NetworkOptionIpam("default", "", v4Conf, v6Conf, nil),
391392
)
@@ -430,6 +431,7 @@ func initBridgeDriver(controller *libnetwork.Controller, config config.BridgeCon
430431
_, err := controller.NewNetwork(network.DefaultNetwork, network.DefaultNetwork, "",
431432
libnetwork.NetworkOptionGeneric(options.Generic{
432433
netlabel.GenericData: netOption,
434+
netlabel.EnableIPv4: true,
433435
}),
434436
ipamOption,
435437
)

libnetwork/default_gateway_linux.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func (c *Controller) createGWNetwork() (*Network, error) {
2020
bridge.EnableICC: strconv.FormatBool(false),
2121
bridge.EnableIPMasquerade: strconv.FormatBool(true),
2222
}),
23+
NetworkOptionEnableIPv4(true),
2324
NetworkOptionEnableIPv6(false),
2425
)
2526
if err != nil {

0 commit comments

Comments
 (0)