diff --git a/docker/routlin-dash/app/pages/radius/action.py b/docker/routlin-dash/app/pages/radius/action.py index d9e05ec..c67a4db 100644 --- a/docker/routlin-dash/app/pages/radius/action.py +++ b/docker/routlin-dash/app/pages/radius/action.py @@ -70,6 +70,7 @@ def auth_mode_save(): if eap_protocol not in ('eap_peap', 'eap_ttls', 'eap_md5'): eap_protocol = 'eap_peap' tunneled_reply = 'tunneled_reply' in request.form + include_length = 'include_length' in request.form inner_protocol = request.form.get('inner_protocol', '') _valid_inner = { @@ -87,10 +88,15 @@ def auth_mode_save(): after['inner_protocol'] = inner_protocol else: after.pop('inner_protocol', None) + if eap_protocol == 'eap_ttls': + after['include_length'] = include_length + else: + after.pop('include_length', None) else: after.pop('eap_protocol', None) after.pop('tunneled_reply', None) after.pop('inner_protocol', None) + after.pop('include_length', None) cfg.setdefault('radius', {})['options'] = after changes = diff_fields(before, after) diff --git a/docker/routlin-dash/app/pages/radius/content.json b/docker/routlin-dash/app/pages/radius/content.json index 3aadbc4..13181dc 100644 --- a/docker/routlin-dash/app/pages/radius/content.json +++ b/docker/routlin-dash/app/pages/radius/content.json @@ -272,6 +272,23 @@ "type": "raw_html", "html": "" }, + { + "type": "raw_html", + "html": "
" + }, + { + "type": "field", + "label": "", + "name": "include_length", + "input_type": "checkbox", + "checkbox_label": "Include Length", + "value": "%RADIUS_INCLUDE_LENGTH%", + "hint": "Include the total length of message in every packet." + }, + { + "type": "raw_html", + "html": "
" + }, { "type": "raw_html", "html": "" diff --git a/docker/routlin-dash/app/pages/radius/view.py b/docker/routlin-dash/app/pages/radius/view.py index 66487d9..d1b1983 100644 --- a/docker/routlin-dash/app/pages/radius/view.py +++ b/docker/routlin-dash/app/pages/radius/view.py @@ -119,7 +119,8 @@ def collect_tokens(cfg): tokens['RADIUS_LOGGING_HINT'] = 'Unchecking will clear logs.' if fr_gen.get('logging', False) else '' tokens['RADIUS_GEN_LOG_MAX_KB'] = str(fr_gen.get('log_max_kb', 1024)) - tokens['RADIUS_TUNNELED_REPLY'] = 'true' if fr_opts.get('tunneled_reply', False) else '' + tokens['RADIUS_TUNNELED_REPLY'] = 'true' if fr_opts.get('tunneled_reply', False) else '' + tokens['RADIUS_INCLUDE_LENGTH'] = 'true' if fr_opts.get('include_length', False) else '' vlans = cfg.get('vlans', []) default_vlan = next((v['name'] for v in vlans if v.get('radius_default') is True), '') diff --git a/routlin/mod_radius.py b/routlin/mod_radius.py index 383ebc2..ed464a0 100644 --- a/routlin/mod_radius.py +++ b/routlin/mod_radius.py @@ -295,6 +295,10 @@ def set_freeradius_eap(data): inner_block = 'peap' if eap_protocol == 'eap_peap' else 'ttls' content4 = _patch_setting_in_block(content4, inner_block, 'default_eap_type', inner_protocol) + if eap_protocol == 'eap_ttls': + il_val = 'yes' if opts.get('include_length', False) else 'no' + content4 = _patch_setting_in_block(content4, 'ttls', 'include_length', il_val) + if content4 == content: return False RADIUS_EAP_FILE.write_text(content4)