1017 |
u8_t *ptr; |
u8_t *ptr; |
1018 |
u16_t i; |
u16_t i; |
1019 |
u16_t j = 0; |
u16_t j = 0; |
1020 |
|
LWIP_ASSERT("dhcp->p != NULL", dhcp->p != NULL); |
1021 |
/* free any left-overs from previous unfolds */ |
/* free any left-overs from previous unfolds */ |
1022 |
dhcp_free_reply(dhcp); |
dhcp_free_reply(dhcp); |
1023 |
/* options present? */ |
/* options present? */ |
1109 |
if (reply_msg->op != DHCP_BOOTREPLY) { |
if (reply_msg->op != DHCP_BOOTREPLY) { |
1110 |
DEBUGF(DHCP_DEBUG | DBG_TRACE | 1, ("not a DHCP reply message, but type %u\n", reply_msg->op)); |
DEBUGF(DHCP_DEBUG | DBG_TRACE | 1, ("not a DHCP reply message, but type %u\n", reply_msg->op)); |
1111 |
pbuf_free(p); |
pbuf_free(p); |
1112 |
|
dhcp->reply_msg = NULL; |
1113 |
|
dhcp->p = NULL; |
1114 |
|
return; |
1115 |
} |
} |
1116 |
/* iterate through hardware address and match against DHCP message */ |
/* iterate through hardware address and match against DHCP message */ |
1117 |
for (i = 0; i < netif->hwaddr_len; i++) { |
for (i = 0; i < netif->hwaddr_len; i++) { |
1119 |
DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("netif->hwaddr[%u]==%02x != reply_msg->chaddr[%u]==%02x\n", |
DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("netif->hwaddr[%u]==%02x != reply_msg->chaddr[%u]==%02x\n", |
1120 |
i, netif->hwaddr[i], i, reply_msg->chaddr[i])); |
i, netif->hwaddr[i], i, reply_msg->chaddr[i])); |
1121 |
pbuf_free(p); |
pbuf_free(p); |
1122 |
|
dhcp->reply_msg = NULL; |
1123 |
|
dhcp->p = NULL; |
1124 |
return; |
return; |
1125 |
} |
} |
1126 |
} |
} |
1128 |
if (ntohl(reply_msg->xid) != dhcp->xid) { |
if (ntohl(reply_msg->xid) != dhcp->xid) { |
1129 |
DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("transaction id mismatch\n")); |
DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("transaction id mismatch\n")); |
1130 |
pbuf_free(p); |
pbuf_free(p); |
1131 |
|
dhcp->reply_msg = NULL; |
1132 |
|
dhcp->p = NULL; |
1133 |
return; |
return; |
1134 |
} |
} |
1135 |
/* option fields could be unfold? */ |
/* option fields could be unfold? */ |
1136 |
if (dhcp_unfold_reply(dhcp) != ERR_OK) { |
if (dhcp_unfold_reply(dhcp) != ERR_OK) { |
1137 |
DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("problem unfolding DHCP message - too short on memory?\n")); |
DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("problem unfolding DHCP message - too short on memory?\n")); |
1138 |
pbuf_free(p); |
pbuf_free(p); |
1139 |
|
dhcp->reply_msg = NULL; |
1140 |
|
dhcp->p = NULL; |
1141 |
return; |
return; |
1142 |
} |
} |
1143 |
|
|
1147 |
if (options_ptr == NULL) { |
if (options_ptr == NULL) { |
1148 |
DEBUGF(DHCP_DEBUG | DBG_TRACE | 1, ("DHCP_OPTION_MESSAGE_TYPE option not found\n")); |
DEBUGF(DHCP_DEBUG | DBG_TRACE | 1, ("DHCP_OPTION_MESSAGE_TYPE option not found\n")); |
1149 |
pbuf_free(p); |
pbuf_free(p); |
1150 |
|
dhcp->reply_msg = NULL; |
1151 |
|
dhcp->p = NULL; |
1152 |
return; |
return; |
1153 |
} |
} |
1154 |
|
|
1191 |
dhcp_handle_offer(netif); |
dhcp_handle_offer(netif); |
1192 |
} |
} |
1193 |
pbuf_free(p); |
pbuf_free(p); |
1194 |
|
dhcp->reply_msg = NULL; |
1195 |
|
dhcp->p = NULL; |
1196 |
} |
} |
1197 |
|
|
1198 |
|
|