summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhpa <hpa>2004-12-27 00:36:14 +0000
committerhpa <hpa>2004-12-27 00:36:14 +0000
commit474aaa2918c2c100624902a495c50f03ea57571e (patch)
treec362cd6788c59a527add1f77d7160770a423c84e
parent47b58450a59ee01054b5e33df08d5b521e10137c (diff)
downloadsyslinux-474aaa2918c2c100624902a495c50f03ea57571e.tar.gz
More work on the DNS resolver
-rw-r--r--dnsresolv.inc39
1 files changed, 18 insertions, 21 deletions
diff --git a/dnsresolv.inc b/dnsresolv.inc
index a8a51921..d8d1ff0a 100644
--- a/dnsresolv.inc
+++ b/dnsresolv.inc
@@ -24,45 +24,42 @@
; Turn a string in DS:SI into a DNS "label set" in ES:DI.
; On return, DI points to the first byte after the label set.
;
+; Assumes DS == ES. Change references to [bx] to [es:bx] to remove
+; that assumption.
+;
mangle_dnsname:
push ax
- push cx
- xor cx,cx
+ push bx
+.nostart:
+.isdot:
+ xor al,al
+ mov bx,di
+ stosb
.getbyte:
- jcxz .nostart
-.gotstart:
lodsb
and al,al
jz .endstring
cmp al,'.'
je .isdot
- inc byte [es:cx]
- stosb
- jmp .getbyte
-.nostart:
- xor al,al
- mov cx,di
+ inc byte [bx]
stosb
- jmp .gotstart
-.isdot:
- xor cx,cx
jmp .getbyte
.endstring:
- mov al,[es:cx]
- and al,al
+ cmp byte [bx],0
jz .done
xor al,al
stosb
.done:
- pop cx
+ pop bx
pop ax
ret
;
-; Compare two sets of DNS labels, in DS:SI and DS:DI; the one in SI
+; Compare two sets of DNS labels, in DS:SI and ES:DI; the one in SI
; is allowed pointers relative to a packet address in BX.
;
; Assumes DS == ES. ZF = 1 if same; no registers changed.
+; (Note: change reference to [di] to [es:di] to remove DS == ES assumption)
;
dns_compare:
pusha
@@ -71,8 +68,8 @@ dns_compare:
lodsb
cmp al,0C0h
jb .noptr
- and al,03Fh
- mov ah,al
+ and al,03Fh ; Get pointer value
+ mov ah,al ; ... in network byte order!
lodsb
mov si,bx
add si,ax
@@ -101,14 +98,14 @@ dns_skiplabel:
xor ax,ax ; AH == 0
.loop:
lodsb
- cmp al,0C0h
+ cmp al,0C0h ; Pointer?
jae .ptr
and al,al
jz .done
add si,ax
jmp .loop
.ptr:
- inc si
+ inc si ; Pointer is two bytes
.done:
pop ax
ret