-
Notifications
You must be signed in to change notification settings - Fork 3k
Lwip 2.0 #2767
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
Lwip 2.0 #2767
Conversation
cc @bulislaw @sg- @geky @kjbracey-arm @mikaleppanen Can you share any tests run for this patch? how many targets were tested? |
/morph test-nightly |
Testing so far has been limited to one particular end-to-end system test - we have got mbed-client-example to register with the device server using both IPv4 and IPv6 on K64F hardware, using UDP. More directed targeted IP testing and testing on other platforms is required. The other platforms' drivers are compile-tested only. |
Note that the LWIP code that is being added is from the reference repository fork here: https://github.com/ARMmbed/lwip coming from the branch "mbed-os-prefixed", based on STABLE-2.0.0-rc2, with 2 bug fixes cherry-picked from master. |
Result: FAILUREYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 909 Build failed! |
@kjbracey-arm and @mikaleppanen, you should have access to the CI report by following the bot's posted link. But here's a quick summary of one of the build failures for the RZ_A1H when built with ARM Compiler 5:
EDIT: for further convenience, here's a direct link to the build matrix: http://10.118.12.43:8081/job/build_matrix/547/ |
Corrected dual stack ipv6 preferred mode in 91c9f98 |
@mikaleppanen Will the patch you pushed fix the build error I mentioned? Is this good to go for another test run? |
This has a relatively large number of changes in a single pr, including conflicts with other prs that are currently under review (for example IPv6 support in SocketAddress #2652). Could we limit the scope of this pr to only lwip and split other changes (especially changes to the network-socket API) into separate prs? This would allow us to properly review changes that impact the user API and other network-socket implementations. |
@@ -20,11 +20,29 @@ | |||
#include "stddef.h" | |||
#include <new> | |||
|
|||
static bool stackHasIPV4(NetworkStack *stack) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please stick with the existing naming convention: stack_has_ipv4
https://docs.mbed.com/docs/getting-started-mbed-os/en/latest/Full_Guide/Code_Style/
return 0; | ||
} | ||
|
||
if (stackHasIPV4(this)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe checking for literals should actually be handled in nsapi_dns_query
(similarly to the POSIX gethostbyname)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't make sense to me. Surely nsapi_dns_query should do what it name says - a DNS query. Having to add literal parsing to the DNS code too doesn't make sense - it has to be outside the DNS code anyway.
It's gethostbyname that has to handle literals before attemping a DNS query.
@@ -182,6 +182,8 @@ class Socket { | |||
attach(mbed::callback(obj, method)); | |||
} | |||
|
|||
NetworkStack *stack() const { return _stack; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this function exposed publicly in the Socket
class? The internal NetworkStack
is intentionally hidden from the user API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason it was added is no longer valid, so it no longer needs to be added for this commit. (It was needed to implement the DNS work in the first draft.)
But I remain unconvinced of the merit of hiding NetworkStack.
*/ | ||
void set_ip_address(const char *addr); | ||
bool set_ip_address(const char *addr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this is needed. If the set_ip_address
call fails, the resulting SocketAddress
will be null. Failure can be checked like so:
SocketAddress address;
address.set_ip_address("1.2.3.4");
if (!address) {
// handle invalid address
}
We should avoid changing existing APIs unless there is evidence that the current API is insufficient or conflicts with the current coding guidelines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SocketAddress will also be "null" after a valid parse of "0.0.0.0". Need to distinguish - otherwise we'd request a DNS lookup of "0.0.0.0". (Or "::").
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah interesting, that is a valid point.
|
||
// DNS options | ||
#define DNS_BUFFER_SIZE 256 | ||
#define DNS_BUFFER_SIZE 512 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checking, was there a test that confirmed the original buffer size was too small?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DNS spec says 512 bytes. We reduced it from 1024 to 512 during devlopment, but when we saw that someone else had been touching the DNS code (aargh), we saw you'd reduced it further to 256. Left it at 512 during conflict resolution.
Not seen any failures, but I'm not totally confident about using IPv6 DNS with half-sized buffers.
(We also made the original DNS reply parsing resilient to truncated results, but had to abandon it - wasn't straightforward to refit to the new code, which doesn't consider packet length at all).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah gotcha, wasn't aware of the DNS spec 👍
lwip/src/apps/* | ||
lwip/src/netif/ppp/* | ||
lwip/src/inlude/lwip/apps/* | ||
lwip/src/inlude/posix/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the lwip codebase is being mirrored, shouldn't we just avoid adding these directories into mbed-os?
None of these seem to add a benefit except maybe documentation, which shouldn't present a compilation issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would mean writing special scripts and tools to cope with the variation, and more error-prone tracking of the upstream. This is attempting to work with the source control system rather than against it. (As much as we can given the limitations of mbed-os).
This way means it's just a single "git subtree add".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you're right, removing the directories would be annoying.
It is possible to amend the subtree add commit to remove the directories, and this removal works cleanly with future subtree merges. But if the removed files are modified, it will introduce a merge conflict for every modification.
@@ -43,16 +43,21 @@ static bool ipv4_is_valid(const char *addr) | |||
static bool ipv6_is_valid(const char *addr) | |||
{ | |||
// Check each digit for [0-9a-fA-F:] | |||
// Must also have at least 2 colons | |||
int colons = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, nice catch
addr_type = NETCONN_DNS_IPV4; | ||
} | ||
#endif | ||
err_t err = netconn_gethostbyname_addrtype(host, &lwip_addr, addr_type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like addr_type
was declared conditionally based on LWIP_IPV4 && LWIP_IPV6
. Has this been tested with other IP version configurations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That actually does work, because the call is a macro that ignores its 3rd parameter unless both IPv4 and IPv6 are enabled. Should at least be commented, but probably better to not use the addrtype form unless in the if.
@bridadan ethernet.h header collision is now corrected. Could you trigger tests again. |
@mikaleppanen It sounds like there's still a discussion going on for this PR, maybe we should hold off until that has a chance to be resolved. |
/morph test-nightly |
Result: FAILUREYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 928 Test failed! |
I've tried to merge the DNS changes into the pr over here: #2652 Let me know if I missed anything |
Thanks - looks like we should be able to drop those bits from here. Have commented over there. |
TCP corrected in: 84194f04df688f403e19887d0357a29207fd16f6 could you retest |
/morph test-nightly |
Result: FAILUREYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 935 Test failed! |
retest uvisor |
1 similar comment
retest uvisor |
Updated to master and corrected inspection defect. Could you retest this. |
/morph test-nightly |
Result: FAILUREYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 964 Test failed! |
…d" when multicast group address is added to filter.
Updated commit message 1d2130f |
When this does go in, please make sure it's a normal merge, not a squash or rebase, to preserve the lwIP subtree. |
Corrected TCP keep alive interval 7d770366d17500ea50eea03fdf94e6a890a559b1 |
On the TCP interval - it's not actually clear what is "correct". NSAPI documentation doesn't specify the units of the interval, and it actually has always been milliseconds for lwIP - it's not a 1.4->2.0 change. So suggest that last commit moves to a separate pull request. mbed client appears to have a default interval setting of 300 - it's assuming seconds. Not unreasonably, as that tends to be the unit used by most APIs (eg Linux sysctl, lwIP's own setsockopt). But it ends up getting a keepalive every half-second. |
Removed the TCP interval commit. |
While I'm not very familiar with all the PR details, it looks good overall 👍 |
I'm still uncomfortable with the network-socket API changes in this pr. Given the size of the diff and the impact of the network-socket API, I don't believe these changes have had acceptable review. I'm not saying the changes won't be accepted, but we should have separate prs to track the network-socket API changes. |
Agree that it was an excessive lump, given that we're stuck with Github. But the set of changes made sense as a single topic branch - they're all related to one aim - making IPv4+IPv6 work. Problem is Github PRs are a rubbish review tool. If this was Gerrit it would have been easy to review the individual patches. Having a pull request review system but no proper patch review system is just sad. :( |
Description
LWIP stack 2.0, LWIP stack adaptation code and mac driver updates.
Status
READY
Migrations
Updated freescale drivers to do or operation for multicast group filters:
hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K66F/drivers/fsl_enet.c
hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_MCU_K64F/drivers/fsl_enet.c
(commit 92baa85b7b07dbcdfcb1422be03127d88ddded91)
Related PRs
List related PRs against other branches:
None
Todos
Deploy notes
None
Steps to test or reproduce
None