Hi Felix!
Thank you for help,
I am trying to use our hint and changing code. But please, let me know
if way is good.
in /lib/netifd/dhcp.script , I created function:
change_network_state() {
ubus call "network.interface.$1" set_data "{ \"$2\": \"$3\" }"
}
and reworked commented TODO part:
[ -n "$ntpsrv" ] && change_network_state "$INTERFACE" lease_ntpsrv
"$ntpsrv"
...
Everything seems to work:
ubus call network.interface.wan status
{
"up": true,
"pending": false,
"available": true,
"autostart": true,
"uptime": 976,
"l3_device": "br-wan",
"proto": "dhcp",
"device": "br-wan",
"updated": [
"addresses",
"routes",
"data"
],
"metric": 0,
"delegation": true,
"ipv4-address": [
{
"address": "10.0.2.15",
"mask": 24
}
],
"ipv6-address": [
],
"ipv6-prefix": [
],
"ipv6-prefix-assignment": [
],
"route": [
{
"target": "0.0.0.0",
"mask": 0,
"nexthop": "10.0.2.2",
"source": "0.0.0.0\/0"
}
],
"dns-server": [
"10.0.2.3"
],
"dns-search": [
],
"inactive": {
"ipv4-address": [
],
"ipv6-address": [
],
"route": [
],
"dns-server": [
],
"dns-search": [
]
},
"data": {
"lease_dns": "10.0.2.3",
"lease_hostname": "besip",
"lease_siaddr": "10.0.2.2"
}
}
but I am not able to get data from container "data" using jshn.sh . Can
you help me please ?
Even devstate br-wan does not return "data" container.
Thank you very much!
Lukas
Dne 31.3.2014 15:58, Felix Fietkau napsal(a):
On 2014-03-31 15:42, Lukas Macura wrote:
Hi,
we are working on patch which will save DHCP client parameters, because
we needed to get informations later in scripts.
Maybe this is what you need. Our implementation utilises udhcp script
and save needed parameters to /var/state for given interface.
Now we are testing this. I think more people can use this.
We will inform you when patch will be available.
Please don't use /var/state for more network related stuff like this.
You can use something like the following:
ubus call network.interface.<name> set_data '{ "name": "value" }'
That way you can store name/value pairs in the per-interface data in
netifd, which you can retrieve via interface status. When the interface
goes down, the data is cleared again, so cleanup is easy.
- Felix
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel