Skip to content

Commit c496879

Browse files
committed
Merge branch 'feature/disable_ipv6_default' into 'master'
Disable IPv6 default See merge request sdk/ESP8266_RTOS_SDK!393
2 parents 888df39 + b1ee72b commit c496879

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

components/esp8266/include/esp_event.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
extern "C" {
2828
#endif
2929

30+
#define ESP_EVENT_IPV6 LWIP_IPV6
31+
3032
typedef enum {
3133
SYSTEM_EVENT_WIFI_READY = 0, /**< ESP8266 WiFi ready */
3234
SYSTEM_EVENT_SCAN_DONE, /**< ESP8266 finish scanning AP */

components/esp8266/source/event_default_handlers.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ static esp_err_t esp_system_event_debug(system_event_t *event)
262262
MAC2STR(ap_probereqrecved->mac));
263263
break;
264264
}
265+
#if ESP_EVENT_IPV6
265266
case SYSTEM_EVENT_GOT_IP6: {
266267
ip6_addr_t *addr = &event->event_info.got_ip6.ip6_info.ip;
267268
ESP_LOGD(TAG, "SYSTEM_EVENT_AP_STA_GOT_IP6 address %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x",
@@ -275,6 +276,7 @@ static esp_err_t esp_system_event_debug(system_event_t *event)
275276
IP6_ADDR_BLOCK8(addr));
276277
break;
277278
}
279+
#endif
278280

279281
default: {
280282
ESP_LOGW(TAG, "unexpected system event %d!", event->event_id);

components/lwip/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ endmenu # LWIP RAW API
444444

445445
menuconfig LWIP_IPV6
446446
bool "Enable IPv6"
447-
default y
447+
default n
448448

449449
config LWIP_IPV6_NUM_ADDRESSES
450450
int "Number of IPv6 addresses per netif"

components/tcpip_adapter/include/tcpip_adapter.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141
#define CONFIG_TCPIP_LWIP 1
4242
#define CONFIG_DHCP_STA_LIST 1
43+
#define TCPIP_ADAPTER_IPV6 LWIP_IPV6
4344

4445
#if CONFIG_TCPIP_LWIP
4546
#include "lwip/ip_addr.h"
@@ -73,9 +74,17 @@ typedef struct {
7374
ip4_addr_t gw;
7475
} tcpip_adapter_ip_info_t;
7576

77+
#if TCPIP_ADAPTER_IPV6
7678
typedef struct {
7779
ip6_addr_t ip;
7880
} tcpip_adapter_ip6_info_t;
81+
#else
82+
typedef struct {
83+
struct {
84+
uint32_t addr[4];
85+
} ip;
86+
} tcpip_adapter_ip6_info_t;
87+
#endif
7988

8089
typedef dhcps_lease_t tcpip_adapter_dhcps_lease_t;
8190

@@ -349,6 +358,7 @@ esp_err_t tcpip_adapter_set_old_ip_info(tcpip_adapter_if_t tcpip_if, tcpip_adapt
349358
*/
350359
esp_err_t tcpip_adapter_create_ip6_linklocal(tcpip_adapter_if_t tcpip_if);
351360

361+
#if TCPIP_ADAPTER_IPV6
352362
/**
353363
* @brief get interface's linkloacl IPv6 information
354364
*
@@ -362,6 +372,7 @@ esp_err_t tcpip_adapter_create_ip6_linklocal(tcpip_adapter_if_t tcpip_if);
362372
* ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS
363373
*/
364374
esp_err_t tcpip_adapter_get_ip6_linklocal(tcpip_adapter_if_t tcpip_if, ip6_addr_t *if_ip6);
375+
#endif
365376

366377
#if 0
367378
esp_err_t tcpip_adapter_get_mac(tcpip_adapter_if_t tcpip_if, uint8_t *mac);

components/tcpip_adapter/tcpip_adapter_lwip.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ static void tcpip_adapter_nd6_cb(struct netif *p_netif, uint8_t ip_idex)
596596
}
597597
#endif
598598

599+
#if TCPIP_ADAPTER_IPV6
599600
esp_err_t tcpip_adapter_create_ip6_linklocal(tcpip_adapter_if_t tcpip_if)
600601
{
601602
struct netif *p_netif;
@@ -632,6 +633,7 @@ esp_err_t tcpip_adapter_get_ip6_linklocal(tcpip_adapter_if_t tcpip_if, ip6_addr_
632633
}
633634
return ESP_OK;
634635
}
636+
#endif
635637

636638
esp_err_t tcpip_adapter_dhcps_option(tcpip_adapter_option_mode_t opt_op, tcpip_adapter_option_id_t opt_id, void *opt_val, uint32_t opt_len)
637639
{
@@ -766,14 +768,14 @@ esp_err_t tcpip_adapter_set_dns_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_
766768
ESP_LOGD(TAG, "set dns invalid type=%d", type);
767769
return ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS;
768770
}
769-
770-
if (ip4_addr_isany_val(dns->ip.u_addr.ip4)) {
771+
772+
if (ip4_addr_isany_val(*ip_2_ip4(&(dns->ip)))) {
771773
ESP_LOGD(TAG, "set dns invalid dns");
772774
return ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS;
773775
}
774776

775-
ESP_LOGD(TAG, "set dns if=%d type=%d dns=%x", tcpip_if, type, dns->ip.u_addr.ip4.addr);
776-
dns->ip.type = IPADDR_TYPE_V4;
777+
ESP_LOGD(TAG, "set dns if=%d type=%d dns=%x", tcpip_if, type, ip_2_ip4(&(dns->ip))->addr);
778+
IP_SET_TYPE_VAL(dns->ip, IPADDR_TYPE_V4)
777779

778780
if (tcpip_if == TCPIP_ADAPTER_IF_STA || tcpip_if == TCPIP_ADAPTER_IF_ETH) {
779781
dns_setserver(type, &(dns->ip));
@@ -812,7 +814,7 @@ esp_err_t tcpip_adapter_get_dns_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_
812814
ns = dns_getserver(type);
813815
dns->ip = *ns;
814816
} else {
815-
dns->ip.u_addr.ip4 = dhcps_dns_getserver();
817+
*ip_2_ip4(&(dns->ip)) = dhcps_dns_getserver();
816818
}
817819

818820
return ESP_OK;

0 commit comments

Comments
 (0)