Skip to content

Commit

Permalink
Fix ModemManager restart loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Ysurac committed Nov 2, 2023
1 parent 47ac658 commit 1101dab
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions mptcp/files/usr/share/omr/post-tracking.d/001-post-tracking
Original file line number Diff line number Diff line change
Expand Up @@ -736,17 +736,18 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || [ "$interface_up" != "true" ]; then
_log "Set $OMR_TRACKER_INTERFACE up"
ifup $OMR_TRACKER_INTERFACE
sleep 20
elif [ -n "$OMR_TRACKER_INTERFACE" ] && [ -n "$OMR_TRACKER_DEVICE" ] && ([ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "modemmanager" ] || [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "dhcp" ]); then
for modem in $(mmcli -L | awk -F/ '{ print $6}' | awk '{print $1}'); do
if [ -n "$(timeout 2 mmcli -m $modem -K | grep $OMR_TRACKER_DEVICE)" ]; then
modem_device=$(mmcli -m $modem -K | grep 'modem.generic.device ' | awk '{print $3}')
[ -n "$modem_device" ] && modem_interface=$(uci show network | grep $modem_device | awk -F. '{print $2}')
[ -n "$modem_interface" ] && {
_log "No answer from $OMR_TRACKER_INTERFACE ($OMR_TRACKER_DEVICE), restart associed interface $modem_interface"
ifup $modem_interface
}
fi
done
#elif [ -n "$OMR_TRACKER_INTERFACE" ] && [ -n "$OMR_TRACKER_DEVICE" ] && ([ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "modemmanager" ] || [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "dhcp" ]); then
# for modem in $(mmcli -L | awk -F/ '{ print $6}' | awk '{print $1}'); do
# if [ -n "$(timeout 2 mmcli -m $modem -K | grep $OMR_TRACKER_DEVICE)" ]; then
# modem_device=$(mmcli -m $modem -K | grep 'modem.generic.device ' | awk '{print $3}')
# [ -n "$modem_device" ] && modem_interface=$(uci show network | grep $modem_device | awk -F. '{print $2}')
# [ -n "$modem_interface" ] && {
# _log "No answer from $OMR_TRACKER_INTERFACE ($OMR_TRACKER_DEVICE), restart associed interface $modem_interface"
# ifup $modem_interface
# sleep 30
# }
# fi
# done
fi

# This part must be done after modems restart because we have no idea when modems will be ready again... (another solution would be to check ModemManager status)
Expand Down

0 comments on commit 1101dab

Please sign in to comment.