examples: common connect code to ignore GOT_IP6_EVENT if comes from unrelated netif

This commit is contained in:
David Cermak 2020-03-03 13:57:32 +01:00
parent 4b59f7e2c7
commit a2c55e2c37

View file

@ -65,8 +65,12 @@ static void on_got_ip(void *arg, esp_event_base_t event_base,
static void on_got_ipv6(void *arg, esp_event_base_t event_base,
int32_t event_id, void *event_data)
{
ESP_LOGI(TAG, "Got IPv6 event!");
ip_event_got_ip6_t *event = (ip_event_got_ip6_t *)event_data;
if (event->esp_netif != s_example_esp_netif) {
ESP_LOGD(TAG, "Got IPv6 from another netif: ignored");
return;
}
ESP_LOGI(TAG, "Got IPv6 event!");
memcpy(&s_ipv6_addr, &event->ip6_info.ip, sizeof(s_ipv6_addr));
xEventGroupSetBits(s_connect_event_group, GOT_IPV6_BIT);
}