mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-25 20:02:37 +03:00
Set DHCP subnet correctly for softAP (#2648)
Removes hard coded subnet of 255.255.255.0 and fetches the correct subnet from wifi_get_ip_info()
This commit is contained in:
parent
ae13809c81
commit
cc84a64793
@ -137,21 +137,16 @@ static uint8_t* ICACHE_FLASH_ATTR add_offer_options(uint8_t *optptr)
|
|||||||
|
|
||||||
ipadd.addr = *( (uint32_t *) &server_address);
|
ipadd.addr = *( (uint32_t *) &server_address);
|
||||||
|
|
||||||
#ifdef USE_CLASS_B_NET
|
struct ip_info if_ip;
|
||||||
|
os_bzero(&if_ip, sizeof(struct ip_info));
|
||||||
|
wifi_get_ip_info(SOFTAP_IF, &if_ip);
|
||||||
|
|
||||||
*optptr++ = DHCP_OPTION_SUBNET_MASK;
|
*optptr++ = DHCP_OPTION_SUBNET_MASK;
|
||||||
*optptr++ = 4; //length
|
*optptr++ = 4;
|
||||||
*optptr++ = 255;
|
*optptr++ = ip4_addr1( &if_ip.netmask);
|
||||||
*optptr++ = 240;
|
*optptr++ = ip4_addr2( &if_ip.netmask);
|
||||||
*optptr++ = 0;
|
*optptr++ = ip4_addr3( &if_ip.netmask);
|
||||||
*optptr++ = 0;
|
*optptr++ = ip4_addr4( &if_ip.netmask);
|
||||||
#else
|
|
||||||
*optptr++ = DHCP_OPTION_SUBNET_MASK;
|
|
||||||
*optptr++ = 4;
|
|
||||||
*optptr++ = 255;
|
|
||||||
*optptr++ = 255;
|
|
||||||
*optptr++ = 255;
|
|
||||||
*optptr++ = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
*optptr++ = DHCP_OPTION_LEASE_TIME;
|
*optptr++ = DHCP_OPTION_LEASE_TIME;
|
||||||
*optptr++ = 4;
|
*optptr++ = 4;
|
||||||
@ -168,10 +163,6 @@ static uint8_t* ICACHE_FLASH_ATTR add_offer_options(uint8_t *optptr)
|
|||||||
*optptr++ = ip4_addr4( &ipadd);
|
*optptr++ = ip4_addr4( &ipadd);
|
||||||
|
|
||||||
if (dhcps_router_enabled(offer)){
|
if (dhcps_router_enabled(offer)){
|
||||||
struct ip_info if_ip;
|
|
||||||
os_bzero(&if_ip, sizeof(struct ip_info));
|
|
||||||
wifi_get_ip_info(SOFTAP_IF, &if_ip);
|
|
||||||
|
|
||||||
*optptr++ = DHCP_OPTION_ROUTER;
|
*optptr++ = DHCP_OPTION_ROUTER;
|
||||||
*optptr++ = 4;
|
*optptr++ = 4;
|
||||||
*optptr++ = ip4_addr1( &if_ip.gw);
|
*optptr++ = ip4_addr1( &if_ip.gw);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user