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

OpenWrt Bugs openwrt-bugs at lists.openwrt.org
Sun Dec 13 06:04:40 EST 2020


THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

The following task has a new comment added:

FS#3499 - [netifd] no way to monitor the real state of a connection via protocol handlers
User who did this - John (johnth)

----------
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           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}
 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
----------

More information can be found at the following URL:
https://bugs.openwrt.org/index.php?do=details&task_id=3499#comment9161

You are receiving this message because you have requested it from the Flyspray bugtracking system.  If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.



More information about the openwrt-bugs mailing list