mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-13 17:00:19 +00:00
Squash warning
This commit is contained in:
1 parent
e2ee356a87
commit
40a2a8822f
2 files changed
+9
-7
No files matched your search
+5
-4
@@ -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
|
// 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,
|
static void tx_dhcp_request_sel(struct mg_tcpip_if *ifp, uint32_t ip_req,
|
||||||
uint32_t ip_srv) {
|
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 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
|
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++ = 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++ = 50, *p++ = 4, memcpy(p, &ip_req, 4), p += 4; // Requested IP
|
||||||
*p++ = 12, *p++ = (uint8_t) (len & 255); // DHCP host
|
*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_dns) *p++ = 6; // DNS
|
||||||
if (ifp->enable_req_sntp) *p++ = 42; // SNTP
|
if (ifp->enable_req_sntp) *p++ = 42; // SNTP
|
||||||
*p++ = 255; // End of options
|
*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);
|
tx_dhcp(ifp, (uint8_t *) broadcast, 0, 0xffffffff, opts, olen, 0);
|
||||||
MG_DEBUG(("DHCP req sent"));
|
MG_DEBUG(("DHCP req sent"));
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -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
|
// 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,
|
static void tx_dhcp_request_sel(struct mg_tcpip_if *ifp, uint32_t ip_req,
|
||||||
uint32_t ip_srv) {
|
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 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
|
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++ = 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++ = 50, *p++ = 4, memcpy(p, &ip_req, 4), p += 4; // Requested IP
|
||||||
*p++ = 12, *p++ = (uint8_t) (len & 255); // DHCP host
|
*p++ = 12, *p++ = (uint8_t) (len & 255); // DHCP host
|
||||||
|
|||||||
Reference in new issue
Block a user