From b276b20eebea84bdf991d07da1bdff4c23b430c8 Mon Sep 17 00:00:00 2001 From: hpa Date: Tue, 28 Dec 2004 23:35:39 +0000 Subject: [PATCH] Document resolve hostname API --- comboot.doc | 27 +++++++++++++++++++++++++++ comboot.inc | 15 +++++++++++++++ dnsresolv.inc | 4 ++-- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/comboot.doc b/comboot.doc index a324cfc..62b17db 100644 --- a/comboot.doc +++ b/comboot.doc @@ -344,6 +344,13 @@ AX=0009h [2.00] Call PXE Stack [PXELINUX ONLY] the status code in AX and in the first word of the data buffer to determine if the PXE call succeeded or not. + The PXE stack will have the UDP stack OPEN; if you change that + you cannot call any of the file-related API functions, and + must restore UDP OPEN before returning to PXELINUX. + + PXELINUX reserves UDP port numbers from 49152 to 65535 for its + own use; port numbers below that range is available. + AX=000Ah [2.00] Get Derivative-Specific Information @@ -486,6 +493,7 @@ AX=000Eh [2.11] Get configuration file name Returns the name of the configuration file. Note that it is possible that the configuration file doesn't actually exist. + AX=000Fh [3.00] Get IPAPPEND strings [PXELINUX] Input: AX 000Fh Output: CX Number of strings (currently 2) @@ -497,3 +505,22 @@ AX=000Fh [3.00] Get IPAPPEND strings [PXELINUX] added to the command line, one for each bit of the "ipappend" flag value, so entry 0 is the "ip=" string and entry 1 is the "BOOTIF=" string. + + +AX=0010h [3.00] Resolve hostname [PXELINUX] + Input: ES:BX Pointer to null-terminated hostname + Output: EAX IP address of hostname (zero if not found) + + Queries the DNS server(s) for a specific hostname. If the + hostname does not contain a dot (.), the local domain name + is automatically appended. + + This function only return CF=1 if the function is not + supported. If the function is supported, but the hostname did + not resolve, it returns with CF=0, EAX=0. + + The IP address is returned in network byte order, i.e. if the + IP address is 1.2.3.4, EAX will contain 0x04030201. Note that + all uses of IP addresses in PXE are also in network byte order. + + diff --git a/comboot.inc b/comboot.inc index 45233a8..3859998 100644 --- a/comboot.inc +++ b/comboot.inc @@ -579,6 +579,20 @@ numIPAppends equ ($-IPAppends)/2 %else comapi_ipappend equ comapi_err %endif + +; +; INT 22h AX=0010h Resolve hostname +; +%if IS_PXELINUX +comapi_dnsresolv: + mov ds,P_ES + mov si,P_BX + call dns_resolv + mov P_EAX,eax + ret +%else +comapi_dnsresolv equ comapi_err +%endif section .data %macro int21 2 @@ -617,6 +631,7 @@ int22_table: dw comapi_chainboot ; 000D clean up then bootstrap dw comapi_configfile ; 000E get name of config file dw comapi_ipappend ; 000F get ipappend strings + dw comapi_dnsresolv ; 0010 resolve hostname int22_count equ ($-int22_table)/2 APIKeyWait db 0 diff --git a/dnsresolv.inc b/dnsresolv.inc index d10c7d1..3181c0d 100644 --- a/dnsresolv.inc +++ b/dnsresolv.inc @@ -20,8 +20,8 @@ DNS_PORT equ htons(53) ; Default DNS port DNS_MAX_PACKET equ 512 ; Defined by protocol -; TFTP uses the range 49152-57343; avoid that range -DNS_LOCAL_PORT equ htons(35000) ; All local DNS queries come from this port # +; TFTP uses the range 49152-57343 +DNS_LOCAL_PORT equ htons(60053) ; All local DNS queries come from this port # DNS_MAX_SERVERS equ 4 ; Max no of DNS servers section .text -- 2.7.4