aboutsummaryrefslogtreecommitdiffstats
path: root/package/network
diff options
context:
space:
mode:
authorFilip Moc <lede@moc6.cz>2020-11-18 20:36:12 +0100
committerDaniel Golle <daniel@makrotopia.org>2020-11-22 21:13:39 +0000
commit9ebbb5511392571c008f92f37bf477d04c2f4d88 (patch)
treeb40788e2d08718ca6b1f508bcff6eb390bab77e8 /package/network
parent2b3a0cabea33763775dbc4b8aab5f54a377bd71e (diff)
downloadupstream-9ebbb5511392571c008f92f37bf477d04c2f4d88.tar.gz
upstream-9ebbb5511392571c008f92f37bf477d04c2f4d88.tar.bz2
upstream-9ebbb5511392571c008f92f37bf477d04c2f4d88.zip
uqmi: add support for IPv4 autoconf from QMI
There already was an option for autoconfiguring IPv4 from QMI but this was removed by commit 3b9b963e6e08 ("uqmi: always use DHCP for IPv4"). DHCP does not work on MR400 LTE module (in TL-MR6400 v4) so let's readd support for IPv4 autoconf from QMI but this time allow to configure this for IPv4 and IPv6 independently and keep DHCP default on IPv4. Signed-off-by: Filip Moc <lede@moc6.cz>
Diffstat (limited to 'package/network')
-rw-r--r--package/network/utils/uqmi/Makefile2
-rwxr-xr-xpackage/network/utils/uqmi/files/lib/netifd/proto/qmi.sh49
2 files changed, 39 insertions, 12 deletions
diff --git a/package/network/utils/uqmi/Makefile b/package/network/utils/uqmi/Makefile
index dee4bd051e..4a15a15c19 100644
--- a/package/network/utils/uqmi/Makefile
+++ b/package/network/utils/uqmi/Makefile
@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=uqmi
-PKG_RELEASE:=7
+PKG_RELEASE:=8
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/uqmi.git
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 31c2656142..a77523cd40 100755
--- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
+++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
@@ -19,6 +19,7 @@ proto_qmi_init_config() {
proto_config_add_string modes
proto_config_add_string pdptype
proto_config_add_int profile
+ proto_config_add_boolean dhcp
proto_config_add_boolean dhcpv6
proto_config_add_boolean autoconnect
proto_config_add_int plmn
@@ -31,13 +32,13 @@ proto_qmi_setup() {
local interface="$1"
local dataformat connstat
local device apn auth username password pincode delay modes pdptype
- local profile dhcpv6 autoconnect plmn timeout mtu $PROTO_DEFAULT_OPTIONS
+ local profile 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 dhcpv6 autoconnect plmn ip4table
+ json_get_vars pdptype profile dhcp dhcpv6 autoconnect plmn ip4table
json_get_vars ip6table timeout mtu $PROTO_DEFAULT_OPTIONS
[ "$timeout" = "" ] && timeout="10"
@@ -353,15 +354,41 @@ proto_qmi_setup() {
}
[ -n "$pdh_4" ] && {
- json_init
- json_add_string name "${interface}_4"
- json_add_string ifname "@$interface"
- json_add_string proto "dhcp"
- [ -n "$ip4table" ] && json_add_string ip4table "$ip4table"
- proto_add_dynamic_defaults
- [ -n "$zone" ] && json_add_string zone "$zone"
- json_close_object
- ubus call network add_dynamic "$(json_dump)"
+ if [ "$dhcp" = 0 ]; then
+ json_load "$(uqmi -s -d $device --set-client-id wds,$cid_4 --get-current-settings)"
+ json_select ipv4
+ json_get_var ip_4 ip
+ json_get_var gateway_4 gateway
+ json_get_var dns1_4 dns1
+ json_get_var dns2_4 dns2
+ json_get_var subnet_4 subnet
+
+ proto_init_update "$ifname" 1
+ proto_set_keep 1
+ proto_add_ipv4_address "$ip_4" "$subnet_4"
+ proto_add_ipv4_route "$gateway_4" "128"
+ [ "$defaultroute" = 0 ] || proto_add_ipv4_route "0.0.0.0" 0 "$gateway_4"
+ [ "$peerdns" = 0 ] || {
+ proto_add_dns_server "$dns1_4"
+ proto_add_dns_server "$dns2_4"
+ }
+ [ -n "$zone" ] && {
+ proto_add_data
+ json_add_string zone "$zone"
+ proto_close_data
+ }
+ proto_send_update "$interface"
+ else
+ json_init
+ json_add_string name "${interface}_4"
+ json_add_string ifname "@$interface"
+ json_add_string proto "dhcp"
+ [ -n "$ip4table" ] && json_add_string ip4table "$ip4table"
+ proto_add_dynamic_defaults
+ [ -n "$zone" ] && json_add_string zone "$zone"
+ json_close_object
+ ubus call network add_dynamic "$(json_dump)"
+ fi
}
}