Hello Markus,

You are right: this is definitively better !

Moreover, i do not check that HOST_NAME option 0x0c  is already present if you have a udhcpd.conf like

        static_lease 00:60:08:11:CE:4E192.168.0.54  <http://192.168.0.54>  
host-54
        hostname newname

You will see if it is necessary, but for me this configuration is meaningless, so i did not bother to check for it.

Best regards,
Philippe

Le 07/05/2019 à 23:43, Markus Gothe a écrit :
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
*From:* [email protected]
*Sent:* 7 May 2019 23:18
*To:* [email protected]
*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:4E192.168.0.54  <http://192.168.0.54>
        static_lease 00:60:08:11:CE:3E192.168.0.44  <http://192.168.0.44>
you write :
        static_lease 00:60:08:11:CE:4E192.168.0.54  <http://192.168.0.54>  
host-54
        static_lease 00:60:08:11:CE:3E192.168.0.44  <http://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  <http://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>

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>




---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel 
antivirus Avast.
https://www.avast.com/antivirus
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to