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

update mm

This commit is contained in:
suyuan168 2022-02-10 00:17:48 +08:00
parent 59eb792d64
commit 5e68aa0dd5
5 changed files with 20 additions and 57 deletions

View file

@ -9,14 +9,14 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=modemmanager
PKG_VERSION:=1.18.4
PKG_RELEASE:=1
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=ModemManager-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://www.freedesktop.org/software/ModemManager
PKG_HASH:=11fb970f63e2da88df4b6d8759e4ee649944c515244b979bf50a7a6df1d7f199
PKG_BUILD_DIR:=$(BUILD_DIR)/ModemManager-$(PKG_VERSION)
PKG_MAINTAINER:=Nicholas Smith <nicholas.smith@telcoantennas.com.au>
PKG_MAINTAINER:=Nicholas Smith <nicholas@nbembedded.com>
PKG_LICENSE:=GPL-2.0-or-later
PKG_LICENSE_FILES:=COPYING
@ -98,7 +98,6 @@ define Package/modemmanager/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ModemManager $(1)/usr/sbin
$(INSTALL_BIN) ./files/usr/sbin/ModemManager-wrapper $(1)/usr/sbin
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mmcli $(1)/usr/bin

View file

@ -20,7 +20,7 @@ MODEMMANAGER_EVENTS_CACHE="${MODEMMANAGER_RUNDIR}/events.cache"
# Common logging
mm_log() {
[ "$(uci -q get openmptcprouter.settings.debug)" = "true" ] && logger -t "ModemManager" "hotplug: $*"
logger -t "ModemManager" "hotplug: $*"
}
################################################################################
@ -39,14 +39,14 @@ mm_find_physdev_sysfs_path() {
# avoid infinite loops iterating
[ -z "${tmp_path}" ] || [ "${tmp_path}" = "/" ] && return
# for USB devices, the physical device will be that with a idVendor
# and idProduct pair of files
# For USB devices, the physical device will be that with a idVendor
# and idProduct pair of files
[ -f "${tmp_path}"/idVendor ] && [ -f "${tmp_path}"/idProduct ] && {
tmp_path=$(readlink -f "$tmp_path")
echo "${tmp_path}"
return
}
# For PCI devices, the physical device will be that with a vendor
# and device pair of files
[ -f "${tmp_path}"/vendor ] && [ -f "${tmp_path}"/device ] && {

10
modemmanager/files/modemmanager.init Normal file → Executable file
View file

@ -22,12 +22,14 @@ start_service() {
# it starts.
#
# All these commands need to be executed on every MM start, even after
# procd-triggered respawns, which is why this is wrapped in a startup
# wrapper script called '/usr/sbin/ModemManager-wrapper'.
# procd-triggered respawns, which is why they're all included as instance command
#
. /usr/share/ModemManager/modemmanager.common
procd_open_instance
procd_set_param command /usr/sbin/ModemManager-wrapper
procd_set_param command sh -c ". /usr/share/ModemManager/modemmanager.common; \
mkdir -m 0755 -p ${MODEMMANAGER_RUNDIR}; \
mm_cleanup_interfaces; \
( mm_report_events_from_cache ) >/dev/null 2>&1 & \
/usr/sbin/ModemManager"
procd_set_param respawn "${respawn_threshold:-3600}" "${respawn_timeout:-5}" "${respawn_retry:-5}"
procd_set_param pidfile "${MODEMMANAGER_PID_FILE}"
procd_close_instance

View file

@ -197,7 +197,6 @@ 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
@ -223,7 +222,6 @@ modemmanager_connected_method_static_ipv4() {
local dns1="$7"
local dns2="$8"
local metric="$9"
local defaultroute="$10"
local mask=""
@ -244,9 +242,8 @@ modemmanager_connected_method_static_ipv4() {
proto_set_keep 1
echo "adding IPv4 address ${address}, netmask ${mask}"
proto_add_ipv4_address "${address}" "${mask}"
[ -n "${gateway}" ] && [ "${defaultroute}" != 0 ] && {
[ -n "${gateway}" ] && {
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}" ] && {
@ -265,7 +262,6 @@ 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
@ -292,7 +288,6 @@ 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
@ -311,7 +306,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}" ] && [ "$defaultroute" != 0 ] && {
[ -n "${gateway}" ] && {
echo "adding default IPv6 route via ${gateway}"
proto_add_ipv6_route "${gateway}" "128"
proto_add_ipv6_route "::0" "0" "${gateway}" "" "" "${address}/${prefix}"
@ -362,9 +357,9 @@ proto_modemmanager_setup() {
local device apn allowedauth username password pincode iptype metric signalrate
local address prefix gateway mtu dns1 dns2 defaultroute
local address prefix gateway mtu dns1 dns2
json_get_vars device apn allowedauth username password pincode iptype metric signalrate defaultroute
json_get_vars device apn allowedauth username password pincode iptype metric signalrate
# validate sysfs path given in config
[ -n "${device}" ] || {
@ -452,7 +447,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}" "${defaultroute}"
modemmanager_connected_method_dhcp_ipv4 "${interface}" "${beareriface}" "${metric}"
;;
"static")
address=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv4-config.address")
@ -461,7 +456,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}" "${defaultroute}"
modemmanager_connected_method_static_ipv4 "${interface}" "${beareriface}" "${address}" "${prefix}" "${gateway}" "${mtu}" "${dns1}" "${dns2}" "${metric}"
;;
"ppp")
modemmanager_connected_method_ppp_ipv4 "${interface}" "${beareriface}" "${username}" "${password}" "${allowedauth}"
@ -479,7 +474,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}" "${defaultroute}"
modemmanager_connected_method_dhcp_ipv6 "${interface}" "${beareriface}" "${metric}"
;;
"static")
address=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv6-config.address")
@ -488,7 +483,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}" "${defaultroute}"
modemmanager_connected_method_static_ipv6 "${interface}" "${beareriface}" "${address}" "${prefix}" "${gateway}" "${mtu}" "${dns1}" "${dns2}" "${metric}"
;;
"ppp")
proto_notify_error "${interface}" "unsupported method"

View file

@ -1,33 +0,0 @@
#!/bin/sh
trap_with_arg() {
func="$1" ; shift
for sig ; do
# shellcheck disable=SC2064
trap "$func $sig" "$sig"
done
}
func_trap() {
logger "ModemManager-wrapper[$$]" "Sending signal ${1}..."
kill "-${1}" "$CHILD" 2>/dev/null
}
main() {
. /usr/share/ModemManager/modemmanager.common
trap_with_arg func_trap INT TERM KILL
mkdir -p "${MODEMMANAGER_RUNDIR}"
chmod 0755 "${MODEMMANAGER_RUNDIR}"
mm_cleanup_interfaces
/usr/sbin/ModemManager "$@" 1>/dev/null 2>/dev/null &
CHILD="$!"
mm_report_events_from_cache
wait "$CHILD"
}
main "$@"