Skip to content

Commit 0902234

Browse files
JayapalDaanHoogland
authored andcommitted
CLOUDSTACK-7027: Removing left over static nat rule
(cherry picked from commit a69c1ee)
1 parent d5a9245 commit 0902234

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3391,15 +3391,28 @@ public int compare(final PublicIpAddress o1, final PublicIpAddress o2) {
33913391
final IpAddressTO[] ipsToSend = new IpAddressTO[ipAddrList.size()];
33923392
int i = 0;
33933393
boolean firstIP = true;
3394+
boolean isSourceNatNw = false;
33943395

33953396
for (final PublicIpAddress ipAddr : ipAddrList) {
33963397

33973398
final boolean add = (ipAddr.getState() == IpAddress.State.Releasing ? false : true);
33983399
boolean sourceNat = ipAddr.isSourceNat();
3400+
3401+
//set the isSourceNatNw from the first ip of ipAddrList
3402+
//For non source network ips the isSourceNatNw is always false
3403+
if (sourceNat) {
3404+
isSourceNatNw = ipAddr.isSourceNat();
3405+
}
3406+
33993407
/* enable sourceNAT for the first ip of the public interface */
34003408
if (firstIP) {
34013409
sourceNat = true;
34023410
}
3411+
3412+
// setting sourceNat=true to make sure the snat rule of the ip is deleted
3413+
if (!isSourceNatNw && !add ) {
3414+
sourceNat = true;
3415+
}
34033416
final String vlanId = ipAddr.getVlanTag();
34043417
final String vlanGateway = ipAddr.getGateway();
34053418
final String vlanNetmask = ipAddr.getNetmask();

0 commit comments

Comments
 (0)