This patch allows to store obtained DHCP options per interface in netifd.
Signed-off-by: Lukas Macura <[email protected]>
Tested-by: Jiri Slachta <[email protected]>
---
.../config/netifd/files/lib/netifd/dhcp.script | 23 +++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/package/network/config/netifd/files/lib/netifd/dhcp.script
b/package/network/config/netifd/files/lib/netifd/dhcp.script
index 948c3cd..30bbfd5 100755
--- a/package/network/config/netifd/files/lib/netifd/dhcp.script
+++ b/package/network/config/netifd/files/lib/netifd/dhcp.script
@@ -4,6 +4,11 @@
. /lib/functions.sh
. /lib/netifd/netifd-proto.sh
+
+change_network_state() {
+ ubus call "network.interface.$1" set_data "{ \"$2\": \"$3\" }"
+}
+
set_classless_routes() {
local max=128
local type
@@ -60,11 +65,19 @@ setup_interface () {
ubus call network add_dynamic "$(json_dump)"
fi
- # TODO
- # [ -n "$ntpsrv" ] && change_state network "$ifc" lease_ntpsrv
"$ntpsrv"
- # [ -n "$timesvr" ] && change_state network "$ifc" lease_timesrv
"$timesvr"
- # [ -n "$hostname" ] && change_state network "$ifc" lease_hostname
"$hostname"
- # [ -n "$timezone" ] && change_state network "$ifc"
lease_timezone "$timezone"
+ [ -n "$ntpsrv" ] && change_network_state "$INTERFACE" lease_ntpsrv
"$ntpsrv"
+ [ -n "$hostname" ] && change_network_state "$INTERFACE"
lease_hostname "$hostname"
+ [ -n "$search" ] && change_network_state "$INTERFACE" lease_domain
"$search"
+ [ -n "$dns" ] && change_network_state "$INTERFACE" lease_dns
"$dns"
+ [ -n "$timezone" ] && change_network_state "$INTERFACE"
lease_timezone "$timezone"
+ [ -n "$boot_file" ] && change_network_state "$INTERFACE"
lease_bootfile "$boot_file"
+ [ -n "$serverid" ] && change_network_state "$INTERFACE" lease_tftp
"$serverid"
+ [ -n "$tftp" ] && change_network_state "$INTERFACE" lease_tftp
"$tftp"
+ [ -n "$siaddr" ] && change_network_state "$INTERFACE" lease_siaddr
"$siaddr"
+ [ -n "$sname" ] && change_network_state "$INTERFACE" lease_sname
"$sname"
+ [ -n "$logsvr" ] && change_network_state "$INTERFACE" lease_logsvr
"$logsvr"
+ [ -n "$lprsvr" ] && change_network_state "$INTERFACE" lease_lprsvr
"$lprsvr"
+
}
deconfig_interface() {
--
1.9.1
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel