|
@@ -18,6 +18,7 @@
|
18
|
18
|
|
19
|
19
|
#include <string.h>
|
20
|
20
|
#include <stdlib.h>
|
|
21
|
+#include <stdio.h>
|
21
|
22
|
#include <errno.h>
|
22
|
23
|
#include <assert.h>
|
23
|
24
|
#include <byteswap.h>
|
|
@@ -29,6 +30,7 @@
|
29
|
30
|
#include <gpxe/retry.h>
|
30
|
31
|
#include <gpxe/tcpip.h>
|
31
|
32
|
#include <gpxe/ip.h>
|
|
33
|
+#include <gpxe/uri.h>
|
32
|
34
|
#include <gpxe/dhcp.h>
|
33
|
35
|
|
34
|
36
|
/** @file
|
|
@@ -857,6 +859,9 @@ int dhcp_configure_netdev ( struct net_device *netdev,
|
857
|
859
|
struct in_addr netmask = { 0 };
|
858
|
860
|
struct in_addr gateway = { INADDR_NONE };
|
859
|
861
|
struct sockaddr_in *sin_nameserver;
|
|
862
|
+ struct in_addr tftp_server;
|
|
863
|
+ struct uri *uri;
|
|
864
|
+ char uri_string[32];
|
860
|
865
|
int rc;
|
861
|
866
|
|
862
|
867
|
/* Clear any existing routing table entry */
|
|
@@ -883,5 +888,15 @@ int dhcp_configure_netdev ( struct net_device *netdev,
|
883
|
888
|
find_dhcp_ipv4_option ( options, DHCP_LOG_SERVERS,
|
884
|
889
|
&syslogserver );
|
885
|
890
|
|
|
891
|
+ /* Set current working URI based on TFTP server */
|
|
892
|
+ find_dhcp_ipv4_option ( options, DHCP_EB_SIADDR, &tftp_server );
|
|
893
|
+ snprintf ( uri_string, sizeof ( uri_string ),
|
|
894
|
+ "tftp://%s/", inet_ntoa ( tftp_server ) );
|
|
895
|
+ uri = parse_uri ( uri_string );
|
|
896
|
+ if ( ! uri )
|
|
897
|
+ return -ENOMEM;
|
|
898
|
+ churi ( uri );
|
|
899
|
+ uri_put ( uri );
|
|
900
|
+
|
886
|
901
|
return 0;
|
887
|
902
|
}
|