Skip to content

Commit a5e03a3

Browse files
rtrbtMattiasTF
authored andcommitted
network: Remove unnecessary subnet check.
1 parent 759b1d5 commit a5e03a3

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

libraries/Network/src/NetworkInterface.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -429,20 +429,11 @@ bool NetworkInterface::config(IPAddress local_ip, IPAddress gateway, IPAddress s
429429

430430
dhcps_lease_t lease;
431431
lease.enable = true;
432-
uint8_t CIDR = calculateSubnetCIDR(subnet);
433432
log_v(
434433
"SoftAP: %s | Gateway: %s | DHCP Start: %s | Netmask: %s", local_ip.toString().c_str(), gateway.toString().c_str(), dns1.toString().c_str(),
435434
subnet.toString().c_str()
436435
);
437-
// netmask must have room for at least 12 IP addresses (AP + GW + 10 DHCP Leasing addresses)
438-
// netmask also must be limited to the last 8 bits of IPv4, otherwise this function won't work
439-
// IDF NETIF checks netmask for the 3rd byte: https://github.com/espressif/esp-idf/blob/master/components/esp_netif/lwip/esp_netif_lwip.c#L1857-L1862
440-
if (CIDR > 28 || CIDR < 24) {
441-
log_e("Bad netmask. It must be from /24 to /28 (255.255.255. 0<->240)");
442-
return false; // ESP_FAIL if initializing failed
443-
}
444436
#define _byte_swap32(num) (((num >> 24) & 0xff) | ((num << 8) & 0xff0000) | ((num >> 8) & 0xff00) | ((num << 24) & 0xff000000))
445-
// The code below is ready for any netmask, not limited to 255.255.255.0
446437
uint32_t netmask = _byte_swap32(info.netmask.addr);
447438
uint32_t ap_ipaddr = _byte_swap32(info.ip.addr);
448439
uint32_t dhcp_ipaddr = _byte_swap32(static_cast<uint32_t>(dns1));

0 commit comments

Comments
 (0)