retrieving the interface name via ip address

e9hack e9hack at
Thu Mar 3 00:28:36 PST 2022


it exist the two functions network_get_subnet and network_get_subnet6 in /lib/functions/ They return the first ip or ip6 address of a given interface. In my case:

root at my-openwrt:~# . /lib/functions/; network_get_subnet subnet "lan"; echo $subnet; network_get_subnet6 subnet6 "lan"; echo $subnet6

Does exist the reverse function too? I would like to get the interface for an ip address, ether for the real address of the interface or for an ip address of the subnet.


More information about the openwrt-devel mailing list