Added support for using TCPIP_ADAPTER_IF_MAX to join igmp groups on all (#2279)

interfaces
This commit is contained in:
Shelby Merrick 2019-01-06 14:29:38 -05:00 committed by Me No Dev
parent 812d131663
commit a6e3b29004

View File

@ -561,26 +561,48 @@ static esp_err_t joinMulticastGroup(const ip_addr_t *addr, bool join, tcpip_adap
return ESP_ERR_INVALID_ARG; return ESP_ERR_INVALID_ARG;
} }
netif = (struct netif *)nif; netif = (struct netif *)nif;
}
if (addr->type == IPADDR_TYPE_V4) { if (addr->type == IPADDR_TYPE_V4) {
if(join){ if(join){
if (igmp_joingroup_netif(netif, (const ip4_addr *)&(addr->u_addr.ip4))) { if (igmp_joingroup_netif(netif, (const ip4_addr *)&(addr->u_addr.ip4))) {
return ESP_ERR_INVALID_STATE; return ESP_ERR_INVALID_STATE;
}
} else {
if (igmp_leavegroup_netif(netif, (const ip4_addr *)&(addr->u_addr.ip4))) {
return ESP_ERR_INVALID_STATE;
}
} }
} else { } else {
if (igmp_leavegroup_netif(netif, (const ip4_addr *)&(addr->u_addr.ip4))) { if(join){
return ESP_ERR_INVALID_STATE; if (mld6_joingroup_netif(netif, &(addr->u_addr.ip6))) {
return ESP_ERR_INVALID_STATE;
}
} else {
if (mld6_leavegroup_netif(netif, &(addr->u_addr.ip6))) {
return ESP_ERR_INVALID_STATE;
}
} }
} }
} else { } else {
if(join){ if (addr->type == IPADDR_TYPE_V4) {
if (mld6_joingroup_netif(netif, &(addr->u_addr.ip6))) { if(join){
return ESP_ERR_INVALID_STATE; if (igmp_joingroup((const ip4_addr *)IP4_ADDR_ANY, (const ip4_addr *)&(addr->u_addr.ip4))) {
return ESP_ERR_INVALID_STATE;
}
} else {
if (igmp_leavegroup((const ip4_addr *)IP4_ADDR_ANY, (const ip4_addr *)&(addr->u_addr.ip4))) {
return ESP_ERR_INVALID_STATE;
}
} }
} else { } else {
if (mld6_leavegroup_netif(netif, &(addr->u_addr.ip6))) { if(join){
return ESP_ERR_INVALID_STATE; if (mld6_joingroup((const ip6_addr *)IP6_ADDR_ANY, &(addr->u_addr.ip6))) {
return ESP_ERR_INVALID_STATE;
}
} else {
if (mld6_leavegroup((const ip6_addr *)IP6_ADDR_ANY, &(addr->u_addr.ip6))) {
return ESP_ERR_INVALID_STATE;
}
} }
} }
} }