Pretty nice patch, I welcome it!
However 'empty_string' should be handled differently, I personally would suggest using a ternary _expression_ and returning "" there.

So turning:
add_static_lease(arg, (uint8_t*) &mac_bytes, hostname, nip);
into:
add_static_lease(arg, (uint8_t*) &mac_bytes, (hostname != NULL) ? hostname : "", nip);

//M

Sent from my BlackBerry — the most secure mobile device
Sent: 7 May 2019 23:18
Subject: udhcpd: HOST_NAME support for static leases

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



Garanti sans virus. www.avast.com
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to