[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [PATCH 4/5] udhcpc: obtain hostname from OS by default
From: Andreas Oberritter <obi () opendreambox ! org>
Date: 2013-04-22 8:49:23
Message-ID: 5174F993.7010107 () opendreambox ! org
[Download RAW message or body]
Ping.
On 20.03.2013 15:31, Andreas Oberritter wrote:
> * Doesn't require the 'hostname' option in /etc/network/interfaces,
> and thus makes udhcpc behave like other clients.
>
> Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
> ---
> networking/udhcp/dhcpc.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
> index fe2e681..35487b6 100644
> --- a/networking/udhcp/dhcpc.c
> +++ b/networking/udhcp/dhcpc.c
> @@ -1375,6 +1375,15 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
> logmode |= LOGMODE_SYSLOG;
> }
>
> + /* try to get hostname from OS */
> + if (!client_config.hostname) {
> + char hostname[256]; /* SUSv2: hostnames are <= 255 bytes */
> + if (gethostname(hostname, sizeof(hostname)) == 0) {
> + hostname[sizeof(hostname) - 1] = '\0';
> + client_config.hostname = alloc_dhcp_option(DHCP_HOST_NAME, hostname, 0);
> + }
> + }
> +
> /* Make sure fd 0,1,2 are open */
> bb_sanitize_stdio();
> /* Equivalent of doing a fflush after every \n */
>
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic