summaryrefslogtreecommitdiff
path: root/data/templates/pppoe/ip-pre-up.script.tmpl
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-04 11:30:10 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-04 11:30:41 +0200
commitb250b233ec136cfe2655c4de8d18468cd1959083 (patch)
tree8beaa08222d79b11ee068f465acd83e85bb226ca /data/templates/pppoe/ip-pre-up.script.tmpl
parent25bfece386756cbd40b83bc26141edddb0e05c72 (diff)
downloadvyos-1x-b250b233ec136cfe2655c4de8d18468cd1959083.tar.gz
vyos-1x-b250b233ec136cfe2655c4de8d18468cd1959083.zip
pppoe: T1318: move Jinja2 templates to data/templates folder
This makes the actual code which generates the configs much more human readable.
Diffstat (limited to 'data/templates/pppoe/ip-pre-up.script.tmpl')
-rw-r--r--data/templates/pppoe/ip-pre-up.script.tmpl19
1 files changed, 19 insertions, 0 deletions
diff --git a/data/templates/pppoe/ip-pre-up.script.tmpl b/data/templates/pppoe/ip-pre-up.script.tmpl
new file mode 100644
index 000000000..f72781e41
--- /dev/null
+++ b/data/templates/pppoe/ip-pre-up.script.tmpl
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# As PPPoE is an "on demand" interface we need to re-configure it when it
+# becomes up
+
+if [ "$6" != "{{ intf }}" ]; then
+ exit
+fi
+
+# add some info to syslog
+DIALER_PID=$(cat /var/run/{{ intf }}.pid)
+logger -t pppd[$DIALER_PID] "executing $0"
+
+echo "{{ description }}" > /sys/class/net/{{ intf }}/ifalias
+
+{% if vrf -%}
+logger -t pppd[$DIALER_PID] "configuring dialer interface $6 for VRF {{ vrf }}"
+ip link set dev {{ intf }} master {{ vrf }}
+{% endif %}