summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhpa <hpa>2004-12-27 07:35:58 +0000
committerhpa <hpa>2004-12-27 07:35:58 +0000
commit51f0f0dda182e9d2894fa8d1b5dae414ff47b828 (patch)
treebbf04cce71e09c604e58f6ae014b4ba469ad2820
parentb265d4af45e9f026bf00b878c74480c564420208 (diff)
downloadsyslinux-51f0f0dda182e9d2894fa8d1b5dae414ff47b828.tar.gz
Save list of DNS servers; do DNS lookup for hostnames
-rw-r--r--dnsresolv.inc8
-rw-r--r--pxelinux.asm40
2 files changed, 44 insertions, 4 deletions
diff --git a/dnsresolv.inc b/dnsresolv.inc
index 23094d98..af48b74c 100644
--- a/dnsresolv.inc
+++ b/dnsresolv.inc
@@ -28,7 +28,8 @@ DNS_MAX_SERVERS equ 4 ; Max no of DNS servers
;
; 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.
+; On return, DI points to the first byte after the label set,
+; and SI to the terminating byte.
;
; Assumes DS == ES. Change references to [bx] to [es:bx] to remove
; that assumption.
@@ -45,12 +46,15 @@ dns_mangle:
lodsb
and al,al
jz .endstring
+ cmp al,':'
+ jz .endstring
cmp al,'.'
je .isdot
inc byte [bx]
stosb
jmp .getbyte
.endstring:
+ dec si
cmp byte [bx],0
jz .done
xor al,al
@@ -117,7 +121,7 @@ dns_skiplabel:
ret
; Actual resolver function
-; Points to a null-terminated string in DS:SI
+; Points to a null-terminated or :-terminated string in DS:SI
; and returns the name in EAX if it exists and can be found.
; If EAX = 0 on exit, the lookup failed.
diff --git a/pxelinux.asm b/pxelinux.asm
index f99478e4..5dde97b0 100644
--- a/pxelinux.asm
+++ b/pxelinux.asm
@@ -1484,10 +1484,29 @@ mangle_name:
mov eax,[ServerIP]
cmp word [si],'::' ; Leading ::?
je .gotprefix
+
+.more:
+ cmp word [si],'::'
+ je .here
+ cmp byte [si],0
+ jne .more
+ jmp .noip
+
+ ; We have a :: prefix of some sort, it could be either
+ ; a DNS name or a dot-quad IP address. Try the dot-quad
+ ; first...
+.here:
+ pop si
+ push si
call parse_dotquad
- jc .noip
+ jc .notdq
cmp word [si],'::'
je .gotprefix
+.notdq:
+ call dns_resolv
+ cmp word [si],'::'
+ je .gotprefix
+
.noip:
pop si
xor eax,eax
@@ -1512,6 +1531,7 @@ mangle_name:
inc cx ; At least one null byte
xor ax,ax ; Zero-fill name
rep stosb ; Doesn't do anything if CX=0
+ pop bx
ret ; Done
;
@@ -2022,6 +2042,7 @@ gendotquad:
; Netmask - network mask
; Gateway - default gateway router IP
; BootFile - boot file name
+; DNSServers - DNS server IPs
;
; This assumes the DHCP packet is in "trackbuf" and the length
; of the packet in in CX on entry.
@@ -2107,7 +2128,7 @@ parse_some_dhcp_options:
sub cx,ax ; Decrement bytes left counter
jb .done ; Malformed option: length > field size
- cmp dl,dh ; Is the option value
+ cmp dl,dh ; Is the option value valid?
jb .opt_done
cmp dl,1 ; SUBNET MASK option
@@ -2124,6 +2145,21 @@ parse_some_dhcp_options:
jmp .opt_done
.not_router:
+ cmp dl,6 ; DNS SERVERS option
+ jne .not_dns
+ pusha
+ shr cx,2
+ cmp cl,DNS_MAX_SERVERS
+ jna .oklen
+ mov cl,DNS_MAX_SERVERS
+.oklen:
+ mov di,DNSServers
+ rep movsd
+ mov [LastDNSServer],di
+ popa
+ jmp .opt_done
+.not_dns:
+
cmp dl,43 ; VENDOR ENCAPSULATED option
jne .not_vendor
pusha