Skip to content

Commit 8c295e8

Browse files
committed
luci-app-qmodem: perf: Neoway support & use ndisc6 for connect check
1 parent 5186c84 commit 8c295e8

File tree

9 files changed

+147
-98
lines changed

9 files changed

+147
-98
lines changed

application/ndisc6/Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#
2+
# Copyright (C) 2007-2021 OpenWrt.org
3+
#
4+
# This is free software, licensed under the GNU General Public License v2.
5+
# See /LICENSE for more information.
6+
#
7+
8+
include $(TOPDIR)/rules.mk
9+
10+
PKG_NAME:=ndisc6
11+
PKG_VERSION:=1.0.8
12+
PKG_RELEASE:=1
13+
14+
PKG_SOURCE:=ndisc6-$(PKG_VERSION).tar.bz2
15+
PKG_SOURCE_URL:=https://www.remlab.net/files/ndisc6/
16+
PKG_HASH:=1f2fb2dc1172770aa5a09d39738a44d8b753cc5e2e25e306ca78682f9fea0b4f
17+
18+
PKG_INSTALL:=1
19+
PKG_FIXUP:=autoreconf
20+
21+
include $(INCLUDE_DIR)/package.mk
22+
23+
define Package/ndisc6
24+
URL:=https://www.remlab.net/ndisc6/
25+
SECTION:=network
26+
CATEGORY:=Network
27+
TITLE:=NDisc6
28+
endef
29+
30+
define Package/ndisc6/description
31+
NDisc6 is a small collection of useful tools for IPv6 networking
32+
endef
33+
34+
define Package/ndisc6/install
35+
$(INSTALL_DIR) $(1)/usr/bin
36+
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ndisc6 $(1)/usr/bin
37+
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rdisc6 $(1)/usr/bin
38+
endef
39+
40+
$(eval $(call BuildPackage,ndisc6))

application/tom_modem/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@ define Build/Prepare
2828
$(CP) src/* $(PKG_BUILD_DIR)/
2929
endef
3030

31-
3231
define Build/Compile
33-
3432
$(MAKE) -C $(PKG_BUILD_DIR) \
3533
$(TARGET_CONFIGURE_OPTS) CFLAGS="$(TARGET_CFLAGS)"
3634
endef
3735

3836
define Package/$(PKG_NAME)/install
39-
$(INSTALL_DIR) $(1)/usr/bin
37+
$(INSTALL_DIR) $(1)/usr/bin
4038
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tom_modem $(1)/usr/bin/
4139
endef
4240

luci/luci-app-qmodem/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ PKG_LINCESE_FILES:=LICENSE
1212
PKG_MAINTAINER:=Tom <fjrcn@outlook.com>
1313
LUCI_DEPENDS:=+luci-compat \
1414
+kmod-usb2 +kmod-usb3 \
15-
+kmod-usb-serial +kmod-usb-serial-option +kmod-usb-serial-qualcomm \
15+
+kmod-usb-serial +kmod-usb-serial-option +kmod-usb-serial-qualcomm \
1616
+kmod-usb-net +kmod-usb-acm \
1717
+kmod-usb-wdm \
1818
+kmod-usb-net-cdc-ether \
@@ -34,7 +34,8 @@ LUCI_DEPENDS:=+luci-compat \
3434
+PACKAGE_luci-app-qmodem_USING_NORMAL_QUECTEL_CM:quectel-cm \
3535
+tom_modem \
3636
+jq +bc\
37-
+coreutils +coreutils-stat
37+
+coreutils +coreutils-stat \
38+
+ndisc6
3839

3940
define Package/luci-app-qmodem/conffiles
4041
/etc/config/qmodem

luci/luci-app-qmodem/luasrc/model/cbi/qmodem/dial_config.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ soft_reboot = s:taboption("advanced", Flag, "soft_reboot", translate("Soft Reboo
7878
soft_reboot.description = translate("enable modem soft reboot")
7979
soft_reboot.default = "0"
8080

81-
-- 350 v4/v6存活检查
82-
mtk_check = s:taboption("advanced", Flag, "mtk_check", translate("MTK V4/V6 Check"))
83-
mtk_check.description = translate("Only for Fibocom MTK modem.")
84-
mtk_check.default = "0"
81+
-- Connect Check
82+
connect_check = s:taboption("advanced", Flag, "connect_check", translate("V4/V6 Connect Check"))
83+
connect_check.description = translate("Only for AT dial modem.")
84+
connect_check.default = "0"
8585

8686
-- 网络类型
8787
pdp_type= s:taboption("advanced", ListValue, "pdp_type", translate("PDP Type"))

luci/luci-app-qmodem/luasrc/model/cbi/qmodem/modem_config.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ end
7373
soft_reboot = s:option(Flag, "soft_reboot", translate("Soft Reboot"))
7474
soft_reboot.default = "0"
7575

76-
-- MTK Check
77-
mtk_check = s:option(Flag, "mtk_check", translate("MTK V4/V6 Check"))
78-
mtk_check.description = translate("Only for Fibocom MTK modem.")
79-
mtk_check.default = "0"
76+
-- Connect Check
77+
connect_check = s:option(Flag, "connect_check", translate("V4/V6 Connect Check"))
78+
connect_check.description = translate("Only for AT dial modem.")
79+
connect_check.default = "0"
8080

8181
-- PDP Context Index
8282
define_connect = s:option(Value, "define_connect", translate("PDP Context Index"))

luci/luci-app-qmodem/po/zh-cn/qmodem.po

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -852,8 +852,8 @@ msgstr "(仍在测试中)"
852852
msgid "(beta)"
853853
msgstr "(测试)"
854854

855-
msgid "MTK V4/V6 Check"
856-
msgstr "MTK V4/V6 存活检测"
855+
msgid "V4/V6 Connect Check"
856+
msgstr "V4/V6 存活检测"
857857

858-
msgid "Only for Fibocom MTK modem."
859-
msgstr "只适用于广和通MTK模组。"
858+
msgid "Only for AT dial modem."
859+
msgstr "只适用于AT拨号模组。"

luci/luci-app-qmodem/po/zh_Hans/qmodem.po

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -848,8 +848,8 @@ msgstr "(仍在测试中)"
848848
msgid "(beta)"
849849
msgstr "(测试)"
850850

851-
msgid "MTK V4/V6 Check"
852-
msgstr "MTK V4/V6 存活检测"
851+
msgid "V4/V6 Connect Check"
852+
msgstr "V4/V6 存活检测"
853853

854-
msgid "Only for Fibocom MTK modem."
855-
msgstr "只适用于广和通MTK模组。"
854+
msgid "Only for AT dial modem."
855+
msgstr "只适用于AT拨号模组。"

luci/luci-app-qmodem/root/usr/share/qmodem/modem_dial.sh

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ update_config()
114114
config_get en_bridge $modem_config en_bridge
115115
config_get do_not_add_dns $modem_config do_not_add_dns
116116
config_get dns_list $modem_config dns_list
117-
[ "$manufacturer" == "fibocom" ] && [ "$platform" == "mediatek" ] && config_get mtk_check $modem_config mtk_check
117+
config_get connect_check $modem_config connect_check
118118
config_get global_dial main enable_dial
119119
# config_get ethernet_5g u$modem_config ethernet 转往口获取命令更新,待测试
120120
config_foreach get_associate_ethernet_by_path modem-slot
@@ -266,7 +266,7 @@ check_ip()
266266
"neoway")
267267
case $platform in
268268
"unisoc")
269-
check_ip_command='AT$MYUSBNETACT?'
269+
check_ip_command="AT+CGPADDR=1"
270270
;;
271271
esac
272272
;;
@@ -280,9 +280,6 @@ check_ip()
280280
local config=$(umbim -d $mbim_port config)
281281
ipaddr=$(echo "$config" | grep "ipv4address:" | awk '{print $2}' | cut -d'/' -f1)
282282
ipaddr="$ipaddr $(echo "$config" | grep "ipv6address:" | awk '{print $2}' | cut -d'/' -f1)"
283-
elif [ "$manufacturer" = "neoway" ]; then
284-
# $MYURCACT: 0,1,"10.92.220.73"
285-
ipaddr=$(at "$at_port" "$check_ip_command" | grep '$MYUSBNETACT:')
286283
else
287284
ipaddr=$(at "$at_port" "$check_ip_command" | grep +CGPADDR:)
288285
fi
@@ -315,10 +312,10 @@ check_ip()
315312
fi
316313
}
317314

318-
check_mtk_connection()
315+
check_connection()
319316
{
320317
[ "$connection_status" = "0" ] || [ "$connection_status" = "-1" ] && return 0
321-
if [ "$mtk" -eq 1 ] && [ -n "$ipv4" ] && [ -n "$modem_netcard" ]; then
318+
if [ -n "$ipv4" ] && [ -n "$modem_netcard" ]; then
322319
for i in 1 2; do
323320
if ping -I "$modem_netcard" -w 1 1.1.1.1 >/dev/null 2>&1 ||
324321
ping -I "$modem_netcard" -w 2 8.8.8.8 >/dev/null 2>&1; then
@@ -331,18 +328,9 @@ check_mtk_connection()
331328
sleep 1
332329
done
333330
local ifup_time=$(ubus call network.interface.$interface6_name status 2>/dev/null | jsonfilter -e '@.uptime' 2>/dev/null || echo 0)
334-
if [ -n "$ifup_time" ] && [ "$ifup_time" -gt 5 ] && [ "$pdp_type" = "ipv4v6" ] && [ -n "$ipv6" ]; then
335-
for i in 1 2; do
336-
if ping6 -I "$modem_netcard" -w 1 2400:3200::1 >/dev/null 2>&1 ||
337-
ping6 -I "$modem_netcard" -w 2 2001:4860:4860::8888 >/dev/null 2>&1; then
338-
break
339-
fi
340-
if [ $i -eq 2 ]; then
341-
m_debug "IPv6 connection test failed, restarting IPv6 interface"
342-
[ -n "$interface6_name" ] && ifdown "$interface6_name" && sleep 2 && ifup "$interface6_name"
343-
fi
344-
sleep 1
345-
done
331+
if [ "$ifup_time" -gt 5 ] && [ "$pdp_type" = "ipv4v6" ]; then
332+
rdisc6 $origin_device &
333+
ndisc6 fe80::1 $origin_device &
346334
fi
347335
fi
348336
return 0
@@ -660,14 +648,15 @@ ecm_hang()
660648
at_command="AT^NDISDUP=0,0"
661649
;;
662650
"neoway")
651+
delay=3
663652
at_command='AT$MYUSBNETACT=0,0'
664653
;;
665654
*)
666655
at_command="ATI"
667656
;;
668657
esac
669-
670658
fastat "${at_port}" "${at_command}"
659+
sleep "$delay"
671660
}
672661

673662
hang()
@@ -819,7 +808,7 @@ at_dial()
819808
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
820809
;;
821810
"mediatek")
822-
mtk=1
811+
delay=3
823812
if [ "$apn" = "auto" ];then
824813
apn="cbnet"
825814
fi
@@ -859,17 +848,13 @@ at_dial()
859848
at_command='AT$MYUSBNETACT=0,1'
860849
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
861850
;;
862-
"unisoc")
863-
at_command=""
864-
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
865-
;;
866851
esac
867852
;;
868853
esac
869854
m_debug "dialing vendor:$manufacturer;platform:$platform; $cgdcont_command ; $at_command"
870855
at "${at_port}" "${cgdcont_command}"
871856
fastat "$at_port" "$at_command"
872-
[ "$mtk" -eq 1 ] && sleep 2
857+
sleep "$delay"
873858
if [ "$driver" = "mtk_pcie" ];then
874859
fastat "$at_port" "AT+CGACT=0,3"
875860
mbim_port=$(echo "$at_port" | sed 's/at/mbim/g')
@@ -1058,7 +1043,7 @@ at_dial_monitor()
10581043
ipv4_cache=$ipv4
10591044
ipv6_cache=$ipv6
10601045
fi
1061-
[ "$mtk_check" -eq 1 ] && { sleep 5; check_mtk_connection || { fastat "$at_port" "AT+CGACT=0,3" && at_dial; }; } || sleep 15
1046+
[ "$connect_check" -eq 1 ] && { sleep 5; check_connection || { hang && at_dial; }; } || sleep 15
10621047
;;
10631048
esac
10641049
check_logfile_line

0 commit comments

Comments
 (0)