Don't parse broadcast option, we don't use it anyway (made up from ipaddr and netmask), layout change of struct dhcp

This commit is contained in:
goldsimon 2010-01-31 18:59:37 +00:00
parent 8cb3ea1398
commit 72d6f1a418
2 changed files with 7 additions and 18 deletions

View File

@ -115,8 +115,7 @@
#define DHCP_OPTION_IDX_T2 5 #define DHCP_OPTION_IDX_T2 5
#define DHCP_OPTION_IDX_SUBNET_MASK 6 #define DHCP_OPTION_IDX_SUBNET_MASK 6
#define DHCP_OPTION_IDX_ROUTER 7 #define DHCP_OPTION_IDX_ROUTER 7
#define DHCP_OPTION_IDX_BROADCAST 8 #define DHCP_OPTION_IDX_DNS_SERVER 8
#define DHCP_OPTION_IDX_DNS_SERVER 9
#define DHCP_OPTION_IDX_MAX (DHCP_OPTION_IDX_DNS_SERVER + DNS_MAX_SERVERS) #define DHCP_OPTION_IDX_MAX (DHCP_OPTION_IDX_DNS_SERVER + DNS_MAX_SERVERS)
/** Holds the decoded option values, only valid while in dhcp_recv. /** Holds the decoded option values, only valid while in dhcp_recv.
@ -501,7 +500,6 @@ dhcp_handle_ack(struct netif *netif)
/* clear options we might not get from the ACK */ /* clear options we might not get from the ACK */
dhcp->offered_sn_mask.addr = 0; dhcp->offered_sn_mask.addr = 0;
dhcp->offered_gw_addr.addr = 0; dhcp->offered_gw_addr.addr = 0;
dhcp->offered_bc_addr.addr = 0;
#if LWIP_DHCP_BOOTP_FILE #if LWIP_DHCP_BOOTP_FILE
dhcp->offered_si_addr.addr = 0; dhcp->offered_si_addr.addr = 0;
#endif /* LWIP_DHCP_BOOTP_FILE */ #endif /* LWIP_DHCP_BOOTP_FILE */
@ -548,11 +546,6 @@ dhcp_handle_ack(struct netif *netif)
if (dhcp_option_given(dhcp, DHCP_OPTION_IDX_ROUTER)) { if (dhcp_option_given(dhcp, DHCP_OPTION_IDX_ROUTER)) {
dhcp->offered_gw_addr.addr = htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_ROUTER)); dhcp->offered_gw_addr.addr = htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_ROUTER));
} }
/* broadcast address */
if (dhcp_option_given(dhcp, DHCP_OPTION_IDX_BROADCAST)) {
dhcp->offered_bc_addr.addr = htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_BROADCAST));
}
#if LWIP_DNS #if LWIP_DNS
/* DNS servers */ /* DNS servers */
@ -1160,8 +1153,9 @@ dhcp_release(struct netif *netif)
dhcp_set_state(dhcp, DHCP_OFF); dhcp_set_state(dhcp, DHCP_OFF);
/* clean old DHCP offer */ /* clean old DHCP offer */
dhcp->server_ip_addr.addr = 0; dhcp->server_ip_addr.addr = 0;
dhcp->offered_ip_addr.addr = dhcp->offered_sn_mask.addr = 0; dhcp->offered_ip_addr.addr = 0;
dhcp->offered_gw_addr.addr = dhcp->offered_bc_addr.addr = 0; dhcp->offered_sn_mask.addr = 0;
dhcp->offered_gw_addr.addr = 0;
#if LWIP_DHCP_BOOTP_FILE #if LWIP_DHCP_BOOTP_FILE
dhcp->offered_si_addr.addr = 0; dhcp->offered_si_addr.addr = 0;
#endif /* LWIP_DHCP_BOOTP_FILE */ #endif /* LWIP_DHCP_BOOTP_FILE */
@ -1377,10 +1371,6 @@ again:
LWIP_ASSERT("len >= decode_len", len >= decode_len); LWIP_ASSERT("len >= decode_len", len >= decode_len);
decode_idx = DHCP_OPTION_IDX_DNS_SERVER; decode_idx = DHCP_OPTION_IDX_DNS_SERVER;
break; break;
case(DHCP_OPTION_BROADCAST):
LWIP_ASSERT("len == 4", len == 4);
decode_idx = DHCP_OPTION_IDX_BROADCAST;
break;
case(DHCP_OPTION_LEASE_TIME): case(DHCP_OPTION_LEASE_TIME):
LWIP_ASSERT("len == 4", len == 4); LWIP_ASSERT("len == 4", len == 4);
decode_idx = DHCP_OPTION_IDX_LEASE_TIME; decode_idx = DHCP_OPTION_IDX_LEASE_TIME;

View File

@ -38,6 +38,9 @@ struct dhcp
u8_t state; u8_t state;
/** retries of current request */ /** retries of current request */
u8_t tries; u8_t tries;
#if LWIP_DHCP_AUTOIP_COOP
u8_t autoip_coop_state;
#endif
struct pbuf *p_out; /* pbuf of outcoming msg */ struct pbuf *p_out; /* pbuf of outcoming msg */
struct dhcp_msg *msg_out; /* outgoing msg */ struct dhcp_msg *msg_out; /* outgoing msg */
@ -49,14 +52,10 @@ struct dhcp
struct ip_addr offered_ip_addr; struct ip_addr offered_ip_addr;
struct ip_addr offered_sn_mask; struct ip_addr offered_sn_mask;
struct ip_addr offered_gw_addr; struct ip_addr offered_gw_addr;
struct ip_addr offered_bc_addr;
u32_t offered_t0_lease; /* lease period (in seconds) */ u32_t offered_t0_lease; /* lease period (in seconds) */
u32_t offered_t1_renew; /* recommended renew time (usually 50% of lease period) */ u32_t offered_t1_renew; /* recommended renew time (usually 50% of lease period) */
u32_t offered_t2_rebind; /* recommended rebind time (usually 66% of lease period) */ u32_t offered_t2_rebind; /* recommended rebind time (usually 66% of lease period) */
#if LWIP_DHCP_AUTOIP_COOP
u8_t autoip_coop_state;
#endif
/* @todo: LWIP_DHCP_BOOTP_FILE configuration option? /* @todo: LWIP_DHCP_BOOTP_FILE configuration option?
integrate with possible TFTP-client for booting? */ integrate with possible TFTP-client for booting? */
#if LWIP_DHCP_BOOTP_FILE #if LWIP_DHCP_BOOTP_FILE