aboutsummaryrefslogtreecommitdiffstats
path: root/package/network
diff options
context:
space:
mode:
authorLech Perczak <lech.perczak@gmail.com>2022-03-31 21:16:01 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2022-04-17 21:31:02 +0200
commitc138cb80e9abbb431fede49870f7640abcdd2662 (patch)
tree215639b85ff378090c3f112e95bf4e654d26bdc2 /package/network
parent19c65d36d776b4f9e2a19f0f487fc9bc8fcc2858 (diff)
downloadupstream-c138cb80e9abbb431fede49870f7640abcdd2662.tar.gz
upstream-c138cb80e9abbb431fede49870f7640abcdd2662.tar.bz2
upstream-c138cb80e9abbb431fede49870f7640abcdd2662.zip
comgt: ncm: allow specification of interface name
Add ifname property to UCI, which can be used to override the autodetected interface name in case the detection fails due to having none or more than one interface exposed by the modem, which is not explicitly linked to TTY port. This is needed on certain variants of ZTE MF286R built-in modem, which exposes both RNDIS and CDC-ECM interfaces on the modem, on which the automatic detection may select the wrong network interface. Signed-off-by: Lech Perczak <lech.perczak@gmail.com> (cherry picked from commit a67629bbe25ef3d0e159db1e0c6ca81affd06898)
Diffstat (limited to 'package/network')
-rw-r--r--package/network/utils/comgt/files/ncm.sh32
1 files changed, 18 insertions, 14 deletions
diff --git a/package/network/utils/comgt/files/ncm.sh b/package/network/utils/comgt/files/ncm.sh
index 6545091c82..38a4ba7a0b 100644
--- a/package/network/utils/comgt/files/ncm.sh
+++ b/package/network/utils/comgt/files/ncm.sh
@@ -10,6 +10,7 @@ proto_ncm_init_config() {
no_device=1
available=1
proto_config_add_string "device:device"
+ proto_config_add_string ifname
proto_config_add_string apn
proto_config_add_string auth
proto_config_add_string username
@@ -25,10 +26,10 @@ proto_ncm_init_config() {
proto_ncm_setup() {
local interface="$1"
- local manufacturer initialize setmode connect finalize ifname devname devpath
+ local manufacturer initialize setmode connect finalize devname devpath
- local device apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS
- json_get_vars device apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS
+ local device ifname apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS
+ json_get_vars device ifname apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS
[ "$metric" = "" ] && metric="0"
@@ -53,17 +54,20 @@ proto_ncm_setup() {
return 1
}
- devname="$(basename "$device")"
- case "$devname" in
- 'tty'*)
- devpath="$(readlink -f /sys/class/tty/$devname/device)"
- ifname="$( ls "$devpath"/../../*/net )"
- ;;
- *)
- devpath="$(readlink -f /sys/class/usbmisc/$devname/device/)"
- ifname="$( ls "$devpath"/net )"
- ;;
- esac
+ [ -z "$ifname" ] && {
+ devname="$(basename "$device")"
+ case "$devname" in
+ 'tty'*)
+ devpath="$(readlink -f /sys/class/tty/$devname/device)"
+ ifname="$( ls "$devpath"/../../*/net )"
+ ;;
+ *)
+ devpath="$(readlink -f /sys/class/usbmisc/$devname/device/)"
+ ifname="$( ls "$devpath"/net )"
+ ;;
+ esac
+ }
+
[ -n "$ifname" ] || {
echo "The interface could not be found."
proto_notify_error "$interface" NO_IFACE