Development
This commit is contained in:
parent
e37029a066
commit
574a45111d
8 changed files with 164 additions and 110 deletions
|
|
@ -850,7 +850,7 @@ def validate_config(data):
|
|||
try:
|
||||
nat_addr = ipaddress.IPv4Address(nat_ip_str)
|
||||
for v in _all_vlans:
|
||||
if not v.get("restricted_vlan"):
|
||||
if v.get("restricted_vlan") not in ('q', 'c'):
|
||||
continue
|
||||
try:
|
||||
vnet = ipaddress.IPv4Network(f"{v['subnet']}/{v['subnet_mask']}", strict=False)
|
||||
|
|
@ -860,7 +860,7 @@ def validate_config(data):
|
|||
errors.append(
|
||||
f"Port forwarding rule '{desc}' is enabled but its destination "
|
||||
f"({nat_ip_str}) is on restricted VLAN '{v['name']}'. "
|
||||
f"Disable the rule or remove the restricted_vlan flag."
|
||||
f"Disable the rule or clear the VLAN restriction setting."
|
||||
)
|
||||
break
|
||||
except Exception:
|
||||
|
|
@ -959,7 +959,7 @@ def check_portfwd_restricted_vlan(nat_ip, vlans):
|
|||
except Exception:
|
||||
return None
|
||||
for v in vlans:
|
||||
if not v.get('restricted_vlan'):
|
||||
if v.get('restricted_vlan') not in ('q', 'c'):
|
||||
continue
|
||||
try:
|
||||
net = ipaddress.IPv4Network(f"{v['subnet']}/{v['subnet_mask']}", strict=False)
|
||||
|
|
@ -976,7 +976,7 @@ def disable_portfwd_on_restricted_vlans(data):
|
|||
Mutates data in place. Returns list of descriptions of rules that were disabled."""
|
||||
restricted_nets = []
|
||||
for v in data.get('vlans', []):
|
||||
if v.get('restricted_vlan'):
|
||||
if v.get('restricted_vlan') in ('q', 'c'):
|
||||
try:
|
||||
restricted_nets.append(ipaddress.IPv4Network(f"{v['subnet']}/{v['subnet_mask']}", strict=False))
|
||||
except Exception:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue