[PATCH 15/27] net: dhcp: rework

Oleksij Rempel linux at rempel-privat.de
Fri Dec 8 13:56:04 PST 2017


Hi.

Am 01.12.2017 um 12:22 schrieb Sascha Hauer:
> 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.
> 
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> ---
>  commands/dhcp.c |  15 +-
>  include/dhcp.h  |  22 ++-
>  net/dhcp.c      | 532 ++++++++++++++++++++++----------------------------------
>  3 files changed, 234 insertions(+), 335 deletions(-)

.......

> @@ -693,56 +516,122 @@ int dhcp(struct eth_device *edev, int retries, struct dhcp_req_param *param)
>  			printf("T ");
>  			ret = bootp_request();
>  			/* no need to check if retries > 0 as we check if != 0 */
> -			retries--;
> +			dhcp_param.retries--;
>  			if (ret)
>  				goto out1;
>  		}
>  	}
>  
> -	if (dhcp_tftpname[0] != 0) {
> -		IPaddr_t tftpserver = resolv(dhcp_tftpname);
> -		if (tftpserver)
> -			net_set_serverip_empty(tftpserver);
> -	}

Without this part tftp is not working in my network. On LEDE/OpenWrt
with web interface i can set tftp server and root path, which is done by
setting additional DHCP options:
66,192.168.1.100
17,192.168.1.100

Adding "54,192.168.1.100" to overwrite serverip is not working.

I'm not sure what is the proper way to fix it.
-- 
Regards,
Oleksij

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/barebox/attachments/20171208/b1f20a21/attachment.sig>


More information about the barebox mailing list