From 48e8bf1b8f3d2750f215765f583c847ff02deca2 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sat, 12 Mar 2022 14:39:18 +0100 Subject: [PATCH] uqmi: support split-APN IPv4 and IPv6 dual-stack Add two new "v6apn" and "v6profile" properties, to support split-APN dual-stack onfiguration. This extends the existing ipv4v6 PDP type, allowing simultaneous connection to two distinct APNs, one for IPv4 and one for IPv6. The parameters override existing 'apn' and 'profile' respectively, if set, but only for IPv6 part of the connection. If unset, they default to their original values, constituting a standard IPv4v6 setup. If a different APN is set for IPv6, a corresponding profile MUST also be configured, with a different ID, than the IPv4 profile, for example, profile 2. Both APNs must match ones configured through QMI or through 'AT+CGDCONT' command. Example configuration in UCI: config interface 'wan' option proto 'qmi' option device '/dev/cdc-wdm0' option autoconnect '1' option pdptype 'ipv4v6' option apn 'internet' option v6apn 'internetipv6' option profile '1' option v6profile '2' Corresponding profile configuration: AT+CGDCONT? +CGDCONT: 1,"IP","internet","0.0.0.0",0,0,0,0 +CGDCONT: 2,"IPV6","internetipv6","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0 Signed-off-by: Lech Perczak --- .../utils/uqmi/files/lib/netifd/proto/qmi.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh index c271cb8660..fd90d581e1 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -11,6 +11,7 @@ proto_qmi_init_config() { no_device=1 proto_config_add_string "device:device" proto_config_add_string apn + proto_config_add_string v6apn proto_config_add_string auth proto_config_add_string username proto_config_add_string password @@ -19,6 +20,7 @@ proto_qmi_init_config() { proto_config_add_string modes proto_config_add_string pdptype proto_config_add_int profile + proto_config_add_int v6profile proto_config_add_boolean dhcp proto_config_add_boolean dhcpv6 proto_config_add_boolean autoconnect @@ -31,14 +33,14 @@ proto_qmi_init_config() { proto_qmi_setup() { local interface="$1" local dataformat connstat plmn_mode mcc mnc - local device apn auth username password pincode delay modes pdptype - local profile dhcp dhcpv6 autoconnect plmn timeout mtu $PROTO_DEFAULT_OPTIONS + local device apn v6apn auth username password pincode delay modes pdptype + local profile v6profile dhcp dhcpv6 autoconnect plmn timeout mtu $PROTO_DEFAULT_OPTIONS local ip4table ip6table local cid_4 pdh_4 cid_6 pdh_6 local ip_6 ip_prefix_length gateway_6 dns1_6 dns2_6 - json_get_vars device apn auth username password pincode delay modes - json_get_vars pdptype profile dhcp dhcpv6 autoconnect plmn ip4table + json_get_vars device apn v6apn auth username password pincode delay modes + json_get_vars pdptype profile v6profile dhcp dhcpv6 autoconnect plmn ip4table json_get_vars ip6table timeout mtu $PROTO_DEFAULT_OPTIONS [ "$timeout" = "" ] && timeout="10" @@ -309,10 +311,13 @@ proto_qmi_setup() { uqmi -s -d "$device" --set-client-id wds,"$cid_6" --set-ip-family ipv6 > /dev/null 2>&1 + : "${v6apn:=${apn}}" + : "${v6profile:=${profile}}" + pdh_6=$(uqmi -s -d "$device" --set-client-id wds,"$cid_6" \ --start-network \ - ${apn:+--apn $apn} \ - ${profile:+--profile $profile} \ + ${v6apn:+--apn $v6apn} \ + ${v6profile:+--profile $v6profile} \ ${auth:+--auth-type $auth} \ ${username:+--username $username} \ ${password:+--password $password} \ -- 2.30.2