mirror of
https://github.com/qosmio/nss-packages.git
synced 2025-12-17 00:33:40 +00:00
Update quectel proto script to support dual-stack IP via QMAP multiplexing
Update quectel proto script to support dual-stack IP via QMAP multiplexing
This commit is contained in:
parent
681d706908
commit
1a6ba49959
@ -11,6 +11,7 @@ proto_quectel_init_config() {
|
|||||||
no_device=1
|
no_device=1
|
||||||
proto_config_add_string "device:device"
|
proto_config_add_string "device:device"
|
||||||
proto_config_add_string "apn"
|
proto_config_add_string "apn"
|
||||||
|
proto_config_add_string "apnv6"
|
||||||
proto_config_add_string "auth"
|
proto_config_add_string "auth"
|
||||||
proto_config_add_string "username"
|
proto_config_add_string "username"
|
||||||
proto_config_add_string "password"
|
proto_config_add_string "password"
|
||||||
@ -27,12 +28,12 @@ proto_quectel_init_config() {
|
|||||||
|
|
||||||
proto_quectel_setup() {
|
proto_quectel_setup() {
|
||||||
local interface="$1"
|
local interface="$1"
|
||||||
local device apn auth username password pincode delay pdptype
|
local device apn apnv6 auth username password pincode delay pdptype
|
||||||
local dhcp dhcpv6 sourcefilter delegate mtu $PROTO_DEFAULT_OPTIONS
|
local dhcp dhcpv6 sourcefilter delegate mtu $PROTO_DEFAULT_OPTIONS
|
||||||
local ip4table ip6table
|
local ip4table ip6table
|
||||||
local pid zone
|
local pid zone
|
||||||
|
|
||||||
json_get_vars device apn auth username password pincode delay
|
json_get_vars device apn apnv6 auth username password pincode delay
|
||||||
json_get_vars pdptype dhcp dhcpv6 sourcefilter delegate ip4table
|
json_get_vars pdptype dhcp dhcpv6 sourcefilter delegate ip4table
|
||||||
json_get_vars ip6table mtu $PROTO_DEFAULT_OPTIONS
|
json_get_vars ip6table mtu $PROTO_DEFAULT_OPTIONS
|
||||||
|
|
||||||
@ -71,15 +72,25 @@ proto_quectel_setup() {
|
|||||||
[ "$pdptype" = "ipv6" -o "$pdptype" = "ipv4v6" ] && ipv6opt="-6"
|
[ "$pdptype" = "ipv6" -o "$pdptype" = "ipv4v6" ] && ipv6opt="-6"
|
||||||
[ -n "$auth" ] || auth="none"
|
[ -n "$auth" ] || auth="none"
|
||||||
|
|
||||||
eval "proto_run_command '$interface' /usr/bin/quectel-cm -i '$ifname' $ipv4opt $ipv6opt ${pincode:+-p $pincode} -s '$apn' '$username' '$password' '$auth'"
|
quectel-qmi-proxy &
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
if [ -n "$ipv4opt" ]; then
|
||||||
|
quectel-cm -i "$ifname" $ipv4opt -n 1 -m 1 ${pincode:+-p $pincode} -s "$apn" "$username" "$password" "$auth" &
|
||||||
|
fi
|
||||||
|
if [ -n "$ipv6opt" ]; then
|
||||||
|
quectel-cm -i "$ifname" $ipv6opt -n 4 -m 2 ${pincode:+-p $pincode} -s "$apnv6" "$username" "$password" "$auth" &
|
||||||
|
fi
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
ifconfig "$ifname" up
|
ifconfig "$ifname" up
|
||||||
ifconfig "${ifname}_1" &>"/dev/null" && ifname="${ifname}_1"
|
ifconfig "${ifname}_1" &>"/dev/null" && ifname4="${ifname}_1"
|
||||||
|
ifconfig "${ifname}_2" &>"/dev/null" && ifname6="${ifname}_2"
|
||||||
|
|
||||||
if [ -n "$mtu" ]; then
|
if [ -n "$mtu" ]; then
|
||||||
echo "Setting MTU to $mtu"
|
echo "Setting MTU to $mtu"
|
||||||
/sbin/ip link set dev "$ifname" mtu "$mtu"
|
/sbin/ip link set dev "$ifname4" mtu "$mtu"
|
||||||
|
/sbin/ip link set dev "$ifname6" mtu "$mtu"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Setting up $ifname"
|
echo "Setting up $ifname"
|
||||||
@ -92,7 +103,7 @@ proto_quectel_setup() {
|
|||||||
if [ "$pdptype" = "ipv6" ] || [ "$pdptype" = "ipv4v6" ]; then
|
if [ "$pdptype" = "ipv6" ] || [ "$pdptype" = "ipv4v6" ]; then
|
||||||
json_init
|
json_init
|
||||||
json_add_string name "${interface}_6"
|
json_add_string name "${interface}_6"
|
||||||
json_add_string ifname "@$interface"
|
json_add_string device "$ifname6"
|
||||||
[ "$pdptype" = "ipv4v6" ] && json_add_string iface_464xlat "0"
|
[ "$pdptype" = "ipv4v6" ] && json_add_string iface_464xlat "0"
|
||||||
json_add_string proto "dhcpv6"
|
json_add_string proto "dhcpv6"
|
||||||
proto_add_dynamic_defaults
|
proto_add_dynamic_defaults
|
||||||
@ -109,7 +120,7 @@ proto_quectel_setup() {
|
|||||||
if [ "$pdptype" = "ipv4" ] || [ "$pdptype" = "ipv4v6" ]; then
|
if [ "$pdptype" = "ipv4" ] || [ "$pdptype" = "ipv4v6" ]; then
|
||||||
json_init
|
json_init
|
||||||
json_add_string name "${interface}_4"
|
json_add_string name "${interface}_4"
|
||||||
json_add_string ifname "@$interface"
|
json_add_string device "$ifname4"
|
||||||
json_add_string proto "dhcp"
|
json_add_string proto "dhcp"
|
||||||
[ -z "$ip4table" ] || json_add_string ip4table "$ip4table"
|
[ -z "$ip4table" ] || json_add_string ip4table "$ip4table"
|
||||||
proto_add_dynamic_defaults
|
proto_add_dynamic_defaults
|
||||||
@ -128,10 +139,10 @@ proto_quectel_teardown() {
|
|||||||
|
|
||||||
echo "Stopping network $interface"
|
echo "Stopping network $interface"
|
||||||
|
|
||||||
proto_kill_command "$interface"
|
|
||||||
|
|
||||||
proto_init_update "*" 0
|
proto_init_update "*" 0
|
||||||
proto_send_update "$interface"
|
proto_send_update "$interface"
|
||||||
|
killall quectel-cm
|
||||||
|
killall quectel-qmi-proxy
|
||||||
}
|
}
|
||||||
|
|
||||||
[ -n "$INCLUDE_ONLY" ] || {
|
[ -n "$INCLUDE_ONLY" ] || {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user