1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-21 00:19:42 +02:00

fix for scenarios where the default port range didn't always display, or overrode existing port ranges.

This commit is contained in:
Kelly Brazil
2021-04-26 12:04:03 -07:00
parent 72207c54ee
commit db8ddd7f0e
5 changed files with 11 additions and 17 deletions

Binary file not shown.

View File

@ -303,6 +303,8 @@ def _parse_to_from(linedata, direction, rule_obj=None):
linedata = linedata_list[0] linedata = linedata_list[0]
else: else:
rule_obj[direction + '_transport'] = 'any' rule_obj[direction + '_transport'] = 'any'
else:
rule_obj[direction + '_transport'] = 'any'
# pull out ipv4 or ipv6 addresses # pull out ipv4 or ipv6 addresses
linedata_list = linedata.split() linedata_list = linedata.split()
@ -364,17 +366,9 @@ def _parse_to_from(linedata, direction, rule_obj=None):
rule_obj[direction + '_ip_prefix'] = '0' rule_obj[direction + '_ip_prefix'] = '0'
# finally set default ports if no ports exist and there should be some # finally set default ports if no ports exist and there should be some
set_default = False
if direction + '_transport' in rule_obj: if direction + '_transport' in rule_obj:
if rule_obj[direction + '_transport'] in ['tcp', 'udp', 'any']: if rule_obj[direction + '_transport'] in ['tcp', 'udp', 'any']:
if not port_list and not port_ranges: if not port_list and not port_ranges:
set_default = True
else:
rule_obj[direction + '_transport'] = 'any'
set_default = True
if set_default:
rule_obj[direction + '_port_ranges'] = [ rule_obj[direction + '_port_ranges'] = [
{ {
'start': '0', 'start': '0',

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long