Set the bip network value as the subnet
| ... | ... |
@@ -1008,11 +1008,11 @@ func initBridgeDriver(controller libnetwork.NetworkController, config *config.Co |
| 1008 | 1008 |
} |
| 1009 | 1009 |
|
| 1010 | 1010 |
if config.BridgeConfig.IP != "" {
|
| 1011 |
- ipamV4Conf.PreferredPool = config.BridgeConfig.IP |
|
| 1012 |
- ip, _, err := net.ParseCIDR(config.BridgeConfig.IP) |
|
| 1011 |
+ ip, ipNet, err := net.ParseCIDR(config.BridgeConfig.IP) |
|
| 1013 | 1012 |
if err != nil {
|
| 1014 | 1013 |
return err |
| 1015 | 1014 |
} |
| 1015 |
+ ipamV4Conf.PreferredPool = ipNet.String() |
|
| 1016 | 1016 |
ipamV4Conf.Gateway = ip.String() |
| 1017 | 1017 |
} else if bridgeName == bridge.DefaultBridgeName && ipamV4Conf.PreferredPool != "" {
|
| 1018 | 1018 |
logrus.Infof("Default bridge (%s) is assigned with an IP address %s. Daemon option --bip can be used to set a preferred IP address", bridgeName, ipamV4Conf.PreferredPool)
|
| ... | ... |
@@ -193,7 +193,7 @@ func TestDaemonWithBipAndDefaultNetworkPool(t *testing.T) {
|
| 193 | 193 |
out, err := c.NetworkInspect(context.Background(), "bridge", types.NetworkInspectOptions{})
|
| 194 | 194 |
assert.NilError(t, err) |
| 195 | 195 |
// Make sure BIP IP doesn't get override with new default address pool . |
| 196 |
- assert.Equal(t, out.IPAM.Config[0].Subnet, "172.60.0.1/16") |
|
| 196 |
+ assert.Equal(t, out.IPAM.Config[0].Subnet, "172.60.0.0/16") |
|
| 197 | 197 |
delInterface(t, defaultNetworkBridge) |
| 198 | 198 |
} |
| 199 | 199 |
|