Squash warning

This commit is contained in:
Sergey Lyubka
2025-03-29 18:59:01 +00:00
parent e2ee356a87
commit 40a2a8822f
2 changed files with 9 additions and 7 deletions
+5 -4
View File
@@ -4361,11 +4361,12 @@ static const uint8_t broadcast[] = {255, 255, 255, 255, 255, 255};
// RFC-2131 #4.3.6, #4.4.1; RFC-2132 #9.8
static void tx_dhcp_request_sel(struct mg_tcpip_if *ifp, uint32_t ip_req,
uint32_t ip_srv) {
uint8_t extra = (ifp->enable_req_dns ? 1 : 0) + (ifp->enable_req_sntp ? 1 : 0);
uint8_t extra = (uint8_t) ((ifp->enable_req_dns ? 1 : 0) +
(ifp->enable_req_sntp ? 1 : 0));
size_t len = strlen(ifp->dhcp_name);
size_t olen = 21 + len + extra + 2 + 1; // Total length of options
size_t olen = 21 + len + extra + 2 + 1; // Total length of options
uint8_t *opts = alloca(olen), *p = opts; // Allocate options
*p++ = 53, *p++ = 1, *p++ = 3; // Type: DHCP request
*p++ = 53, *p++ = 1, *p++ = 3; // Type: DHCP request
*p++ = 54, *p++ = 4, memcpy(p, &ip_srv, 4), p += 4; // DHCP server ID
*p++ = 50, *p++ = 4, memcpy(p, &ip_req, 4), p += 4; // Requested IP
*p++ = 12, *p++ = (uint8_t) (len & 255); // DHCP host
@@ -4374,7 +4375,7 @@ static void tx_dhcp_request_sel(struct mg_tcpip_if *ifp, uint32_t ip_req,
if (ifp->enable_req_dns) *p++ = 6; // DNS
if (ifp->enable_req_sntp) *p++ = 42; // SNTP
*p++ = 255; // End of options
assert((size_t) (p - opts) < olen);
// assert((size_t) (p - opts) < olen);
tx_dhcp(ifp, (uint8_t *) broadcast, 0, 0xffffffff, opts, olen, 0);
MG_DEBUG(("DHCP req sent"));
}
+4 -3
View File
@@ -280,11 +280,12 @@ static const uint8_t broadcast[] = {255, 255, 255, 255, 255, 255};
// RFC-2131 #4.3.6, #4.4.1; RFC-2132 #9.8
static void tx_dhcp_request_sel(struct mg_tcpip_if *ifp, uint32_t ip_req,
uint32_t ip_srv) {
uint8_t extra = (ifp->enable_req_dns ? 1 : 0) + (ifp->enable_req_sntp ? 1 : 0);
uint8_t extra = (uint8_t) ((ifp->enable_req_dns ? 1 : 0) +
(ifp->enable_req_sntp ? 1 : 0));
size_t len = strlen(ifp->dhcp_name);
size_t olen = 21 + len + extra + 2 + 1; // Total length of options
size_t olen = 21 + len + extra + 2 + 1; // Total length of options
uint8_t *opts = alloca(olen), *p = opts; // Allocate options
*p++ = 53, *p++ = 1, *p++ = 3; // Type: DHCP request
*p++ = 53, *p++ = 1, *p++ = 3; // Type: DHCP request
*p++ = 54, *p++ = 4, memcpy(p, &ip_srv, 4), p += 4; // DHCP server ID
*p++ = 50, *p++ = 4, memcpy(p, &ip_req, 4), p += 4; // Requested IP
*p++ = 12, *p++ = (uint8_t) (len & 255); // DHCP host