mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-26 03:16:18 +00:00
dhcp: convert 'subnet_mask_given' to 'flags'
Don't waste 7 bits (in preparation for more flags)
This commit is contained in:
parent
18b1178e0c
commit
c7e1b35899
@ -673,9 +673,9 @@ dhcp_handle_ack(struct netif *netif, struct dhcp_msg *msg_in)
|
|||||||
if (dhcp_option_given(dhcp, DHCP_OPTION_IDX_SUBNET_MASK)) {
|
if (dhcp_option_given(dhcp, DHCP_OPTION_IDX_SUBNET_MASK)) {
|
||||||
/* remember given subnet mask */
|
/* remember given subnet mask */
|
||||||
ip4_addr_set_u32(&dhcp->offered_sn_mask, lwip_htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_SUBNET_MASK)));
|
ip4_addr_set_u32(&dhcp->offered_sn_mask, lwip_htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_SUBNET_MASK)));
|
||||||
dhcp->subnet_mask_given = 1;
|
dhcp->flags |= DHCP_FLAG_SUBNET_MASK_GIVEN;
|
||||||
} else {
|
} else {
|
||||||
dhcp->subnet_mask_given = 0;
|
dhcp->flags &= ~DHCP_FLAG_SUBNET_MASK_GIVEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* gateway router */
|
/* gateway router */
|
||||||
@ -1088,7 +1088,7 @@ dhcp_bind(struct netif *netif)
|
|||||||
dhcp->t1_timeout = 0;
|
dhcp->t1_timeout = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dhcp->subnet_mask_given) {
|
if (dhcp->flags & DHCP_FLAG_SUBNET_MASK_GIVEN) {
|
||||||
/* copy offered network mask */
|
/* copy offered network mask */
|
||||||
ip4_addr_copy(sn_mask, dhcp->offered_sn_mask);
|
ip4_addr_copy(sn_mask, dhcp->offered_sn_mask);
|
||||||
} else {
|
} else {
|
||||||
|
@ -62,6 +62,8 @@ extern "C" {
|
|||||||
|
|
||||||
#define DHCP_BOOT_FILE_LEN 128U
|
#define DHCP_BOOT_FILE_LEN 128U
|
||||||
|
|
||||||
|
#define DHCP_FLAG_SUBNET_MASK_GIVEN 0x01
|
||||||
|
|
||||||
/* AutoIP cooperation flags (struct dhcp.autoip_coop_state) */
|
/* AutoIP cooperation flags (struct dhcp.autoip_coop_state) */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DHCP_AUTOIP_COOP_STATE_OFF = 0,
|
DHCP_AUTOIP_COOP_STATE_OFF = 0,
|
||||||
@ -78,8 +80,8 @@ struct dhcp
|
|||||||
u8_t state;
|
u8_t state;
|
||||||
/** retries of current request */
|
/** retries of current request */
|
||||||
u8_t tries;
|
u8_t tries;
|
||||||
|
/** see DHCP_FLAG_* */
|
||||||
u8_t subnet_mask_given;
|
u8_t flags;
|
||||||
|
|
||||||
u16_t request_timeout; /* #ticks with period DHCP_FINE_TIMER_SECS for request timeout */
|
u16_t request_timeout; /* #ticks with period DHCP_FINE_TIMER_SECS for request timeout */
|
||||||
u16_t t1_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for renewal time */
|
u16_t t1_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for renewal time */
|
||||||
|
Loading…
Reference in New Issue
Block a user