Validates that a packet is a DHCP packet.
DWORD PXEAPI PxeDhcpIsValid( _In_ PVOID pPacket, _In_ ULONG uPacketLen, _In_ BOOL bRequestPacket, _Out_ PBOOL pbPxeOptionPresent );
- pPacket [in]
Pointer to a reply packet allocated with the PxePacketAllocate function.
- uPacketLen [in]
Length of the packet pointed to by the pPacket parameter.
- bRequestPacket [in]
Indicates whether the packet is a request packet. The following table lists the possible values.
Packet to be validated is a request packet from the client.
Packet to be validated is a packet generated by the server.
- pbPxeOptionPresent [out]
Address of a BOOL that is set to TRUE if the packet is a valid DHCP packet that contains the Vendor Class Identifier option (60) with the value set to "PXEClient".
If the function succeeds, the return value is ERROR_SUCCESS.
Providers use this function when the filter set with the PxeProviderSetAttribute function is set to receive all packets to determine if a specified packet is a valid DHCP packet. Providers can also use this function to validate reply packets; typically this is done only for debug or test builds of the provider.
The validation tests include the following tests.
|DHCP field||Initialized value|
|Operation (op)||If the bClientRequest parameter is TRUE, this field must be 1 (BOOTP Request), otherwise this field must be 2 (BOOTP Reply).|
|Hardware Address Length (hlen)||Must be less than or equal to 16.|
|Host Name (sname)||Must be NULL terminated.|
|Boot file name (file)||Must be NULL terminated.|
|Magic Cookie (first 4 octets of vend)||Must contain valid DHCP Magic Cookie (99 130 83 99).|
|Option Length||All options must have a valid length and do not overrun the packet.|
|DHCP Message Type (53)||Must be present.|
|End Option (255)||Packet must end with DHCP End Option. Due to minimum packet lengths, the packet may be larger but no options may follow the End Option.|
Minimum supported client
Minimum supported server
|Windows Server 2008, Windows Server 2003 with SP2 [desktop apps only]|