|
@@ -65,7 +65,8 @@ static const uint8_t dhcp_op[] = {
|
65
|
65
|
|
66
|
66
|
/** Raw option data for options common to all DHCP requests */
|
67
|
67
|
static uint8_t dhcp_request_options_data[] = {
|
68
|
|
- DHCP_MAX_MESSAGE_SIZE, DHCP_WORD ( ETH_MAX_MTU ),
|
|
68
|
+ DHCP_MAX_MESSAGE_SIZE,
|
|
69
|
+ DHCP_WORD ( ETH_MAX_MTU - 20 /* IP header */ - 8 /* UDP header */ ),
|
69
|
70
|
DHCP_CLIENT_ARCHITECTURE, DHCP_WORD ( 0 ),
|
70
|
71
|
DHCP_CLIENT_NDI, DHCP_OPTION ( 1 /* UNDI */ , 2, 1 /* v2.1 */ ),
|
71
|
72
|
DHCP_VENDOR_CLASS_ID,
|
|
@@ -128,7 +129,7 @@ struct dhcp_client_uuid {
|
128
|
129
|
*/
|
129
|
130
|
static inline const char * dhcp_msgtype_name ( unsigned int msgtype ) {
|
130
|
131
|
switch ( msgtype ) {
|
131
|
|
- case 0: return "BOOTP"; /* Non-DHCP packet */
|
|
132
|
+ case DHCPNONE: return "BOOTP"; /* Non-DHCP packet */
|
132
|
133
|
case DHCPDISCOVER: return "DHCPDISCOVER";
|
133
|
134
|
case DHCPOFFER: return "DHCPOFFER";
|
134
|
135
|
case DHCPREQUEST: return "DHCPREQUEST";
|
|
@@ -685,7 +686,7 @@ static void dhcp_store_dhcpoffer ( struct dhcp_session *dhcp,
|
685
|
686
|
*/
|
686
|
687
|
static void dhcp_rx_dhcpoffer ( struct dhcp_session *dhcp,
|
687
|
688
|
struct dhcp_settings *dhcpoffer ) {
|
688
|
|
- struct in_addr server_id;
|
|
689
|
+ struct in_addr server_id = { 0 };
|
689
|
690
|
char vci[9]; /* "PXEClient" */
|
690
|
691
|
int len;
|
691
|
692
|
uint8_t ignore_proxy = 0;
|
|
@@ -697,7 +698,7 @@ static void dhcp_rx_dhcpoffer ( struct dhcp_session *dhcp,
|
697
|
698
|
!= sizeof ( server_id ) ) {
|
698
|
699
|
DBGC ( dhcp, "DHCP %p received DHCPOFFER %p missing server "
|
699
|
700
|
"identifier\n", dhcp, dhcpoffer );
|
700
|
|
- return;
|
|
701
|
+ /* Could be a valid BOOTP offer; do not abort processing */
|
701
|
702
|
}
|
702
|
703
|
|
703
|
704
|
/* If there is an IP address, it's a normal DHCPOFFER */
|
|
@@ -714,7 +715,8 @@ static void dhcp_rx_dhcpoffer ( struct dhcp_session *dhcp,
|
714
|
715
|
*/
|
715
|
716
|
len = dhcppkt_fetch ( &dhcpoffer->dhcppkt, DHCP_VENDOR_CLASS_ID,
|
716
|
717
|
vci, sizeof ( vci ) );
|
717
|
|
- if ( ( len >= ( int ) sizeof ( vci ) ) &&
|
|
718
|
+ if ( ( server_id.s_addr != 0 ) &&
|
|
719
|
+ ( len >= ( int ) sizeof ( vci ) ) &&
|
718
|
720
|
( strncmp ( "PXEClient", vci, sizeof ( vci ) ) == 0 ) ) {
|
719
|
721
|
DBGC ( dhcp, "DHCP %p received DHCPOFFER %p from %s is a "
|
720
|
722
|
"ProxyDHCPOFFER\n",
|
|
@@ -924,12 +926,12 @@ static int dhcp_deliver_iob ( struct xfer_interface *xfer,
|
924
|
926
|
/* Handle packet based on current state */
|
925
|
927
|
switch ( dhcp->state ) {
|
926
|
928
|
case DHCP_STATE_DISCOVER:
|
927
|
|
- if ( ( msgtype == DHCPOFFER ) &&
|
|
929
|
+ if ( ( ( msgtype == DHCPOFFER ) || ( msgtype == DHCPNONE ) ) &&
|
928
|
930
|
( src_port == htons ( BOOTPS_PORT ) ) )
|
929
|
931
|
dhcp_rx_dhcpoffer ( dhcp, dhcpset );
|
930
|
932
|
break;
|
931
|
933
|
case DHCP_STATE_REQUEST:
|
932
|
|
- if ( ( msgtype == DHCPACK ) &&
|
|
934
|
+ if ( ( ( msgtype == DHCPACK ) || ( msgtype == DHCPNONE ) ) &&
|
933
|
935
|
( src_port == htons ( BOOTPS_PORT ) ) )
|
934
|
936
|
dhcp_rx_dhcpack ( dhcp, dhcpset );
|
935
|
937
|
break;
|