OpenWrt/LEDE Project

  • Status Unconfirmed
  • Percent Complete
    0%
  • Task Type Bug Report
  • Category Base system
  • Assigned To No-one
  • Operating System All
  • Severity Low
  • Priority Very Low
  • Reported Version Trunk
  • Due in Version Undecided
  • Due Date Undecided
  • Private
Attached to Project: OpenWrt/LEDE Project
Opened by Aleksander Morgado - 09.12.2020

FS#3499 - [netifd] no way to monitor the real state of a connection via protocol handlers

The current ModemManager integration in netifd is not fully operational right now, and usually requires an additional management script on top of it to properly reconnect the modems under certain scenarios.

The simplest and most common use case is the following:
* The network interface configured for “modemmanager” protocol is ifup-ed.
* netifd runs the connection start procedure in the protocol handler and the modem gets connected.
* Some time passes, and the network operator decides to disconnect the connection (network-initiated disconnection).
* ModemManager detects the disconnection, reports the bearer objects a “disconnected” and the modem back to only “registered”.
* netifd still thinks the interface is up, and reports it as up everywhere.

See e.g. https://github.com/openwrt/packages/issues/14096

What would be the best way to solve this issue?

Is there currently any way to extend the protocol handler in a way that allows some polling inside netifd to ensure the interface is still up? Would that be a big change? Any other solution suggested?

 


John commented on 13.12.2020 11:04

Hi,
Thank you for you work with ModemManager!
For a long time, I have used a USB NCM modem (without knowing of MM),
and have wanted a way for it to detect disconnect and automatically reconnect.

I do not know ModemManager, or ubus / netifd.

I do not know if it works, but it looks like at one stage, ppp used netifd for reconnects:
https://github.com/openwrt-mirror/openwrt/commit/3411334dd8d55107fe9dc1fcf018b28fcbbeb90b

Could we use MM's dbus state change to make a ubus call to netifd?
Even if it is an external daemon monitoring dbus?
https://www.freedesktop.org/software/ModemManager/api/latest/ModemManager-Flags-and-Enumerations.html#MMModemState

Example:
From the ppp proto, the proto_run_command uses the ip-down-script /lib/netifd/ppp-down, which sends a message to netifd via ubus through the shell library.
https://github.com/openwrt/openwrt/blob/master/package/network/services/ppp/files/lib/netifd/ppp-down

ubus monitor
-> 97d0daf0 #97d0daf0          hello: {}
<- 97d0daf0 #00000000         lookup: {"objpath":"network.interface"}
-> 97d0daf0 #00000000           data: {"objpath":"network.interface","objid":140326987,"objtype":-806725414,"signature":{"up":{},"down":{},"renew":{},"status":{},"prepare":{},"dump":{},"add_device":{"name":3,"link-ext":7,"vlan":1},"remove_device":{"name":3,"link-ext":7,"vlan":1},"notify_proto":{},"remove":{},"set_data":{}}}
-> 97d0daf0 #00000000         status: {"status":0}
<- 97d0daf0 #085d384b         invoke: {"objid":140326987,"method":"notify_proto","data":{"action":0,"ifname":"ifname_example","link-up":false,"keep":false,"interface":"interface_example"}}
-> bacdf6e3 #97d0daf0         invoke: {"objid":140326987,"method":"notify_proto","data":{"action":0,"ifname":"ifname_example","link-up":false,"keep":false,"interface":"interface_example"},"user":"root","group":"root"}

. /lib/netifd/netifd-proto.sh
proto_init_update "ifname_example" 0
proto_send_update "interface_example"

echo "$(json_dump)"
{ "action": 0, "ifname": "ifname_example", "link-up": false, "keep": false, "interface": "interface_example" }
ubus call network.interface notify_proto "$(json_dump)"

Netifd shell functions:
/lib/netifd/netifd-proto.sh
https://git.openwrt.org/?p=project/netifd.git;a=blob;f=scripts/netifd-proto.sh

json shell functions:
/usr/share/libubox/jshn.sh
https://git.openwrt.org/?p=project/libubox.git;a=blob;f=sh/jshn.sh

If something like this might work, I can keep digging?

Cheers

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing