Skip to contentSkip to conversation

net: dhcp: make tftp work again

PATCH In review Oleksij Rempel 2 participants 2 messages Dec 9, 2017 – Dec 12, 2017 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: dhcp: make tftp work again

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.

---
 net/dhcp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/dhcp.c +3 -3
index 76dab5ef5..18f347d2f 100644
@@ -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;
Signature · 7 lines
2.14.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 10 lines · 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.

Squashed into the original commit, thanks for fixing.

Sascha

Quoted 35 lines
---
 net/dhcp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/dhcp.c +3 -3
index 76dab5ef5..18f347d2f 100644
@@ -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;
Signature · 7 lines
2.14.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox