Development
This commit is contained in:
parent
6d8be4845e
commit
bc623b14fc
5 changed files with 64 additions and 49 deletions
|
|
@ -33,8 +33,8 @@ def _parse_entry():
|
|||
protocol = sanitize.filtervalue(request.form.get('protocol', ''), validate.VALID_PROTOCOLS)
|
||||
src_raw = request.form.get('src_ip_or_subnet', '').strip()
|
||||
dst_raw = request.form.get('dst_ip_or_subnet', '').strip()
|
||||
dst_port_min_raw = request.form.get('dst_port_min', '').strip()
|
||||
dst_port_max_raw = request.form.get('dst_port_max', '').strip()
|
||||
dest_port_start_raw = request.form.get('dest_port_start', '').strip()
|
||||
dest_port_end_raw = request.form.get('dest_port_end', '').strip()
|
||||
|
||||
if not protocol:
|
||||
flash(f'The configuration has not been saved because the protocol is invalid. '
|
||||
|
|
@ -57,21 +57,21 @@ def _parse_entry():
|
|||
flash(f'The configuration has not been saved because "{dst_raw}" is not a valid IP address or subnet.', 'error')
|
||||
return None, True
|
||||
|
||||
dst_port_min = ''
|
||||
if dst_port_min_raw:
|
||||
dst_port_min = validate.port(dst_port_min_raw)
|
||||
if not dst_port_min:
|
||||
flash(f'The configuration has not been saved because "{dst_port_min_raw}" is not a valid port number (1-65535).', 'error')
|
||||
dest_port_start = ''
|
||||
if dest_port_start_raw:
|
||||
dest_port_start = validate.port(dest_port_start_raw)
|
||||
if not dest_port_start:
|
||||
flash(f'The configuration has not been saved because "{dest_port_start_raw}" is not a valid port number (1-65535).', 'error')
|
||||
return None, True
|
||||
|
||||
dst_port_max = ''
|
||||
if dst_port_max_raw:
|
||||
dst_port_max = validate.port(dst_port_max_raw)
|
||||
if not dst_port_max:
|
||||
flash(f'The configuration has not been saved because "{dst_port_max_raw}" is not a valid port number (1-65535).', 'error')
|
||||
dest_port_end = ''
|
||||
if dest_port_end_raw:
|
||||
dest_port_end = validate.port(dest_port_end_raw)
|
||||
if not dest_port_end:
|
||||
flash(f'The configuration has not been saved because "{dest_port_end_raw}" is not a valid port number (1-65535).', 'error')
|
||||
return None, True
|
||||
|
||||
if dst_port_min and dst_port_max and int(dst_port_min) > int(dst_port_max):
|
||||
if dest_port_start and dest_port_end and int(dest_port_start) > int(dest_port_end):
|
||||
flash('Port range min must not be greater than max.', 'error')
|
||||
return None, True
|
||||
|
||||
|
|
@ -80,8 +80,8 @@ def _parse_entry():
|
|||
'protocol': protocol,
|
||||
'src_ip_or_subnet': src,
|
||||
'dst_ip_or_subnet': dst,
|
||||
'dst_port_min': dst_port_min,
|
||||
'dst_port_max': dst_port_max,
|
||||
'dest_port_start': dest_port_start,
|
||||
'dest_port_end': dest_port_end,
|
||||
'enabled': True,
|
||||
}, None
|
||||
|
||||
|
|
|
|||
|
|
@ -39,13 +39,13 @@
|
|||
"class": "col-mono"
|
||||
},
|
||||
{
|
||||
"label": "Port Min",
|
||||
"field": "dst_port_min",
|
||||
"label": "Port Start",
|
||||
"field": "dest_port_start",
|
||||
"class": "col-mono col-narrow"
|
||||
},
|
||||
{
|
||||
"label": "Port Max",
|
||||
"field": "dst_port_max",
|
||||
"label": "Port End",
|
||||
"field": "dest_port_end",
|
||||
"class": "col-mono col-narrow"
|
||||
},
|
||||
{
|
||||
|
|
@ -80,11 +80,11 @@
|
|||
"input_type": "text"
|
||||
},
|
||||
{
|
||||
"col": "dst_port_min",
|
||||
"col": "dest_port_start",
|
||||
"input_type": "number"
|
||||
},
|
||||
{
|
||||
"col": "dst_port_max",
|
||||
"col": "dest_port_end",
|
||||
"input_type": "number"
|
||||
},
|
||||
{
|
||||
|
|
@ -159,7 +159,7 @@
|
|||
{
|
||||
"type": "field",
|
||||
"label": "Dest Port Range Start",
|
||||
"name": "dst_port_min",
|
||||
"name": "dest_port_start",
|
||||
"input_type": "number",
|
||||
"min": 1,
|
||||
"max": 65535
|
||||
|
|
@ -167,7 +167,7 @@
|
|||
{
|
||||
"type": "field",
|
||||
"label": "Dest Port Range End",
|
||||
"name": "dst_port_max",
|
||||
"name": "dest_port_end",
|
||||
"input_type": "number",
|
||||
"min": 1,
|
||||
"max": 65535
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue