From 97530bd26972b047c912b1d0c7fc932d722a3a86 Mon Sep 17 00:00:00 2001 From: hpa Date: Tue, 28 Dec 2004 21:40:46 +0000 Subject: [PATCH] Add support for non-FQDN hostnames. --- NEWS | 1 + dnsresolv.inc | 15 +++++++++++++-- pxelinux.asm | 22 ++++++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 20bf6b3..22c0b4e 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,7 @@ Changes in 3.00: built in its own subdirectory. In particular, "mtools" is the unprivileged installer which uses mtools; "unix" is the privileged installer which uses system calls. + * SYSLINUX: Completely rewritten DOS installer in C. * ALL: "label" statement information is now stored in a compressed format, which means that a lot more labels are permitted (500-1000 in a typical configuration, but depends diff --git a/dnsresolv.inc b/dnsresolv.inc index 4364c44..d10c7d1 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 diff --git a/pxelinux.asm b/pxelinux.asm index 038680c..2b3a811 100644 --- a/pxelinux.asm +++ b/pxelinux.asm @@ -517,6 +517,12 @@ have_entrypoint: pop es ; Restore CS == DS == ES ; +; Network-specific initialization +; + xor ax,ax + mov [LocalDomain],al ; No LocalDomain received + +; ; Now attempt to get the BOOTP/DHCP packet that brought us life (and an IP ; address). This lives in the DHCPACK packet (query info 2). ; @@ -2051,6 +2057,7 @@ gendotquad: ; Gateway - default gateway router IP ; BootFile - boot file name ; DNSServers - DNS server IPs +; LocalDomain - Local domain name ; ; This assumes the DHCP packet is in "trackbuf" and the length ; of the packet in in CX on entry. @@ -2156,6 +2163,7 @@ parse_some_dhcp_options: cmp dl,6 ; DNS SERVERS option jne .not_dns pusha + mov cx,ax shr cx,2 cmp cl,DNS_MAX_SERVERS jna .oklen @@ -2168,6 +2176,20 @@ parse_some_dhcp_options: jmp .opt_done .not_dns: + cmp dl,15 ; DNS LOCAL DOMAIN option + jne .not_localdomain + pusha + mov bx,si + add bx,ax + xor ax,ax + xchg [bx],al ; Zero-terminate option + mov di,LocalDomain + call dns_mangle ; Convert to DNS label set + mov [bx],al ; Restore ending byte + popa + jmp .opt_done +.not_localdomain: + cmp dl,43 ; VENDOR ENCAPSULATED option jne .not_vendor pusha -- 2.7.4