[syslinux:master] pxe_dns: remove obsolete pxe_dns.c wrapper

syslinux-bot for H. Peter Anvin hpa at linux.intel.com
Wed Apr 6 12:39:02 PDT 2016


Commit-ID:  edb6d3e81a891331d0adea527dc4adbe45db64d4
Gitweb:     http://www.syslinux.org/commit/edb6d3e81a891331d0adea527dc4adbe45db64d4
Author:     H. Peter Anvin <hpa at linux.intel.com>
AuthorDate: Wed, 6 Apr 2016 12:34:01 -0700
Committer:  H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Wed, 6 Apr 2016 12:34:01 -0700

pxe_dns: remove obsolete pxe_dns.c wrapper

We used to need a wrapper around the core function dns_resolv() to
implement pxe_dns(), because the former function required its argument
to live in low memory.  This is no longer the case and hasn't been for
a while, so remove this unnecessary level of indirection.

Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>

---
 com32/include/syslinux/pxe_api.h |  2 +-
 com32/lib/Makefile               |  1 -
 com32/lib/syslinux/pxe_dns.c     | 67 ----------------------------------------
 com32/libupload/upload_tftp.c    |  2 +-
 com32/modules/host.c             |  7 +----
 com32/samples/resolv.c           |  2 +-
 core/fs/pxe/dnsresolv.c          | 12 +------
 core/fs/pxe/pxe.c                |  2 +-
 core/legacynet/dnsresolv.c       |  2 +-
 efi/pxe.c                        |  2 +-
 10 files changed, 8 insertions(+), 91 deletions(-)

diff --git a/com32/include/syslinux/pxe_api.h b/com32/include/syslinux/pxe_api.h
index d1fea37..40794e7 100644
--- a/com32/include/syslinux/pxe_api.h
+++ b/com32/include/syslinux/pxe_api.h
@@ -587,7 +587,7 @@ typedef struct s_PXENV_UNLOAD_STACK {
 
 int pxe_call(int, void *);
 void unload_pxe(uint16_t flags);
-uint32_t dns_resolv(const char *);
+uint32_t pxe_dns(const char *);
 
 extern uint32_t SendCookies;
 void http_bake_cookies(void);
diff --git a/com32/lib/Makefile b/com32/lib/Makefile
index 8865224..74fff14 100644
--- a/com32/lib/Makefile
+++ b/com32/lib/Makefile
@@ -46,7 +46,6 @@ LIBSYSLINUX_OBJS = \
 	syslinux/reboot.o syslinux/keyboard.o				\
 	syslinux/version.o						\
 	syslinux/pxe_get_cached.o syslinux/pxe_get_nic.o		\
-	syslinux/pxe_dns.o						\
 	syslinux/video/fontquery.o syslinux/video/reportmode.o
 
 DYNENTRY_OBJS = \
diff --git a/com32/lib/syslinux/pxe_dns.c b/com32/lib/syslinux/pxe_dns.c
deleted file mode 100644
index b813b54..0000000
--- a/com32/lib/syslinux/pxe_dns.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* ----------------------------------------------------------------------- *
- *
- *   Copyright 2010 Intel Corporation; author: H. Peter Anvin
- *
- *   Permission is hereby granted, free of charge, to any person
- *   obtaining a copy of this software and associated documentation
- *   files (the "Software"), to deal in the Software without
- *   restriction, including without limitation the rights to use,
- *   copy, modify, merge, publish, distribute, sublicense, and/or
- *   sell copies of the Software, and to permit persons to whom
- *   the Software is furnished to do so, subject to the following
- *   conditions:
- *
- *   The above copyright notice and this permission notice shall
- *   be included in all copies or substantial portions of the Software.
- *
- *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *   OTHER DEALINGS IN THE SOFTWARE.
- *
- * ----------------------------------------------------------------------- */
-
-/*
- * pxe_dns.c
- *
- * Resolve a hostname via DNS
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include <com32.h>
-
-#include <syslinux/pxe.h>
-
-/* Returns the status code from PXE (0 on success),
-   or -1 on invocation failure */
-uint32_t pxe_dns(const char *hostname)
-{
-    union {
-	unsigned char b[4];
-	uint32_t ip;
-    } q;
-    char *lm_hostname;
-    uint32_t status;
-
-    /* Is this a dot-quad? */
-    if (sscanf(hostname, "%hhu.%hhu.%hhu.%hhu",
-	       &q.b[0], &q.b[1], &q.b[2], &q.b[3]) == 4)
-	return q.ip;
-
-    lm_hostname = lstrdup(hostname);
-    if (!lm_hostname)
-	return 0;
-
-    status = dns_resolv(lm_hostname);
-
-    lfree(lm_hostname);
-
-    return status;
-}
diff --git a/com32/libupload/upload_tftp.c b/com32/libupload/upload_tftp.c
index 80fe0bf..e8ead2c 100644
--- a/com32/libupload/upload_tftp.c
+++ b/com32/libupload/upload_tftp.c
@@ -117,7 +117,7 @@ static bool have_real_network(void)
     return tftp_put != _dummy_tftp_put;
 }
 
-__weak uint32_t dns_resolv(const char *host)
+__weak uint32_t pxe_dns(const char *host)
 {
     (void)host;
 
diff --git a/com32/modules/host.c b/com32/modules/host.c
index d70efff..be7f6ce 100644
--- a/com32/modules/host.c
+++ b/com32/modules/host.c
@@ -6,11 +6,6 @@
 #include <com32.h>
 #include <syslinux/pxe.h>
 
-static inline uint32_t dns_resolve(const char *hostname)
-{
-    return pxe_dns(hostname);
-}
-
 static inline void usage(const char *s)
 {
     fprintf(stderr, "Usage: %s hostname [, hostname_1, hostname_2, ...]\n", s);
@@ -29,7 +24,7 @@ int main(int argc, char *argv[])
     }
 
     for (i = 1; i < argc; i++) {
-        ip = dns_resolve(argv[i]);
+        ip = pxe_dns(argv[i]);
         if (!ip) {
             printf("%s not found.\n", argv[i]);
         } else {
diff --git a/com32/samples/resolv.c b/com32/samples/resolv.c
index 8f062d1..a6757b7 100644
--- a/com32/samples/resolv.c
+++ b/com32/samples/resolv.c
@@ -25,7 +25,7 @@
 
 uint32_t resolv(const char *name)
 {
-    return dns_resolv(name);
+    return pxe_dns(name);
 }
 
 int main(int argc, char *argv[])
diff --git a/core/fs/pxe/dnsresolv.c b/core/fs/pxe/dnsresolv.c
index afb9e21..26c5b34 100644
--- a/core/fs/pxe/dnsresolv.c
+++ b/core/fs/pxe/dnsresolv.c
@@ -88,7 +88,7 @@ static bool parse_dotquad(const char *ip_str, uint32_t *res)
  * _ip_ if it exists and can be found.  If _ip_ = 0 on exit, the
  * lookup failed. _name_ will be updated
  */
-__export uint32_t dns_resolv(const char *name)
+__export uint32_t pxe_dns(const char *name)
 {
     err_t err;
     struct ip_addr ip;
@@ -122,13 +122,3 @@ __export uint32_t dns_resolv(const char *name)
 
     return ip.addr;
 }
-
-/*
- * the one should be called from ASM file
- */
-void pm_pxe_dns_resolv(com32sys_t *regs)
-{
-    const char *name = MK_PTR(regs->ds, regs->esi.w[0]);
-
-    regs->eax.l = dns_resolv(name);
-}
diff --git a/core/fs/pxe/pxe.c b/core/fs/pxe/pxe.c
index 5efcd9c..9b1a732 100644
--- a/core/fs/pxe/pxe.c
+++ b/core/fs/pxe/pxe.c
@@ -241,7 +241,7 @@ static void url_set_ip(struct url_info *url)
 {
     url->ip = 0;
     if (url->host)
-	url->ip = dns_resolv(url->host);
+	url->ip = pxe_dns(url->host);
     if (!url->ip)
 	url->ip = IPInfo.serverip;
 }
diff --git a/core/legacynet/dnsresolv.c b/core/legacynet/dnsresolv.c
index fdbe795..2b014cb 100644
--- a/core/legacynet/dnsresolv.c
+++ b/core/legacynet/dnsresolv.c
@@ -208,7 +208,7 @@ static bool parse_dotquad(const char *ip_str, uint32_t *res)
  *
  * XXX: probably need some caching here.
  */
-__export uint32_t dns_resolv(const char *name)
+__export uint32_t pxe_dns(const char *name)
 {
     static char __lowmem DNSSendBuf[PKTBUF_SIZE];
     static char __lowmem DNSRecvBuf[PKTBUF_SIZE];
diff --git a/efi/pxe.c b/efi/pxe.c
index 1b3a460..6e59109 100644
--- a/efi/pxe.c
+++ b/efi/pxe.c
@@ -35,7 +35,7 @@ int reset_pxe(void)
 #define DNS_MAX_SERVERS 4		/* Max no of DNS servers */
 uint32_t dns_server[DNS_MAX_SERVERS] = {0, };
 
-__export uint32_t dns_resolv(const char *name)
+__export uint32_t pxe_dns(const char *name)
 {
     /*
      * Return failure on an empty input... this can happen during


More information about the Syslinux-commits mailing list