更新超级拨号插件
This commit is contained in:
parent
8af7484906
commit
6661f89c9b
@ -28,9 +28,9 @@
|
||||
|
||||
### 拨号
|
||||
|
||||
- luci-app-modem(beta)
|
||||
- luci-app-modem(新)
|
||||
|
||||
- luci-app-hypermodem(新)
|
||||
- luci-app-hypermodem
|
||||
- luci-app-usbmodem
|
||||
- luci-app-pcimodem
|
||||
- luci-app-gobinetmodem
|
||||
|
@ -15,8 +15,9 @@ LUCI_DEPENDS:=+luci-compat +kmod-usb-net +kmod-usb-net-cdc-ether +kmod-usb-acm
|
||||
+kmod-usb2 +kmod-usb3 \
|
||||
+kmod-usb-net-cdc-mbim \
|
||||
+usbutils \
|
||||
+kmod-qmi_wwan_q \
|
||||
+kmod-pcie_mhi +pciutils \
|
||||
+luci-proto-qmi \
|
||||
+pciutils \
|
||||
+kmod-pcie_mhi \
|
||||
+quectel-CM-5G \
|
||||
+grep \
|
||||
|
||||
|
@ -1,10 +1,20 @@
|
||||
# luci-app-hypermodem
|
||||
|
||||
- 原项目地址:https://github.com/momokind/luci-app-hypermodem
|
||||
# 目录
|
||||
|
||||
## 说明
|
||||
[一、说明](#一说明)
|
||||
|
||||
- 在原项目的基础上修改并添加USB和PCIe等依赖支持
|
||||
# 一、说明
|
||||
|
||||
- 支持USB和PCIE两种连接模式的5G模块用QMI模式进行IPv6拨号,然后下发给内网设备
|
||||
原项目地址:https://github.com/momokind/luci-app-hypermodem
|
||||
|
||||
插件功能
|
||||
|
||||
- 支持USB和PCIe两种通信方式的通信模组
|
||||
|
||||
- 支持IPv6
|
||||
|
||||
- 支持高通和紫光展锐两个平台的通信模组
|
||||
|
||||
- 支持常见厂商的通信模组(例如:移远,广和通等)
|
||||
|
||||
|
@ -16,6 +16,11 @@ ipv6 = s:option(Flag, "ipv6", translate("Enable IPv6"))
|
||||
ipv6.default = 1
|
||||
ipv6.rmempty = false
|
||||
|
||||
network_bridge = s:option(Flag, "network_bridge", translate("Enable Network bridge"))
|
||||
network_bridge.description = translate("After checking, enable network interface bridge.")
|
||||
network_bridge.default = 0
|
||||
network_bridge.rmempty = false
|
||||
|
||||
device = s:option(Value, "device", translate("Modem device"))
|
||||
device.rmempty = false
|
||||
|
||||
@ -28,21 +33,35 @@ if device_suggestions then
|
||||
end
|
||||
end
|
||||
|
||||
apn = s:option(Value, "apn", translate("APN"))
|
||||
apn = s:taboption(Value, "apn", translate("APN"))
|
||||
apn.default = ""
|
||||
apn.rmempty = true
|
||||
apn:value("", translate("Auto Choose"))
|
||||
apn:value("cmnet", translate("China Mobile"))
|
||||
apn:value("3gnet", translate("China Unicom"))
|
||||
apn:value("ctnet", translate("China Telecom"))
|
||||
apn:value("cbnet", translate("China Broadcast"))
|
||||
apn:value("5gscuiot", translate("Skytone"))
|
||||
|
||||
username = s:option(Value, "username", translate("PAP/CHAP username"))
|
||||
username.rmempty = true
|
||||
|
||||
password = s:option(Value, "password", translate("PAP/CHAP password"))
|
||||
password.rmempty = true
|
||||
|
||||
auth = s:option(Value, "auth", translate("Authentication Type"))
|
||||
auth.rmempty = true
|
||||
auth:value("", translate("-- Please choose --"))
|
||||
auth:value("both", "PAP/CHAP (both)")
|
||||
auth = s:taboption("advanced", ListValue, "auth", translate("Authentication Type"))
|
||||
auth.default = "none"
|
||||
auth.rmempty = false
|
||||
auth:value("none", translate("NONE"))
|
||||
auth:value("both", translate("PAP/CHAP (both)"))
|
||||
auth:value("pap", "PAP")
|
||||
auth:value("chap", "CHAP")
|
||||
auth:value("none", "NONE")
|
||||
|
||||
username = s:taboption("advanced", Value, "username", translate("PAP/CHAP Username"))
|
||||
username.rmempty = true
|
||||
username:depends("auth", "both")
|
||||
username:depends("auth", "pap")
|
||||
username:depends("auth", "chap")
|
||||
|
||||
password = s:taboption("advanced", Value, "password", translate("PAP/CHAP Password"))
|
||||
password.rmempty = true
|
||||
password.password = true
|
||||
password:depends("auth", "both")
|
||||
password:depends("auth", "pap")
|
||||
password:depends("auth", "chap")
|
||||
|
||||
return mp
|
||||
|
@ -22,3 +22,42 @@ msgstr "OpenWrt移动网络拨号服务"
|
||||
|
||||
msgid "Enable IPv6"
|
||||
msgstr "启用IPv6协商"
|
||||
|
||||
msgid "Enable Network bridge"
|
||||
msgstr "启用网络桥架"
|
||||
|
||||
msgid "After checking, enable network interface bridge."
|
||||
msgstr "勾选后,启用网络接口桥接。"
|
||||
|
||||
msgid "APN"
|
||||
msgstr "接入点"
|
||||
|
||||
msgid "China Mobile"
|
||||
msgstr "中国移动"
|
||||
|
||||
msgid "China Unicom"
|
||||
msgstr "中国联通"
|
||||
|
||||
msgid "China Telecom"
|
||||
msgstr "中国电信"
|
||||
|
||||
msgid "China Broadcast"
|
||||
msgstr "中国广电"
|
||||
|
||||
msgid "Skytone"
|
||||
msgstr "天际通"
|
||||
|
||||
msgid "Authentication Type"
|
||||
msgstr "认证类型"
|
||||
|
||||
msgid "PAP/CHAP (both)"
|
||||
msgstr "PAP/CHAP (均使用)"
|
||||
|
||||
msgid "NONE"
|
||||
msgstr "无"
|
||||
|
||||
msgid "PAP/CHAP Username"
|
||||
msgstr "PAP/CHAP 用户名"
|
||||
|
||||
msgid "PAP/CHAP Password"
|
||||
msgstr "PAP/CHAP 密码"
|
@ -5,43 +5,98 @@ START=94
|
||||
STOP=13
|
||||
USE_PROCD=1
|
||||
|
||||
pre_set()
|
||||
#设置防火墙
|
||||
# $1:网络接口名称
|
||||
set_firewall()
|
||||
{
|
||||
[ "$(uci get network.wwan_5g.ifname)" != "$1" ] && {
|
||||
uci set network.wwan_5g='interface'
|
||||
uci set network.wwan_5g.ifname="$1"
|
||||
uci set network.wwan_5g.proto='dhcp'
|
||||
if [ "$ipv6" = 1 ]; then
|
||||
uci set network.wwan6_5g='interface'
|
||||
uci set network.wwan6_5g.ifname="$1"
|
||||
uci set network.wwan6_5g.proto='dhcpv6'
|
||||
uci set network.wwan6_5g.extendprefix='1'
|
||||
fi
|
||||
uci commit network
|
||||
local interface_name="$1"
|
||||
|
||||
num=`uci show firewall |grep "name='wan'" |wc -l`
|
||||
wwan_5g_num=`uci get firewall.@zone[$num].network |grep -w wwan_5g |wc -l`
|
||||
wwan6_5g_num=`uci get firewall.@zone[$num].network |grep -w wwan6_5g |wc -l`
|
||||
if [ "$wwan_5g_num" = "0" ]; then
|
||||
uci add_list firewall.@zone[$num].network='wwan_5g'
|
||||
fi
|
||||
if [ "$ipv6" = 1 ]; then
|
||||
if [ "$wwan6_5g_num" = "0" ]; then
|
||||
uci add_list firewall.@zone[$num].network='wwan6_5g'
|
||||
fi
|
||||
local num=$(uci show firewall | grep "name='wan'" | wc -l)
|
||||
local wwan_num=$(uci -q get firewall.@zone[$num].network | grep -w "${interface_name}" | wc -l)
|
||||
if [ "$wwan_num" = "0" ]; then
|
||||
uci add_list firewall.@zone[$num].network="${interface_name}"
|
||||
fi
|
||||
uci commit firewall
|
||||
|
||||
ifup wwan_5g
|
||||
if [ "$ipv6" = 1 ]; then
|
||||
ifup wwan6_5g
|
||||
fi
|
||||
}
|
||||
|
||||
[ "$(uci get network.wwan6_5g.ifname)" = "$1" ] && {
|
||||
uci set network.wwan6_5g.extendprefix='1'
|
||||
#设置IPv4网络接口
|
||||
# $1:网络接口名称
|
||||
# $2:网络接口
|
||||
set_ipv4_interface()
|
||||
{
|
||||
local interface_name="$1"
|
||||
local network_interface="$2"
|
||||
|
||||
#添加或修改网络配置
|
||||
uci set network.${interface_name}='interface'
|
||||
uci set network.${interface_name}.proto='dhcp'
|
||||
uci set network.${interface_name}.device="${network_interface}"
|
||||
uci set network.${interface_name}.ifname="${network_interface}"
|
||||
uci commit network
|
||||
|
||||
#加入WAN防火墙
|
||||
set_firewall "${interface_name}"
|
||||
|
||||
#启动网络接口
|
||||
ifup "${interface_name}"
|
||||
}
|
||||
|
||||
#设置IPv6网络接口
|
||||
# $1:网络接口名称
|
||||
# $2:网络接口
|
||||
set_ipv6_interface()
|
||||
{
|
||||
local interface_name="$1"
|
||||
local network_interface="$2"
|
||||
|
||||
#添加或修改网络配置
|
||||
uci set network.${interface_name}='interface'
|
||||
uci set network.${interface_name}.proto='dhcpv6'
|
||||
uci set network.${interface_name}.extendprefix='1'
|
||||
uci set network.${interface_name}.device="${network_interface}"
|
||||
uci set network.${interface_name}.ifname="${network_interface}"
|
||||
uci commit network
|
||||
|
||||
#加入WAN防火墙
|
||||
set_firewall "${interface_name}"
|
||||
|
||||
#启动网络接口
|
||||
ifup "${interface_name}"
|
||||
}
|
||||
|
||||
#设置IPV4和IPv6网络接口
|
||||
# $1:IPV4网络接口名称
|
||||
# $2:IPv6网络接口名称
|
||||
# $3:网络接口
|
||||
set_ipv4v6_interface()
|
||||
{
|
||||
local ipv4_interface_name="$1"
|
||||
local ipv6_interface_name="$2"
|
||||
local network_interface="$3"
|
||||
|
||||
#设置IPV4网络接口
|
||||
set_ipv4_interface "${ipv4_interface_name}" "${network_interface}"
|
||||
#设置IPV6网络接口(别名)
|
||||
set_ipv6_interface "${ipv6_interface_name}" "@${ipv4_interface_name}"
|
||||
}
|
||||
|
||||
#设置网络接口
|
||||
# $2:网络接口
|
||||
set_interface()
|
||||
{
|
||||
local network_interface="$1"
|
||||
|
||||
local pdp_type
|
||||
[ "$ipv6" = "1" ] && {
|
||||
pdp_type="ipv4v6"
|
||||
}
|
||||
|
||||
case $pdp_type in
|
||||
"ipv4") set_ipv4_interface "wwan_5g" "${network_interface}" ;;
|
||||
"ipv6") set_ipv6_interface "wwan6_5g" "${network_interface}" ;;
|
||||
"ipv4v6") set_ipv4v6_interface "wwan_5g" "wwan6_5g" "${network_interface}" ;;
|
||||
*) set_ipv4v6_interface "wwan_5g" "wwan6_5g" "${network_interface}" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
run_dial()
|
||||
@ -55,6 +110,7 @@ run_dial()
|
||||
local password
|
||||
local auth
|
||||
local ipv6
|
||||
local network_bridge
|
||||
local device
|
||||
|
||||
config_get apn $1 apn
|
||||
@ -62,45 +118,53 @@ run_dial()
|
||||
config_get password $1 password
|
||||
config_get auth $1 auth
|
||||
config_get ipv6 $1 ipv6
|
||||
config_get network_bridge $1 network_bridge
|
||||
config_get device $1 device
|
||||
|
||||
devname="$(basename "$device")"
|
||||
devicepath="$(find /sys/class/ -name $devname)"
|
||||
devpath="$(readlink -f $devicepath/device/)"
|
||||
ifname="$( ls "$devpath"/net )"
|
||||
devname="$(basename "${device}")"
|
||||
devicepath="$(find /sys/class/ -name ${devname})"
|
||||
devpath="$(readlink -f ${devicepath}/device/)"
|
||||
network="$( ls "${devpath}"/net )"
|
||||
|
||||
#拨号配置
|
||||
procd_open_instance
|
||||
procd_set_param command quectel-CM
|
||||
if [ "$ipv6" = 1 ]; then
|
||||
procd_append_param command -4 -6
|
||||
procd_append_param command "-4" "-6"
|
||||
fi
|
||||
if [ "$network_bridge" = 1 ]; then
|
||||
procd_append_param command "-b"
|
||||
fi
|
||||
if [ "$apn" != "" ];then
|
||||
procd_append_param command -s $apn
|
||||
procd_append_param command "-s" "$apn"
|
||||
fi
|
||||
if [ "$user" != "" ]; then
|
||||
procd_append_param command $user
|
||||
if [ "$username" != "" ]; then
|
||||
procd_append_param command "$username"
|
||||
fi
|
||||
if [ "$password" != "" ]; then
|
||||
procd_append_param command $password
|
||||
procd_append_param command "$password"
|
||||
fi
|
||||
if [ "$auth" != "" ]; then
|
||||
procd_append_param command $auth
|
||||
procd_append_param command "$auth"
|
||||
fi
|
||||
if [ "$device" != "" ]; then
|
||||
procd_append_param command -i $ifname
|
||||
procd_append_param command -i "$network"
|
||||
fi
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
|
||||
#设置网络接口
|
||||
local network_interface
|
||||
if [ -d /sys/class/net/rmnet_mhi0 ]; then
|
||||
pre_set rmnet_mhi0.1
|
||||
network_interface="rmnet_mhi0.1"
|
||||
elif [ -d /sys/class/net/wwan0_1 ]; then
|
||||
pre_set wwan0_1
|
||||
network_interface="wwan0_1"
|
||||
elif [ -d /sys/class/net/wwan0.1 ]; then
|
||||
pre_set wwan0.1
|
||||
network_interface="wwan0.1"
|
||||
elif [ -d /sys/class/net/wwan0 ]; then
|
||||
pre_set wwan0
|
||||
network_interface="wwan0"
|
||||
fi
|
||||
set_interface "${network_interface}"
|
||||
fi
|
||||
|
||||
sleep 15
|
||||
|
@ -16,7 +16,8 @@
|
||||
|
||||
- 支持IPv6
|
||||
|
||||
- 支持高通和紫光紫光展锐两个平台的通信模组
|
||||
- 支持高通,紫光展锐,联发科等平台的通信模组
|
||||
|
||||
- 支持常见厂商的通信模组(例如:移远,广和通等)
|
||||
|
||||
# 二、模组支持
|
||||
|
Loading…
x
Reference in New Issue
Block a user