dhcp: convert 'subnet_mask_given' to 'flags'

Don't waste 7 bits (in preparation for more flags)
This commit is contained in:
Simon Goldschmidt
2021-03-04 22:16:19 +01:00
parent 18b1178e0c
commit c7e1b35899
2 changed files with 7 additions and 5 deletions

View File

@@ -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)) {
/* remember given 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 {
dhcp->subnet_mask_given = 0;
dhcp->flags &= ~DHCP_FLAG_SUBNET_MASK_GIVEN;
}
/* gateway router */
@@ -1088,7 +1088,7 @@ dhcp_bind(struct netif *netif)
dhcp->t1_timeout = 0;
}
if (dhcp->subnet_mask_given) {
if (dhcp->flags & DHCP_FLAG_SUBNET_MASK_GIVEN) {
/* copy offered network mask */
ip4_addr_copy(sn_mask, dhcp->offered_sn_mask);
} else {