Skip to content

Commit 1966871

Browse files
author
Jayapal
committed
CLOUDSTACK-6761: Fixed removing proxy arp rule on deleting static nat or PF rule on ip
The proxy-arp add/del is done on firewall rule add/del. The proxy-arp rule is deleted only when there is no static nat or dest nat rule is not using the ip. When there is static nat or PF and firewall rule a. Delete firewall rule. It skips delete proxy-arp because the rule is used by static nat rule. b. After deleting fw rule if we disable static nat there is no way to delete proxy-arp rule. On VM expunge we are deleting firewall rules first then static nat rules. This caused the stale proxy-arp rules. With this fix adding/deleting proxy arp rule on static nat/PF rule add/del.
1 parent 0cc826a commit 1966871

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,7 @@ private Answer execute(SetStaticNatRulesCommand cmd, int numRetries) {
965965
private void addStaticNatRule(Long publicVlanTag, String publicIp, String privateIp, List<FirewallRuleTO> rules) throws ExecutionException {
966966
manageStaticNatRule(SrxCommand.ADD, publicIp, privateIp);
967967
manageAddressBookEntry(SrxCommand.ADD, _privateZone, privateIp, null);
968+
manageProxyArp(SrxCommand.ADD, publicVlanTag, publicIp);
968969

969970
// Add a new security policy with the current set of applications
970971
addSecurityPolicyAndApplications(SecurityPolicyType.STATIC_NAT, privateIp, extractApplications(rules));
@@ -979,6 +980,7 @@ private void removeStaticNatRule(Long publicVlanTag, String publicIp, String pri
979980
removeSecurityPolicyAndApplications(SecurityPolicyType.STATIC_NAT, privateIp);
980981

981982
manageAddressBookEntry(SrxCommand.DELETE, _privateZone, privateIp, null);
983+
manageProxyArp(SrxCommand.DELETE, publicVlanTag, publicIp);
982984

983985
s_logger.debug("Removed static NAT rule for public IP " + publicIp + ", and private IP " + privateIp);
984986
}
@@ -1248,6 +1250,7 @@ private void addDestinationNatRule(Protocol protocol, Long publicVlanTag, String
12481250
List<Object[]> applications = new ArrayList<Object[]>();
12491251
applications.add(new Object[] {protocol, destPortStart, destPortEnd});
12501252
addSecurityPolicyAndApplications(SecurityPolicyType.DESTINATION_NAT, privateIp, applications);
1253+
manageProxyArp(SrxCommand.ADD, publicVlanTag, publicIp);
12511254

12521255
String srcPortRange = srcPortStart + "-" + srcPortEnd;
12531256
String destPortRange = destPortStart + "-" + destPortEnd;
@@ -1258,6 +1261,7 @@ private void addDestinationNatRule(Protocol protocol, Long publicVlanTag, String
12581261
private void removeDestinationNatRule(Long publicVlanTag, String publicIp, String privateIp, int srcPort, int destPort) throws ExecutionException {
12591262
manageDestinationNatRule(SrxCommand.DELETE, publicIp, privateIp, srcPort, destPort);
12601263
manageDestinationNatPool(SrxCommand.DELETE, privateIp, destPort);
1264+
manageProxyArp(SrxCommand.DELETE, publicVlanTag, publicIp);
12611265

12621266
removeSecurityPolicyAndApplications(SecurityPolicyType.DESTINATION_NAT, privateIp);
12631267

0 commit comments

Comments
 (0)