Re: [PATCH 12/21] net: dhcp: rework

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sasha.

On Fri, Nov 24, 2017 at 09:12:28AM +0100, Sascha Hauer wrote:
> The DHCP code is a mess. It is not clear which options are sent to the
> server and which options are returned from the server. Also environment
> variables are read from and written to all over the place.
> 
> This patch cleans this up. There now is struct dhcp_req_param which is
> used for options sent to the server and struct dhcp_result which contains
> the values sent from the server. The values from the server are written
> to the barebox variables in a single place. Also it's now possible to
> call the dhcp code without modifying barebox variables at all, storing
> the result only in the dhcp result struct.

Browsing the code gave a nice impression that things
got much simpler.
Noticed one thing.

This struct is not the smallest..
> +
> +struct dhcp_result {
> +	IPaddr_t ip;
> +	IPaddr_t netmask;
> +	IPaddr_t gateway;
> +	IPaddr_t nameserver;
> +	IPaddr_t serverip;
> +	char *hostname;
> +	char *domainname;
> +	char *rootpath;
> +	char *devicetree;
> +	char *bootfile;
> +	char *tftp_server_name;
> +	uint32_t leasetime;
>  };

> +struct dhcp_req_param dhcp_param;
> +struct dhcp_result *dhcp_result;
Is this why the struct is xalloc()'er and not a static variable like dhcp_param?
Maybe the lifetime of the two differs - which may also explain it.

	Sam

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux