summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-pppoe.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-03 18:26:56 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-03 18:27:13 +0200
commit7b25dcec95937a3669c02152e934402e5f0c4221 (patch)
treedd6a6617cc7c23d04acc4a90fc0017a59d56c0b9 /src/conf_mode/interfaces-pppoe.py
parentd1004bbafb12054c6e5ca02a45fcc08a3d332001 (diff)
downloadvyos-1x-7b25dcec95937a3669c02152e934402e5f0c4221.tar.gz
vyos-1x-7b25dcec95937a3669c02152e934402e5f0c4221.zip
pppoe: T1318: minor cleanups
Diffstat (limited to 'src/conf_mode/interfaces-pppoe.py')
-rwxr-xr-xsrc/conf_mode/interfaces-pppoe.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/conf_mode/interfaces-pppoe.py b/src/conf_mode/interfaces-pppoe.py
index d432377e8..9c045534c 100755
--- a/src/conf_mode/interfaces-pppoe.py
+++ b/src/conf_mode/interfaces-pppoe.py
@@ -110,15 +110,11 @@ if [ "$6" != "{{ intf }}" ]; then
exit
fi
+{% if ipv6_autoconf -%}
# add some info to syslog
DIALER_PID=$(cat /var/run/{{ intf }}.pid)
logger -t pppd[$DIALER_PID] "executing $0"
-logger -t pppd[$DIALER_PID] "configuring dialer interface $6 via $2"
-
-echo "{{ description }}" > /sys/class/net/{{ intf }}/ifalias
-
-{% if ipv6_autoconf -%}
-
+logger -t pppd[$DIALER_PID] "configuring interface {{ intf }} via $2"
# Configure interface-specific Host/Router behaviour.
# Note: It is recommended to have the same setting on all interfaces; mixed
@@ -161,6 +157,8 @@ fi
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 }}
@@ -303,9 +301,10 @@ def verify(pppoe):
return None
def generate(pppoe):
- config_file_pppoe = f"/etc/ppp/peers/{pppoe['intf']}"
- ip_up_script_file = f"/etc/ppp/ip-up.d/9990-vyos-vrf-{pppoe['intf']}"
- ipv6_if_up_script_file = f"/etc/ppp/ipv6-up.d/50-vyos-{pppoe['intf']}-autoconf"
+ intf = pppoe['intf']
+ config_file_pppoe = f'/etc/ppp/peers/{intf}'
+ ip_up_script_file = f'/etc/ppp/ip-up.d/9990-vyos-vrf-{intf}'
+ ipv6_if_up_script_file = f'/etc/ppp/ipv6-up.d/9990-vyos-autoconf-{intf}'
config_files = [config_file_pppoe, ip_up_script_file, ipv6_if_up_script_file]
@@ -316,7 +315,7 @@ def generate(pppoe):
os.mkdir(dirname)
# Always hang-up PPPoE connection prior generating new configuration file
- cmd = f"systemctl stop ppp@{pppoe['intf']}.service"
+ cmd = f'systemctl stop ppp@{intf}.service'
subprocess_cmd(cmd)
if pppoe['deleted']:
@@ -354,8 +353,9 @@ def apply(pppoe):
return None
if not pppoe['disable']:
- # dial PPPoE connection
- cmd = f"systemctl start ppp@{pppoe['intf']}.service"
+ # "dial" PPPoE connection
+ intf = pppoe['intf']
+ cmd = f'systemctl start ppp@{intf}.service'
subprocess_cmd(cmd)
# make logfile owned by root / vyattacfg