netifd: add devtype to ubus call
authorFlorian Eckert <fe@dev.tdt.de>
Thu, 9 Dec 2021 15:18:19 +0000 (16:18 +0100)
committerHans Dedecker <dedeckeh@gmail.com>
Sat, 25 Dec 2021 19:27:44 +0000 (20:27 +0100)
commit7ccbf08570619a4d3eccf6401791075908bb1d78
treeae47a9c61313aca2bc25500044a0dbd3204bcfd3
parent5ca5e0b4d058a47d72ba4102acdcec826e203c41
netifd: add devtype to ubus call

Every network device has a type. There is no standard interface here.
The type can be determined either from the file
'/sys/class/net/<device>/uevent' or, if no information is found
there, from the file '/sys/class/net/<device>/type'.

This new function first checks whether there is a DEVTYPE=<type> sring in
the 'uevent' file and uses it. If it does not find this information,
the 'type' is used as a fallback and mapped the number to a character
sequence.

This new 'devtype' information can be found in the network.device ubus
call.

Command:
ubus call network.device status

Output:
{
"eth0": {
"devtype": "ethernet",

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
package/network/config/netifd/patches/001-system-linux-add-interface-protocol.patch [new file with mode: 0644]