[luci] Get ipaddr

Steven Barth steven at midlink.org
Fr Sep 5 15:36:48 CEST 2008


You can get the IP-Address of an interface by doing:

> local ipaddr = luci.model.uci.cursor_state():get("network", "lan", "ipaddr")

using cursor_state makes sure you even get the right IP if the interface uses 
DHCP.

And you can set the href parameter of any DummyValue to a valid URL to create 
a link.

> d = s:option(DummyValue, "_bla")
> d.value = "Linktext"
> d.href = "http://example.com"


Make sure you have a recent LuCI checkout.


More information about the luci mailing list