mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #12312 from cy-arsm/cy-arsm/pr/ipv6-fix-SoftAPmode
Fix to sending IPV6 UPD packet fails IPv6 enabled in SoftAP intfpull/12472/head
commit
8b829e5c41
|
@ -508,6 +508,41 @@ nsapi_error_t LWIP::add_ethernet_interface(EMAC &emac, bool default_if, OnboardN
|
|||
#endif //LWIP_ETHERNET
|
||||
}
|
||||
|
||||
nsapi_error_t LWIP::remove_ethernet_interface(OnboardNetworkStack::Interface **interface_out)
|
||||
{
|
||||
#if LWIP_ETHERNET
|
||||
|
||||
if ((interface_out != NULL) && (*interface_out != NULL)) {
|
||||
|
||||
Interface *lwip = static_cast<Interface *>(*interface_out);
|
||||
Interface *node = lwip->list;
|
||||
|
||||
if (lwip->list != NULL) {
|
||||
if (lwip->list == lwip) {
|
||||
lwip->list = lwip->list->next;
|
||||
netif_remove(&node->netif);
|
||||
*interface_out = NULL;
|
||||
delete node;
|
||||
} else {
|
||||
while (node->next != NULL && node->next != lwip) {
|
||||
node = node->next;
|
||||
}
|
||||
if (node->next != NULL && node->next == lwip) {
|
||||
Interface *remove = node->next;
|
||||
node->next = node->next->next;
|
||||
netif_remove(&remove->netif);
|
||||
*interface_out = NULL;
|
||||
delete remove;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NSAPI_ERROR_OK;
|
||||
#else
|
||||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
#endif //LWIP_ETHERNET
|
||||
}
|
||||
|
||||
nsapi_error_t LWIP::add_l3ip_interface(L3IP &l3ip, bool default_if, OnboardNetworkStack::Interface **interface_out)
|
||||
{
|
||||
|
|
|
@ -276,6 +276,14 @@ public:
|
|||
* @param[out] interface_out pointer to stack interface object controlling the L3IP
|
||||
* @return NSAPI_ERROR_OK on success, or error code
|
||||
*/
|
||||
virtual nsapi_error_t remove_ethernet_interface(OnboardNetworkStack::Interface **interface_out);
|
||||
|
||||
/** Remove a network interface from IP stack
|
||||
*
|
||||
* Removes PPP objects,network interface from stack list, and shutdown device driver.
|
||||
* @param[out] interface_out pointer to stack interface object controlling the PPP
|
||||
* @return NSAPI_ERROR_OK on success, or error code
|
||||
*/
|
||||
virtual nsapi_error_t remove_l3ip_interface(OnboardNetworkStack::Interface **interface_out);
|
||||
|
||||
/** Remove a network interface from IP stack
|
||||
|
|
|
@ -157,6 +157,11 @@ public:
|
|||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
};
|
||||
|
||||
virtual nsapi_error_t remove_ethernet_interface(Interface **interface_out)
|
||||
{
|
||||
return NSAPI_ERROR_OK;
|
||||
};
|
||||
|
||||
virtual nsapi_error_t remove_l3ip_interface(Interface **interface_out)
|
||||
{
|
||||
return NSAPI_ERROR_OK;
|
||||
|
|
|
@ -355,6 +355,15 @@ nsapi_error_t WhdSTAInterface::disconnect()
|
|||
}
|
||||
whd_emac_wifi_link_state_changed(_whd_emac.ifp, WHD_FALSE);
|
||||
|
||||
// remove the interface added in connect
|
||||
if (_interface) {
|
||||
nsapi_error_t err = _stack.remove_ethernet_interface(&_interface);
|
||||
if (err != NSAPI_ERROR_OK) {
|
||||
return err;
|
||||
}
|
||||
_iface_shared.iface_sta = NULL;
|
||||
}
|
||||
|
||||
res = whd_wifi_deregister_event_handler(_whd_emac.ifp, sta_link_update_entry);
|
||||
if (res != WHD_SUCCESS) {
|
||||
return whd_toerror(res);
|
||||
|
|
|
@ -201,6 +201,16 @@ int WhdSoftAPInterface::stop(void)
|
|||
if (res != WHD_SUCCESS) {
|
||||
return whd_toerror(res);
|
||||
}
|
||||
|
||||
// remove the interface added in start
|
||||
if (_interface) {
|
||||
nsapi_error_t err = _stack.remove_ethernet_interface(&_interface);
|
||||
if (err != NSAPI_ERROR_OK) {
|
||||
return err;
|
||||
}
|
||||
_iface_shared.iface_softap = NULL;
|
||||
}
|
||||
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue