diff options
Diffstat (limited to 'core/fs/pxe/pxe.c')
-rw-r--r-- | core/fs/pxe/pxe.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/core/fs/pxe/pxe.c b/core/fs/pxe/pxe.c index 9b1a7329..21763395 100644 --- a/core/fs/pxe/pxe.c +++ b/core/fs/pxe/pxe.c @@ -237,13 +237,25 @@ static uint32_t pxe_getfssec(struct file *file, char *buf, /* * Assign an IP address to a URL */ -static void url_set_ip(struct url_info *url) +__export int url_set_ip(struct url_info *url) { + int err = -ntohs(TFTP_OK); + url->ip = 0; - if (url->host) + if (url->host && url->host[0]) { url->ip = pxe_dns(url->host); - if (!url->ip) + if (!url->ip) + err = -ntohs(TFTP_ERESOLVE); + } + + /* Note: default to the server IP on resolve failure */ + if (!url->ip) { url->ip = IPInfo.serverip; + if (!url->ip) + err = -ntohs(TFTP_NONETWORK); + }make + + return err; } /** |