Skip to content

Commit 85645af

Browse files
Merge pull request #10 from Calsoft-Pvt-Ltd/v1.4.2.2_bug_fix
1225-Added Precheck for Invalid SNAT_IP
2 parents e6422f0 + 642c37b commit 85645af

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/core/vcd/vcdValidations.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3620,7 +3620,8 @@ def getEdgeGatewayNatConfig(self, edgeGatewayId, validation=True):
36203620
errorList = list()
36213621
natConfigDict = {
36223622
'Nat64 rule': [],
3623-
'Range of IPs or network found in DNAT rule': []
3623+
'Range of IPs or network found in DNAT rule': [],
3624+
'Invalid IP present in SNAT rule': []
36243625
}
36253626
logger.debug("Getting NAT Services Configuration Details of Source Edge Gateway")
36263627
# url to retrieve the nat config details of the specified edge gateway
@@ -3649,6 +3650,14 @@ def getEdgeGatewayNatConfig(self, edgeGatewayId, validation=True):
36493650
'Range of IPs or network found in this DNAT rule {} and range cannot be used in target edge gateway\n'.format(
36503651
natrule['ruleId']))
36513652
natConfigDict['Range of IPs or network found in DNAT rule'].append(natrule['ruleId'])
3653+
if natrule['action'] == "snat" and "/" in natrule['originalAddress']:
3654+
originalIP = natrule['originalAddress']
3655+
ip_part, mask = originalIP.split('/')
3656+
# Check if the IP is a network address
3657+
network = ipaddress.ip_network(originalIP, strict=False)
3658+
if ip_part != str(network.network_address):
3659+
errorList.append("Invalid IP present in SNAT rule {} ".format(natrule['ruleId']))
3660+
natConfigDict['Invalid IP present in SNAT rule'].append(natrule['ruleId'])
36523661
return errorList, natrules, natConfigDict
36533662
else:
36543663
return errorList, False, natConfigDict

src/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
---
2-
Build: v1.4.2.2
2+
Build: v1.4.2.2_bug_fix
33
ReleaseDate: 2023-12-21

0 commit comments

Comments
 (0)