summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-wwan.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-06-13 19:55:10 +0200
committerChristian Poessinger <christian@poessinger.com>2021-06-13 19:55:10 +0200
commitc667a45a8fb06cb76c907348c4f1e3ec708b6e03 (patch)
tree182a6cf3619e3e54cac50976ffa8540845e559aa /src/conf_mode/interfaces-wwan.py
parent0361c3ac449f183476f7aee31439417d9f7f8012 (diff)
downloadvyos-1x-c667a45a8fb06cb76c907348c4f1e3ec708b6e03.tar.gz
vyos-1x-c667a45a8fb06cb76c907348c4f1e3ec708b6e03.zip
wwan: T3622: add support for APN authentication
Some APNs require a username/password. Add CLI nodes (matching the PPPoE syntax) for client authentication. One APN would be the IPv4/IPv6 APN from Deutsche Telekom (Germany) APN Name: Telekom Internet IPv6 APN: internet.v6.telekom Benutzername: telekom Passwort: tm
Diffstat (limited to 'src/conf_mode/interfaces-wwan.py')
-rwxr-xr-xsrc/conf_mode/interfaces-wwan.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/conf_mode/interfaces-wwan.py b/src/conf_mode/interfaces-wwan.py
index 02d2c723d..a477163b9 100755
--- a/src/conf_mode/interfaces-wwan.py
+++ b/src/conf_mode/interfaces-wwan.py
@@ -20,6 +20,7 @@ from sys import exit
from vyos.config import Config
from vyos.configdict import get_interface_dict
+from vyos.configverify import verify_authentication
from vyos.configverify import verify_interface_exists
from vyos.configverify import verify_vrf
from vyos.ifconfig import WWANIf
@@ -52,6 +53,7 @@ def verify(wwan):
raise ConfigError(f'No APN configured for "{ifname}"!')
verify_interface_exists(ifname)
+ verify_authentication(wwan)
verify_vrf(wwan)
return None
@@ -61,7 +63,7 @@ def generate(wwan):
def apply(wwan):
# we only need the modem number. wwan0 -> 0, wwan1 -> 1
- modem = wwan['ifname'].replace('wwan','')
+ modem = wwan['ifname'].lstrip('wwan')
base_cmd = f'mmcli --modem {modem}'
w = WWANIf(wwan['ifname'])
@@ -70,7 +72,12 @@ def apply(wwan):
cmd(f'{base_cmd} --simple-disconnect')
return None
- cmd(f'{base_cmd} --simple-connect=\"apn={wwan["apn"]}\"')
+ options = 'apn=' + wwan['apn']
+ if 'authentication' in wwan:
+ options += ',user={user},password={password}'.format(**wwan['authentication'])
+
+ command = f'{base_cmd} --simple-connect="{options}"'
+ cmd(command)
w.update(wwan)
return None