Skip to content

Commit a9012e8

Browse files
authored
Revert "change apipa network gw address from .1 to .2 (#2933)"
This reverts commit 7d6ce69.
1 parent 20d09ab commit a9012e8

File tree

2 files changed

+2
-53
lines changed

2 files changed

+2
-53
lines changed

cns/hnsclient/hnsclient_windows.go

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"github.com/pkg/errors"
1818
)
1919

20-
// TODO redesign hnsclient on windows
2120
const (
2221
// Name of the external hns network
2322
ExtHnsNetworkName = "ext"
@@ -53,9 +52,6 @@ const (
5352
// Name of the loopback adapter needed to create Host NC apipa network
5453
hostNCLoopbackAdapterName = "LoopbackAdapterHostNCConnectivity"
5554

56-
// HNS rehydration issue requires this GW to be different than the loopback adapter ip, so we set it to .2
57-
defaultHnsGwIPAddress = "169.254.128.2"
58-
hnsLoopbackAdapterIPAddress = "169.254.128.1"
5955
// protocolTCP indicates the TCP protocol identifier in HCN
6056
protocolTCP = "6"
6157

@@ -304,7 +300,7 @@ func createHostNCApipaNetwork(
304300
if interfaceExists, _ := networkcontainers.InterfaceExists(hostNCLoopbackAdapterName); !interfaceExists {
305301
ipconfig := cns.IPConfiguration{
306302
IPSubnet: cns.IPSubnet{
307-
IPAddress: hnsLoopbackAdapterIPAddress,
303+
IPAddress: localIPConfiguration.GatewayIPAddress,
308304
PrefixLength: localIPConfiguration.IPSubnet.PrefixLength,
309305
},
310306
GatewayIPAddress: localIPConfiguration.GatewayIPAddress,
@@ -513,7 +509,7 @@ func configureHostNCApipaEndpoint(
513509
endpointPolicies, err := configureAclSettingHostNCApipaEndpoint(
514510
protocolList,
515511
networkContainerApipaIP,
516-
hnsLoopbackAdapterIPAddress,
512+
hostApipaIP,
517513
allowNCToHostCommunication,
518514
allowHostToNCCommunication,
519515
ncPolicies)
@@ -576,7 +572,6 @@ func CreateHostNCApipaEndpoint(
576572
return endpoint.Id, nil
577573
}
578574

579-
updateGwForLocalIPConfiguration(&localIPConfiguration)
580575
if network, err = createHostNCApipaNetwork(localIPConfiguration); err != nil {
581576
logger.Errorf("[Azure CNS] Failed to create HostNCApipaNetwork. Error: %v", err)
582577
return "", err
@@ -608,17 +603,6 @@ func CreateHostNCApipaEndpoint(
608603
return endpoint.Id, nil
609604
}
610605

611-
// updateGwForLocalIPConfiguration applies change on gw IP address for apipa NW and endpoint.
612-
// Currently, cns using the same ip address "169.254.128.1" for both apipa gw and loopback adapter. This cause conflict issue when hns get restarted and not able to rehydrate the apipa endpoints.
613-
// This func is to overwrite the address to 169.254.128.2 when the gateway address is 169.254.128.1
614-
func updateGwForLocalIPConfiguration(localIPConfiguration *cns.IPConfiguration) {
615-
// When gw address is 169.254.128.1, should use .2 instead. If gw address is not .1, that mean this value is
616-
// configured from dnc, we should keep it
617-
if localIPConfiguration.GatewayIPAddress == "169.254.128.1" {
618-
localIPConfiguration.GatewayIPAddress = defaultHnsGwIPAddress
619-
}
620-
}
621-
622606
func getHostNCApipaEndpointName(
623607
networkContainerID string) string {
624608
return hostNCApipaEndpointNamePrefix + "-" + networkContainerID

cns/hnsclient/hnsclient_windows_test.go

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)