Hello,

I found a problem with openwrt regarding when dhcp server on lan changes. To 
get openwrt faster change of its wan ip I need to change to default lease 
time.

udhcpc help says:

----
        -x OPT:VAL              Include option OPT in sent packets 
(cumulative)
                                Examples of string, numeric, and hex byte 
opts:
                                -x hostname:bbox - option 12
                                -x lease:3600 - option 51 (lease time)
                                -x 0x3d:0100BEEFC0FFEE - option 61 (client id
----

The -x option simply need to be added on udhcpc call.

This patch adds -x option as xopts config var and is against attitude 
adjustment (trunk is fine too). You simply have to add xopts in interface 
section at /etc/config/network (e.g. lease time 60 seconds):

config interface 'wan'
        option ifname 'eth1'
        option proto 'dhcp'
        option xopts 'lease:60'


With best regards

Christoph
-- 
Linux User Group Wernigerode
http://www.lug-wr.de/
--- package/netifd/files/lib/netifd/proto/dhcp.sh.orig	2013-04-10 09:47:54.054695157 +0200
+++ package/netifd/files/lib/netifd/proto/dhcp.sh	2013-04-10 09:48:29.406696275 +0200
@@ -12,20 +12,26 @@
 	proto_config_add_string "vendorid"
 	proto_config_add_boolean "broadcast"
 	proto_config_add_string "reqopts"
+	proto_config_add_string "xopts"
 }
 
 proto_dhcp_setup() {
 	local config="$1"
 	local iface="$2"
 
-	local ipaddr hostname clientid vendorid broadcast reqopts
-	json_get_vars ipaddr hostname clientid vendorid broadcast reqopts
+	local ipaddr hostname clientid vendorid broadcast reqopts xopts
+	json_get_vars ipaddr hostname clientid vendorid broadcast reqopts xopts
 
 	local opt dhcpopts
 	for opt in $reqopts; do
 		append dhcpopts "-O $opt"
 	done
 
+	local xopt xopts
+        for xopt in $xopts; do
+                append dhcpopts "-x $xopt"
+        done
+
 	[ "$broadcast" = 1 ] && broadcast="-B" || broadcast=
 	[ -n "$clientid" ] && clientid="-x 0x3d:${clientid//:/}" || clientid="-C"
 

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to