Skip to content

Fix for IPv6 Dual Stack support #12791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2020
Merged

Fix for IPv6 Dual Stack support #12791

merged 1 commit into from
Apr 16, 2020

Conversation

cy-arsm
Copy link

@cy-arsm cy-arsm commented Apr 13, 2020

Modified LwIP mbed-os wrapper LWIPInterface.cpp to add an api remove interface which will be called as part of WhdSoftAPInterface::stop() to support sending UDP IPv6 packet is sent over link-local interface
Issue: udp_sendto() Fails for multicast IPV6 packet when interface is switched from SoftAP to STA mode.
When SoftAP start is called, add_ethernet_interface() will be called internally to add interface details into netif_list.
When switching from SoftAP to STA mode, add_ethernet_interface() will be called again to append the interace details into netif_list.
When udp_sendto() is called, ip6_route() will return interface as NULL since it consider device as single interface.

Summary of changes

LWIPInterface.cpp
LWIP::remove_ethernet_interface() api is added to remove the interface from the netif_list.

WhdSoftAPInterface.cpp
WhdSoftAPInterface::stop(), calling remove_ethernet_interface() from the network list which was added as part of WhdSoftAPInterface::start()

WhdSTAInterface.cpp
WhdSTAInterface::stop(), calling remove_ethernet_interface() from the network list which was added as part of WhdSTAInterface::start()

Impact of changes

Migration actions required

Documentation

--------------------------------------------------------------------------------------------------------------### Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


@cy-arsm
Copy link
Author

cy-arsm commented Apr 13, 2020

@morser499 can you review this changes.

@mergify mergify bot added the needs: work label Apr 13, 2020
@ciarmcom
Copy link
Member

@cy-arsm, thank you for your changes.
@ARMmbed/mbed-os-ipcore @ARMmbed/mbed-os-maintainers please review.

@ciarmcom ciarmcom requested review from a team April 13, 2020 09:00
Issue: The problem is that there is a race condition introduced in that the LWIP thread is relying on the
interface as it is taken down by a application thread while calling disconnect.
In disconnect api called from application context, whd_emac_wifi_link_state_changed() will refer to netif interface
structure in its callback api netif_link_irq(netif). This netif will be cleared by remove_etherent_interface().
whd_emac_wifi_link_state_changed will post message to tcpip_thread. tcpip_thread will process the message and
call the callback api netif_link_irq(netif)
Calling sequence is whd_emac_wifi_link_state_changed -> remove_etherent_interface(). Hence there is a timing issue
that netif might be cleared first before tcpip thread process the message netif_link_irq(netif)

Fix: remove_etherent_interface() will post message to tcpip thread and tcpip thread process the message delete_interface()
which will actually remove the inferface from the netif_list.
Calling sequence is whd_emac_wifi_link_state_changed() message post -> remove_etherent_interface() message post.
message processing order netif_link_irq(netif) -> delete_interface().
Since both the processing is handled in single thread, processing of message is handled sequentially.
@morser499
Copy link

Changes seem reasonable. Is there a GreenTea test report for the Cypress boards? I want to confirm that there are no issues in the various network related tests (tests-netsocket-,tests-network-,tests-integration-*).

@cy-arsm
Copy link
Author

cy-arsm commented Apr 14, 2020

@morser499 , Yes Greentea test's for cypress boards are available and i ran GT locally for CY8CPROTO_062_4343W.
outpt.txt
I Didnt find any Failures related to these changes.

@sathishm6
Copy link

@AnttiKauppila @0xc0170 - Can this be merged for 5.15.2 release. We need this fix for our upcoming software release.

@morser499
Copy link

@morser499 , Yes Greentea test's for cypress boards are available and i ran GT locally for CY8CPROTO_062_4343W.
outpt.txt
I Didnt find any Failures related to these changes.

This test report does not seem to include networking tests that would be impacted by this change. Do you have reports for the following suites?
tests-integration-fs-single
tests-integration-fs-threaded
tests-integration-net-single
tests-integration-net-threaded
tests-integration-stress-net-fs
tests-netsocket-dns
tests-netsocket-tcp
tests-netsocket-tls
tests-netsocket-udp
tests-network-interface
tests-network-wifi

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 15, 2020

CI started

@adbridge
Copy link
Contributor

adbridge commented Apr 15, 2020

@cy-arsm @sathishm6 @AnttiKauppila for this to even be considered for a release off 5.15 there needs to be a corresponding PR directly against that branch.....It is way past the code freeze for 5.15.2 which is literally about to be made. Checking with @andypowers and @bulislaw .

@adbridge
Copy link
Contributor

@cy-arsm @sathishm6 Having spoken to @andypowers I'm afraid this has missed 5.15.2. If you would like this considered for a future release from 5.15 please raise the PR as mentioned above.

@mbed-ci
Copy link

mbed-ci commented Apr 15, 2020

Test run: SUCCESS

Summary: 6 of 6 test jobs passed
Build number : 1
Build artifacts

@0xc0170 0xc0170 merged commit ac21ee9 into ARMmbed:master Apr 16, 2020
@mergify mergify bot removed the ready for merge label Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants