summaryrefslogtreecommitdiff
path: root/dnsresolv.inc
diff options
context:
space:
mode:
authorhpa <hpa>2004-12-28 21:40:46 +0000
committerhpa <hpa>2004-12-28 21:40:46 +0000
commit97530bd26972b047c912b1d0c7fc932d722a3a86 (patch)
treea5f2168e59e2285aca2d847a1b9a7b254550b379 /dnsresolv.inc
parent009113a81bb4e219033665557283027c68f9565a (diff)
downloadsyslinux-97530bd26972b047c912b1d0c7fc932d722a3a86.tar.gz
Add support for non-FQDN hostnames.
Diffstat (limited to 'dnsresolv.inc')
-rw-r--r--dnsresolv.inc15
1 files changed, 13 insertions, 2 deletions
diff --git a/dnsresolv.inc b/dnsresolv.inc
index 4364c449..d10c7d1d 100644
--- a/dnsresolv.inc
+++ b/dnsresolv.inc
@@ -34,11 +34,14 @@ DNS_MAX_SERVERS equ 4 ; Max no of DNS servers
; Assumes DS == ES. Change references to [bx] to [es:bx] to remove
; that assumption.
;
+; On return, DX contains the number of dots encountered.
+;
dns_mangle:
push ax
push bx
-.nostart:
+ xor dx,dx
.isdot:
+ inc dx
xor al,al
mov bx,di
stosb
@@ -55,6 +58,7 @@ dns_mangle:
jmp .getbyte
.endstring:
dec si
+ dec dx ; We always counted one high
cmp byte [bx],0
jz .done
xor al,al
@@ -158,6 +162,7 @@ dns_skiplabel:
alignb 2, db 0
DNSSendBuf resb DNS_MAX_PACKET
DNSRecvBuf resb DNS_MAX_PACKET
+LocalDomain resb 256 ; Max possible length
DNSServers resd DNS_MAX_SERVERS
section .data
@@ -204,9 +209,15 @@ dns_resolv:
stosw
call dns_mangle ; Convert name to DNS labels
-
push si ; Save pointer to after DNS string
+ and dx,dx
+ jnz .fqdn ; If we have dots, assume it's FQDN
+ dec di ; Remove final null
+ mov si,LocalDomain
+ call strcpy ; Uncompressed DNS label set so it ends in null
+.fqdn:
+
mov ax,htons(1)
stosw ; QTYPE = 1 = A
stosw ; QCLASS = 1 = IN