mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] net: dhcp: make tftp work again
@ 2017-12-09  9:31 Oleksij Rempel
  2017-12-12  7:44 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Oleksij Rempel @ 2017-12-09  9:31 UTC (permalink / raw)
  To: barebox; +Cc: Oleksij Rempel

This regression was introduced by the patch "net: dhcp: rework"
My patch should restore previous behavior where tftp server name
will overwrite serverip if the first one is present.

On most consumer devices users don't have enough control to set
DHCP as needed. At least on LEDE/OpenWRT we can configure extra
fields by adding for example "66,192.168.1.100" to set tftp server name.
At the same time, DHCP, DNS and Gateware are provided by 192.168.1.1.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 net/dhcp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/dhcp.c b/net/dhcp.c
index 76dab5ef5..18f347d2f 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -574,14 +574,14 @@ int dhcp_set_result(struct eth_device *edev, struct dhcp_result *res)
 	if (res->domainname)
 		net_set_domainname(res->domainname);
 
-	if (res->serverip) {
-		net_set_serverip_empty(res->serverip);
-	} else if (res->tftp_server_name) {
+	if (res->tftp_server_name) {
 		IPaddr_t ip;
 
 		ip = resolv(res->tftp_server_name);
 		if (ip)
 			net_set_serverip_empty(ip);
+	} else if (res->serverip) {
+		net_set_serverip_empty(res->serverip);
 	}
 
 	return 0;
-- 
2.14.1


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: dhcp: make tftp work again
  2017-12-09  9:31 [PATCH] net: dhcp: make tftp work again Oleksij Rempel
@ 2017-12-12  7:44 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2017-12-12  7:44 UTC (permalink / raw)
  To: Oleksij Rempel; +Cc: barebox

On Sat, Dec 09, 2017 at 10:31:44AM +0100, Oleksij Rempel wrote:
> This regression was introduced by the patch "net: dhcp: rework"
> My patch should restore previous behavior where tftp server name
> will overwrite serverip if the first one is present.
> 
> On most consumer devices users don't have enough control to set
> DHCP as needed. At least on LEDE/OpenWRT we can configure extra
> fields by adding for example "66,192.168.1.100" to set tftp server name.
> At the same time, DHCP, DNS and Gateware are provided by 192.168.1.1.
> 
> Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>

Squashed into the original commit, thanks for fixing.

Sascha

> ---
>  net/dhcp.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/dhcp.c b/net/dhcp.c
> index 76dab5ef5..18f347d2f 100644
> --- a/net/dhcp.c
> +++ b/net/dhcp.c
> @@ -574,14 +574,14 @@ int dhcp_set_result(struct eth_device *edev, struct dhcp_result *res)
>  	if (res->domainname)
>  		net_set_domainname(res->domainname);
>  
> -	if (res->serverip) {
> -		net_set_serverip_empty(res->serverip);
> -	} else if (res->tftp_server_name) {
> +	if (res->tftp_server_name) {
>  		IPaddr_t ip;
>  
>  		ip = resolv(res->tftp_server_name);
>  		if (ip)
>  			net_set_serverip_empty(ip);
> +	} else if (res->serverip) {
> +		net_set_serverip_empty(res->serverip);
>  	}
>  
>  	return 0;
> -- 
> 2.14.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-12  7:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-09  9:31 [PATCH] net: dhcp: make tftp work again Oleksij Rempel
2017-12-12  7:44 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox