summaryrefslogtreecommitdiff
path: root/sys/src/boot
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2020-04-08 23:48:09 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2020-04-08 23:48:09 +0200
commit6041d2048c13057fcefc318345d41eef26e51149 (patch)
tree2d8c7047744b32ad98c0fa992ad10132f683edcf /sys/src/boot
parentabc5a66c566e217f8683b6a105860ad05709d541 (diff)
9bootpxe: simplify
Diffstat (limited to 'sys/src/boot')
-rw-r--r--sys/src/boot/efi/pxe.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/sys/src/boot/efi/pxe.c b/sys/src/boot/efi/pxe.c
index 8ae64272d..5c9993503 100644
--- a/sys/src/boot/efi/pxe.c
+++ b/sys/src/boot/efi/pxe.c
@@ -380,6 +380,20 @@ parsedhcp(EFI_PXE_BASE_CODE_DHCPV4_PACKET *dhcp)
}
/* DHCPv6 */
+
+ /*
+ * some UEFI implementations use random UUID based DUID instead of
+ * ethernet address, but use ethernet derived link-local addresses.
+ * so extract the MAC from our IPv6 address as a fallback.
+ */
+ p = pxe->Mode->StationIp;
+ mymac[0] = p[8] ^ 2;
+ mymac[1] = p[9];
+ mymac[2] = p[10];
+ mymac[3] = p[13];
+ mymac[4] = p[14];
+ mymac[5] = p[15];
+
e = (uchar*)dhcp + sizeof(*dhcp);
p = (uchar*)dhcp + 4;
while(p+4 <= e){
@@ -411,21 +425,6 @@ parsedhcp(EFI_PXE_BASE_CODE_DHCPV4_PACKET *dhcp)
}
p += len;
}
-
- /*
- * some UEFI implementations use random UUID based DUID instead of
- * ethernet address, but use ethernet derived link-local addresses.
- * so extract the MAC from our IPv6 address.
- */
- if((mymac[0]|mymac[1]|mymac[2]|mymac[3]|mymac[4]|mymac[5]) == 0){
- p = pxe->Mode->StationIp;
- mymac[0] = p[8] ^ 2;
- mymac[1] = p[9];
- mymac[2] = p[10];
- mymac[3] = p[13];
- mymac[4] = p[14];
- mymac[5] = p[15];
- }
}
int