Hello Denys,
Tested under a debian box: Works as expected with the configuration file
joined !!
Targets tried: debian, centOS, cisco routers
A few very minor remarks:
- with high verbose level (3v), log_static_leases dumps all static
leases, but is called for each new static lease. May be log should be
moved into add_static_lease.
- some typos into the udhcp.conf example
(https://udhcp.busybox.net/udhcpd.conf) : defult (line 55) and defualt
(line 60)
Thanks for the patch, it makes udhcp really helpfull for my project.
Philippe
Le 16/05/2019 à 11:28, Denys Vlasenko a écrit :
Applied with a lot of changes.
Please test current git!
On Tue, May 7, 2019 at 11:18 PM Philippe Jounin
<[email protected] <mailto:[email protected]>> wrote:
Hello all,
First of all, thanks for the continuous support of busybox. I love this set
of small footprints applications.
I made a quick hack for udhcpd to support hostnames for static leases.
If instead of the documented example :
static_lease 00:60:08:11:CE:4E 192.168.0.54
static_lease 00:60:08:11:CE:3E 192.168.0.44
you write :
static_lease 00:60:08:11:CE:4E 192.168.0.54 host-54
static_lease 00:60:08:11:CE:3E 192.168.0.44 host-44
udhcpd will use the fourth word to set the HOST_NAME (0x0c) option,
allowing the server to set the remote hostname for each static lease.
Here is the patch, feel free to add it into the next release if you think
that it may be useful to someone else.
BTW i created the patch file with the command:
diff -ruN busybox-1.30.1/networking/udhcp/
busybox-1.30.2/networking/udhcp/ > ~/udhcpd.patch,
hope it is fine.
Best regards,
Philippe Jounin
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
Garanti sans virus. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
<#m_7493830070768084865_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
_______________________________________________
busybox mailing list
[email protected] <mailto:[email protected]>
http://lists.busybox.net/mailman/listinfo/busybox
---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel
antivirus Avast.
https://www.avast.com/antivirus
# Sample udhcpd configuration file (/etc/udhcpd.conf)
# The start and end of the IP lease block
# start 192.168.0.20 #default: 192.168.0.20
# end 192.168.0.254 #default: 192.168.0.254
# The interface that udhcpd will use
interface eth0.1654 #default: eth0
# The maximim number of leases (includes addressesd reserved
# by OFFER's, DECLINE's, and ARP conficts
#max_leases 254 #default: 254
# If remaining is true (default), udhcpd will store the time
# remaining for each lease in the udhcpd leases file. This is
# for embedded systems that cannot keep time between reboots.
# If you set remaining to no, the absolute time that the lease
# expires at will be stored in the dhcpd.leases file.
#remaining yes #default: yes
# The time period at which udhcpd will write out a dhcpd.leases
# file. If this is 0, udhcpd will never automatically write a
# lease file. (specified in seconds)
#auto_time 7200 #default: 7200 (2 hours)
# The amount of time that an IP will be reserved (leased) for if a
# DHCP decline message is received (seconds).
#decline_time 3600 #default: 3600 (1 hour)
# The amount of time that an IP will be reserved (leased) for if an
# ARP conflct occurs. (seconds
#conflict_time 3600 #default: 3600 (1 hour)
# How long an offered address is reserved (leased) in seconds
#offer_time 60 #default: 60 (1 minute)
# If a lease to be given is below this value, the full lease time is
# instead used (seconds).
#min_lease 60 #defult: 60
# The location of the leases file
#lease_file /var/lib/misc/udhcpd.leases #defualt:
/var/lib/misc/udhcpd.leases
# The location of the pid file
#pidfile /var/run/udhcpd.pid #default: /var/run/udhcpd.pid
# Everytime udhcpd writes a leases file, the below script will be called.
# Useful for writing the lease file to flash every few hours.
#notify_file #default: (no script)
#notify_file dumpleases # <--- usefull for debugging
# The following are bootp specific options, setable by udhcpd.
#siaddr 192.168.0.22 #default: 0.0.0.0
#sname zorak #default: (none)
#boot_file /var/nfs_root #default: (none)
# The remainer of options are DHCP options and can be specifed with the
# keyword 'opt' or 'option'. If an option can take multiple items, such
# as the dns option, they can be listed on the same line, or multiple
# lines. The only option with a default is 'lease'.
#Examles
opt dns 208.67.222.222 208.67.220.220
option subnet 255.255.255.0
opt router 172.16.54.1
option domain sclab.space
option lease 864000 # 10 days of seconds
# Currently supported options, for more info, see options.c
#subnet
#timezone
#router
#timesvr
#namesvr
#dns
#logsvr
#cookiesvr
#lprsvr
#bootsize
#domain
#swapsvr
#rootpath
#ipttl
#mtu
#broadcast
#wins
#lease
#ntpsrv
#tftp
#bootfile
static_lease 00:50:56:16:54:e6 172.16.54.230 csrv1k-230
static_lease 00:50:56:16:54:e7 172.16.54.231 csrv1k-231
static_lease 00:50:56:16:54:e8 172.16.54.232 csrv1k-232
static_lease 00:50:56:16:54:e9 172.16.54.233 csrv1k-233
static_lease 00:50:56:16:54:ea 172.16.54.234 csrv1k-234
static_lease 00:50:56:16:54:eb 172.16.54.235 csrv1k-235
static_lease 00:50:56:16:54:ec 172.16.54.236 csrv1k-236
static_lease 00:50:56:16:54:ed 172.16.54.237 csrv1k-237
static_lease 00:50:56:16:54:ee 172.16.54.238 csrv1k-238
static_lease 00:50:56:16:54:ef 172.16.54.239 csrv1k-239
static_lease 00:50:56:16:54:f0 172.16.54.240 centoslab-240
static_lease 00:50:56:16:54:f1 172.16.54.241 centoslab-241
static_lease 00:50:56:16:54:f2 172.16.54.242 centoslab-242
static_lease 00:50:56:16:54:f3 172.16.54.243 centoslab-243
static_lease 00:50:56:16:54:f4 172.16.54.244 centoslab-244
static_lease 00:50:56:16:54:f5 172.16.54.245 centoslab-245
static_lease 00:50:56:16:54:f6 172.16.54.246 centoslab-246
static_lease 00:50:56:16:54:f7 172.16.54.247 centoslab-247
static_lease 00:50:56:16:54:f8 172.16.54.248 centoslab-248
static_lease 00:50:56:16:54:f9 172.16.54.249 centoslab-249
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox