diff options
-rw-r--r-- | data/templates/accel-ppp/pppoe.config.tmpl | 14 | ||||
-rw-r--r-- | interface-definitions/service_pppoe-server.xml.in | 39 | ||||
-rw-r--r-- | python/vyos/util.py | 4 | ||||
-rwxr-xr-x | src/conf_mode/container.py | 8 |
4 files changed, 64 insertions, 1 deletions
diff --git a/data/templates/accel-ppp/pppoe.config.tmpl b/data/templates/accel-ppp/pppoe.config.tmpl index b37004f5b..3e5c64eb8 100644 --- a/data/templates/accel-ppp/pppoe.config.tmpl +++ b/data/templates/accel-ppp/pppoe.config.tmpl @@ -17,6 +17,10 @@ net-snmp {% if limits is defined %} connlimit {% endif %} +{% if extended_scripts is defined %} +sigchld +pppd_compat +{% endif %} [core] thread-count={{ thread_count }} @@ -167,5 +171,15 @@ timeout={{ limits.timeout }} {# Common RADIUS shaper configuration #} {% include 'accel-ppp/config_shaper_radius.j2' %} +{% if extended_scripts is defined %} +[pppd-compat] +verbose=1 +radattr-prefix=/run/accel-pppd/radattr +{% set script_name = {'on_up': 'ip-up', 'on_down': 'ip-down', 'on_change':'ip-change', 'on_pre_up':'ip-pre-up'} %} +{% for script in extended_scripts %} +{{ script_name[script] }}={{ extended_scripts[script] }} +{% endfor %} +{% endif %} + [cli] tcp=127.0.0.1:2001 diff --git a/interface-definitions/service_pppoe-server.xml.in b/interface-definitions/service_pppoe-server.xml.in index 65868226b..876aadcf7 100644 --- a/interface-definitions/service_pppoe-server.xml.in +++ b/interface-definitions/service_pppoe-server.xml.in @@ -340,6 +340,45 @@ </leafNode> </children> </node> + <node name="extended-scripts"> + <properties> + <help>Extended script execution</help> + </properties> + <children> + <leafNode name="on-pre-up"> + <properties> + <help>Script to run before PPPoE session interface comes up</help> + <constraint> + <validator name="script"/> + </constraint> + </properties> + </leafNode> + <leafNode name="on-up"> + <properties> + <help>Script to run when PPPoE session interface is completely configured and started</help> + <constraint> + <validator name="script"/> + </constraint> + </properties> + </leafNode> + <leafNode name="on-down"> + <properties> + <help>Script to run when PPPoE session interface going to terminate</help> + <constraint> + <validator name="script"/> + </constraint> + </properties> + </leafNode> + <leafNode name="on-change"> + <properties> + <help>Script to run when PPPoE session interface changed by RADIUS CoA handling</help> + <constraint> + <validator name="script"/> + </constraint> + </properties> + </leafNode> + </children> + </node> </children> </node> </children> diff --git a/python/vyos/util.py b/python/vyos/util.py index 4df046a36..03809fc83 100644 --- a/python/vyos/util.py +++ b/python/vyos/util.py @@ -349,9 +349,11 @@ def colon_separated_to_dict(data_string, uniquekeys=False): l = l.strip() if l: match = re.match(key_value_re, l) - if match: + if match and (len(match.groups()) == 2): key = match.groups()[0].strip() value = match.groups()[1].strip() + else: + raise ValueError(f"""Line "{l}" could not be parsed a colon-separated pair """, l) if key in data.keys(): if uniquekeys: raise ValueError("Data string has duplicate keys: {0}".format(key)) diff --git a/src/conf_mode/container.py b/src/conf_mode/container.py index 667d08f8c..6284caa97 100755 --- a/src/conf_mode/container.py +++ b/src/conf_mode/container.py @@ -25,6 +25,7 @@ from vyos.config import Config from vyos.configdict import dict_merge from vyos.configdict import node_changed from vyos.configdict import is_node_changed +from vyos.ifconfig import Interface from vyos.util import call from vyos.util import cmd from vyos.util import dict_search @@ -466,6 +467,13 @@ def apply(container): if disabled_new: call('systemctl daemon-reload') + if 'network' in container: + for network, network_config in container['network'].items(): + network_name = f'pod-{network}' + if os.path.exists(f'/sys/class/net/{network_name}'): + tmp = Interface(network_name) + tmp.add_ipv6_eui64_address('fe80::/64') + return None if __name__ == '__main__': |