1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

fix、 libqmi libmbim modemmanager

This commit is contained in:
suyuan168 2022-04-11 11:36:50 +08:00
parent b1c8efa18d
commit e17325d0c5
11 changed files with 135 additions and 328 deletions

View file

@ -197,6 +197,7 @@ modemmanager_connected_method_dhcp_ipv4() {
local interface="$1"
local wwan="$2"
local metric="$3"
local defaultroute="$4"
proto_init_update "${wwan}" 1
proto_set_keep 1
@ -222,6 +223,7 @@ modemmanager_connected_method_static_ipv4() {
local dns1="$7"
local dns2="$8"
local metric="$9"
local defaultroute="$10"
local mask=""
@ -242,8 +244,9 @@ modemmanager_connected_method_static_ipv4() {
proto_set_keep 1
echo "adding IPv4 address ${address}, netmask ${mask}"
proto_add_ipv4_address "${address}" "${mask}"
[ -n "${gateway}" ] && {
[ -n "${gateway}" ] && [ "${defaultroute}" != 0 ] && {
echo "adding default IPv4 route via ${gateway}"
logger -t "modemmanager.proto" "adding default IPv4 route via ${gateway} ${address}"
proto_add_ipv4_route "0.0.0.0" "0" "${gateway}" "${address}"
}
[ -n "${dns1}" ] && {
@ -262,6 +265,7 @@ modemmanager_connected_method_dhcp_ipv6() {
local interface="$1"
local wwan="$2"
local metric="$3"
local defaultroute="$4"
proto_init_update "${wwan}" 1
proto_set_keep 1
@ -288,6 +292,7 @@ modemmanager_connected_method_static_ipv6() {
local dns1="$7"
local dns2="$8"
local metric="$9"
local defaultroute="$10"
[ -n "${address}" ] || {
proto_notify_error "${interface}" ADDRESS_MISSING
@ -306,7 +311,7 @@ modemmanager_connected_method_static_ipv6() {
echo "adding IPv6 address ${address}, prefix ${prefix}"
proto_add_ipv6_address "${address}" "128"
proto_add_ipv6_prefix "${address}/${prefix}"
[ -n "${gateway}" ] && {
[ -n "${gateway}" ] && [ "$defaultroute" != 0 ] && {
echo "adding default IPv6 route via ${gateway}"
proto_add_ipv6_route "${gateway}" "128"
proto_add_ipv6_route "::0" "0" "${gateway}" "" "" "${address}/${prefix}"
@ -357,9 +362,9 @@ proto_modemmanager_setup() {
local device apn allowedauth username password pincode iptype metric signalrate
local address prefix gateway mtu dns1 dns2
local address prefix gateway mtu dns1 dns2 defaultroute
json_get_vars device apn allowedauth username password pincode iptype metric signalrate
json_get_vars device apn allowedauth username password pincode iptype metric signalrate defaultroute
# validate sysfs path given in config
[ -n "${device}" ] || {
@ -447,7 +452,7 @@ proto_modemmanager_setup() {
echo "IPv4 connection setup required in interface ${interface}: ${bearermethod_ipv4}"
case "${bearermethod_ipv4}" in
"dhcp")
modemmanager_connected_method_dhcp_ipv4 "${interface}" "${beareriface}" "${metric}"
modemmanager_connected_method_dhcp_ipv4 "${interface}" "${beareriface}" "${metric}" "${defaultroute}"
;;
"static")
address=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv4-config.address")
@ -456,7 +461,7 @@ proto_modemmanager_setup() {
mtu=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv4-config.mtu")
dns1=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv4-config.dns.value\[1\]")
dns2=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv4-config.dns.value\[2\]")
modemmanager_connected_method_static_ipv4 "${interface}" "${beareriface}" "${address}" "${prefix}" "${gateway}" "${mtu}" "${dns1}" "${dns2}" "${metric}"
modemmanager_connected_method_static_ipv4 "${interface}" "${beareriface}" "${address}" "${prefix}" "${gateway}" "${mtu}" "${dns1}" "${dns2}" "${metric}" "${defaultroute}"
;;
"ppp")
modemmanager_connected_method_ppp_ipv4 "${interface}" "${beareriface}" "${username}" "${password}" "${allowedauth}"
@ -474,7 +479,7 @@ proto_modemmanager_setup() {
echo "IPv6 connection setup required in interface ${interface}: ${bearermethod_ipv6}"
case "${bearermethod_ipv6}" in
"dhcp")
modemmanager_connected_method_dhcp_ipv6 "${interface}" "${beareriface}" "${metric}"
modemmanager_connected_method_dhcp_ipv6 "${interface}" "${beareriface}" "${metric}" "${defaultroute}"
;;
"static")
address=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv6-config.address")
@ -483,7 +488,7 @@ proto_modemmanager_setup() {
mtu=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv6-config.mtu")
dns1=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv6-config.dns.value\[1\]")
dns2=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv6-config.dns.value\[2\]")
modemmanager_connected_method_static_ipv6 "${interface}" "${beareriface}" "${address}" "${prefix}" "${gateway}" "${mtu}" "${dns1}" "${dns2}" "${metric}"
modemmanager_connected_method_static_ipv6 "${interface}" "${beareriface}" "${address}" "${prefix}" "${gateway}" "${mtu}" "${dns1}" "${dns2}" "${metric}" "${defaultroute}"
;;
"ppp")
proto_notify_error "${interface}" "unsupported method"