I looked into this a little bit and there are my findings:
ifup
executesubus call network.interface down
and thenubus call network.interface up
. in my casedown
takes ~2 secs andup
takes ~5 secsnetwork.interface down
callsproto_modemmanager_teardown()
which among other things executesmmcli --modem="${device}" --disable
network.interface up
callsproto_modemmanager_setup()
So if the connection drops the entire modem is disabled and then enabled which takes quite a bit of time. The script seems to have changed slightly in the snapshot I'm using, but as a proof of concept you could try this:
IFUP=$(ifstatus "${CFG}" | jsonfilter -e "@.up")
[ "${IFUP}" = "true" ] && {
logger -t "modemmanager" "interface ${CFG} (network device ${INTERFACE}) ${STATE}"
mmcli --modem="${MODEM_PATH}" -b "${BEARER_PATH}" -c && exit 0
proto_init_update $INTERFACE 0
proto_send_update $CFG
}
exit 0
Now this is super dirty, not recommended, and doesn't take care of things like IP address change but shows that MM can reconnect quickly if it doesn't disable the modem first.