From aeb62038119f1988b06fa6a55a74d3db65c64d79 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 4 Jul 2016 15:07:05 +0100 Subject: [dhcp] Automatically generate vendor class identifier string The vendor class identifier strings in DHCP_ARCH_VENDOR_CLASS_ID are out of sync with the (correct) client architecture values in DHCP_ARCH_CLIENT_ARCHITECTURE. Fix by removing all definitions of DHCP_ARCH_VENDOR_CLASS_ID, and instead generating the vendor class identifier string automatically based on DHCP_ARCH_CLIENT_ARCHITECTURE and DHCP_ARCH_CLIENT_NDI. Signed-off-by: Michael Brown --- src/include/ipxe/dhcp.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/include/ipxe') diff --git a/src/include/ipxe/dhcp.h b/src/include/ipxe/dhcp.h index 693aa7e73..b699b31f0 100644 --- a/src/include/ipxe/dhcp.h +++ b/src/include/ipxe/dhcp.h @@ -210,6 +210,29 @@ struct dhcp_pxe_boot_menu_item { /** Vendor class identifier */ #define DHCP_VENDOR_CLASS_ID 60 +/** Vendor class identifier for PXE clients */ +#define DHCP_VENDOR_PXECLIENT( arch, ndi ) \ + 'P', 'X', 'E', 'C', 'l', 'i', 'e', 'n', 't', ':', \ + 'A', 'r', 'c', 'h', ':', DHCP_VENDOR_PXECLIENT_ARCH ( arch ), \ + ':', 'U', 'N', 'D', 'I', ':', DHCP_VENDOR_PXECLIENT_UNDI ( ndi ) + +/** Vendor class identifier architecture for PXE clients */ +#define DHCP_VENDOR_PXECLIENT_ARCH( arch ) \ + ( '0' + ( ( (arch) / 10000 ) % 10 ) ), \ + ( '0' + ( ( (arch) / 1000 ) % 10 ) ), \ + ( '0' + ( ( (arch) / 100 ) % 10 ) ), \ + ( '0' + ( ( (arch) / 10 ) % 10 ) ), \ + ( '0' + ( ( (arch) / 1 ) % 10 ) ) + +/** Vendor class identifier UNDI version for PXE clients */ +#define DHCP_VENDOR_PXECLIENT_UNDI( type, major, minor ) \ + DHCP_VENDOR_PXECLIENT_UNDI_VERSION ( major ), \ + DHCP_VENDOR_PXECLIENT_UNDI_VERSION ( minor ) +#define DHCP_VENDOR_PXECLIENT_UNDI_VERSION( version ) \ + ( '0' + ( ( (version) / 100 ) % 10 ) ), \ + ( '0' + ( ( (version) / 10 ) % 10 ) ), \ + ( '0' + ( ( (version) / 1 ) % 10 ) ) + /** Client identifier */ #define DHCP_CLIENT_ID 61 -- cgit v1.2.3-55-g7522