From df82afa755454179d9699a9f1488477bdb84ec5d Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Tue, 7 Mar 2023 08:44:30 +0000 Subject: T5057: Fix IPoE regex Jinja2 for interface Fix incorrect regex '\d+' when used vlan ranges For example 'ipoe-server interface eth1 vlan 2000-3000' - replace 'interface=re:eth1\.\d+' => 'interface=re:^eth1\.(200\d|20[1-9]\d|2[1-9]\d{2}|3000)$' --- data/templates/accel-ppp/ipoe.config.j2 | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/data/templates/accel-ppp/ipoe.config.j2 b/data/templates/accel-ppp/ipoe.config.j2 index 179f2277b..2a2367b69 100644 --- a/data/templates/accel-ppp/ipoe.config.j2 +++ b/data/templates/accel-ppp/ipoe.config.j2 @@ -25,7 +25,7 @@ verbose=1 {% for iface, iface_config in interface.items() %} {% set tmp = 'interface=' %} {% if iface_config.vlan is vyos_defined %} -{% set tmp = tmp ~ 're:' ~ iface ~ '\.\d+' %} +{% set tmp = tmp ~ 're:^' ~ iface ~ '\.' ~ iface_config.vlan | range_to_regex ~ '$' %} {% else %} {% set tmp = tmp ~ iface %} {% endif %} @@ -36,6 +36,9 @@ verbose=1 {% set shared = 'shared=0,' %} {% endif %} {{ tmp }},{{ shared }}mode={{ iface_config.mode | upper }},ifcfg=1,range={{ iface_config.client_subnet }},start=dhcpv4,ipv6=1 +{% if iface_config.vlan is vyos_defined %} +vlan-mon={{ iface }},{{ iface_config.vlan | join(',') }} +{% endif %} {% endfor %} {% endif %} {% if authentication.mode is vyos_defined('noauth') %} @@ -54,12 +57,6 @@ password=csid {% endif %} proxy-arp=1 -{% for iface, iface_options in interface.items() %} -{% if iface_options.network is vyos_defined('vlan') %} -vlan-mon={{ iface }},{{ iface_options.vlan | join(',') }} -{% endif %} -{% endfor %} - {% if client_ip_pool.name is vyos_defined %} [ip-pool] {% for pool, pool_options in client_ip_pool.name.items() %} -- cgit v1.2.3