139 |
static void dhcp_handle_nak(struct netif *netif) { |
static void dhcp_handle_nak(struct netif *netif) { |
140 |
struct dhcp *dhcp = netif->dhcp; |
struct dhcp *dhcp = netif->dhcp; |
141 |
u16_t msecs = 10 * 1000; |
u16_t msecs = 10 * 1000; |
142 |
DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_handle_nak()\n")); |
DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_handle_nak(netif=%p) %c%c%u\n", netif, netif->name[0], netif->name[1], netif->num)); |
143 |
dhcp->request_timeout = (msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS; |
dhcp->request_timeout = (msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS; |
144 |
DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_handle_nak(): set request timeout %u msecs\n", msecs)); |
DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_handle_nak(): set request timeout %u msecs\n", msecs)); |
145 |
dhcp_set_state(dhcp, DHCP_BACKING_OFF); |
dhcp_set_state(dhcp, DHCP_BACKING_OFF); |
157 |
struct dhcp *dhcp = netif->dhcp; |
struct dhcp *dhcp = netif->dhcp; |
158 |
err_t result; |
err_t result; |
159 |
u16_t msecs; |
u16_t msecs; |
160 |
DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_check()\n")); |
DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_check(netif=%p) %c%c\n", netif, netif->name[0], netif->name[1])); |
161 |
/* create an ARP query for the offered IP address, expecting that no host |
/* create an ARP query for the offered IP address, expecting that no host |
162 |
responds, as the IP address should not be in use. */ |
responds, as the IP address should not be in use. */ |
163 |
result = etharp_query(netif, &dhcp->offered_ip_addr, NULL); |
result = etharp_query(netif, &dhcp->offered_ip_addr, NULL); |
181 |
struct dhcp *dhcp = netif->dhcp; |
struct dhcp *dhcp = netif->dhcp; |
182 |
/* obtain the server address */ |
/* obtain the server address */ |
183 |
u8_t *option_ptr = dhcp_get_option_ptr(dhcp, DHCP_OPTION_SERVER_ID); |
u8_t *option_ptr = dhcp_get_option_ptr(dhcp, DHCP_OPTION_SERVER_ID); |
184 |
|
DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_handle_offer(netif=%p) %c%c%u\n", netif, netif->name[0], netif->name[1], netif->num)); |
185 |
if (option_ptr != NULL) |
if (option_ptr != NULL) |
186 |
{ |
{ |
187 |
dhcp->server_ip_addr.addr = htonl(dhcp_get_option_long(&option_ptr[2])); |
dhcp->server_ip_addr.addr = htonl(dhcp_get_option_long(&option_ptr[2])); |
206 |
struct dhcp *dhcp = netif->dhcp; |
struct dhcp *dhcp = netif->dhcp; |
207 |
err_t result; |
err_t result; |
208 |
u32_t msecs; |
u32_t msecs; |
209 |
DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_select()\n")); |
DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_select(netif=%p) %c%c%u\n", netif, netif->name[0], netif->name[1], netif->num)); |
210 |
|
|
211 |
/* create and initialize the DHCP message header */ |
/* create and initialize the DHCP message header */ |
212 |
result = dhcp_create_request(netif); |
result = dhcp_create_request(netif); |
716 |
{ |
{ |
717 |
struct dhcp *dhcp = netif->dhcp; |
struct dhcp *dhcp = netif->dhcp; |
718 |
struct ip_addr sn_mask, gw_addr; |
struct ip_addr sn_mask, gw_addr; |
719 |
|
DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_bind(netif=%p) %c%c%u\n", netif, netif->name[0], netif->name[1], netif->num)); |
720 |
|
|
721 |
/* temporary DHCP lease? */ |
/* temporary DHCP lease? */ |
722 |
if (dhcp->offered_t1_renew != 0xffffffffUL) { |
if (dhcp->offered_t1_renew != 0xffffffffUL) { |