aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-03-20 16:37:17 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-03-20 16:37:17 -0700
commita84994f618684959ba15e6250c58a767666fce5f (patch)
tree23e73f1588ef010924428bb5c8b1fa83feb97e31
parent5e73a20cdc8956102744fce85f5c32bb791b0c1b (diff)
downloadsyslinux-elf-a84994f618684959ba15e6250c58a767666fce5f.tar.gz
syslinux-elf-a84994f618684959ba15e6250c58a767666fce5f.tar.xz
syslinux-elf-a84994f618684959ba15e6250c58a767666fce5f.zip
pxelinux: allow class E addresses as unicastsyslinux-3.63-pre2
Class E IPv4 addresses are expected to be reassigned as available for unicast addresses (probably for site-local use, but that is a major usage domain of PXE.)
-rw-r--r--pxelinux.asm32
1 files changed, 25 insertions, 7 deletions
diff --git a/pxelinux.asm b/pxelinux.asm
index 8bb87c26..2f08bac5 100644
--- a/pxelinux.asm
+++ b/pxelinux.asm
@@ -2039,6 +2039,27 @@ pxe_get_cached_info:
jmp kaboom
;
+; ip_ok
+;
+; Tests an IP address in EAX for validity; return with ZF=1 for bad.
+; We used to refuse class E, but class E addresses are likely to become
+; assignable unicast addresses in the near future.
+;
+ip_ok:
+ push ax
+ cmp eax,-1 ; Refuse the all-ones address
+ jz .out
+ and al,al ; Refuse network zero
+ jz .out
+ cmp al,127 ; Refuse loopback
+ jz .out
+ and al,0F0h
+ cmp al,224 ; Refuse class D
+.out:
+ pop ax
+ ret
+
+;
; parse_dhcp
;
; Parse a DHCP packet. This includes dealing with "overloaded"
@@ -2063,17 +2084,14 @@ pxe_get_cached_info:
parse_dhcp:
mov byte [OverLoad],0 ; Assume no overload
mov eax, [trackbuf+bootp.yip]
- and eax, eax
+ call ip_ok
jz .noyip
- cmp al,224 ; Class D or higher -> bad
- jae .noyip
mov [MyIP], eax
.noyip:
mov eax, [trackbuf+bootp.sip]
and eax, eax
+ call ip_ok
jz .nosip
- cmp al,224 ; Class D or higher -> bad
- jae .nosip
mov [ServerIP], eax
.nosip:
sub cx, bootp.options
@@ -2228,8 +2246,8 @@ dopt_%2:
mov eax,[si]
cmp dword [ServerIP],0
jne .skip ; Already have a next server IP
- cmp al,224 ; Class D or higher
- jae .skip
+ call ip_ok
+ jz .skip
mov [ServerIP],eax
.skip: ret