-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modemmanager: report network initiated disconnections to netifd
The new connection dispatcher scripts support integrated in ModemManager 1.18.8 allows us to provide a openwrt-specific dispatcher script used to report netifd that the underlying network connection is down. See also https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/775 Fixes openwrt/openwrt#8368 Fixes #14096 Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> (cherry picked from commit bc754f3)
- Loading branch information
1 parent
2774710
commit 2aff57e
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/sh | ||
|
||
# SPDX-License-Identifier: CC0-1.0 | ||
# 2022 Aleksander Morgado <aleksander@aleksander.es> | ||
# | ||
# Automatically report to netifd that the underlying modem | ||
# is really disconnected | ||
# | ||
# require program name and at least 4 arguments | ||
[ $# -lt 4 ] && exit 1 | ||
|
||
MODEM_PATH="$1" | ||
BEARER_PATH="$2" | ||
INTERFACE="$3" | ||
STATE="$4" | ||
|
||
[ "${STATE}" = "disconnected" ] || exit 0 | ||
|
||
. /usr/share/ModemManager/modemmanager.common | ||
. /lib/netifd/netifd-proto.sh | ||
INCLUDE_ONLY=1 . /lib/netifd/proto/modemmanager.sh | ||
|
||
MODEM_STATUS=$(mmcli --modem="${MODEM_PATH}" --output-keyvalue) | ||
[ -n "${MODEM_STATUS}" ] || exit 1 | ||
|
||
MODEM_DEVICE=$(modemmanager_get_field "${MODEM_STATUS}" "modem.generic.device") | ||
[ -n "${MODEM_DEVICE}" ] || exit 2 | ||
|
||
CFG=$(mm_get_modem_config "${MODEM_DEVICE}") | ||
[ -n "${CFG}" ] || exit 3 | ||
|
||
logger -t "modemmanager" "interface ${CFG} (network device ${INTERFACE}) ${STATE}" | ||
proto_init_update $INTERFACE 0 | ||
proto_send_update $CFG | ||
exit 0 |