-
Notifications
You must be signed in to change notification settings - Fork 3k
Support cellular IPv4v6 dual stack in LWIP #4911
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
Conversation
@SeppoTakalo @kjbracey-arm @hasnainvirk please review. |
ip6_addr_set_allnodes_linklocal(&ip6_allnodes_ll); | ||
lwip_netif.mld_mac_filter(&lwip_netif, &ip6_allnodes_ll, NETIF_ADD_MAC_FILTER); | ||
} | ||
/* |
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.
Formatting
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 moved the indentation when if was added, no problem there.
@@ -262,6 +262,7 @@ PPPCellularInterface::PPPCellularInterface(FileHandle *fh, bool debug) | |||
_pwd = NULL; | |||
_fh = fh; | |||
_debug_trace_on = debug; | |||
_stack = IPV4_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.
Shouldn't this be IPV4V6_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.
I set the value to default stack. In that case flag configuration defines the stack.
features/netsocket/nsapi_ppp.h
Outdated
* | ||
* @return 0 on success, negative error code on failure | ||
*/ | ||
nsapi_error_t nsapi_ppp_connect(FileHandle *stream, Callback<void(nsapi_error_t)> status_cb=0, const char *uname=0, const char *pwd=0); | ||
nsapi_error_t nsapi_ppp_connect(FileHandle *stream, Callback<void(nsapi_error_t)> status_cb=0, const char *uname=0, const char *pwd=0, const nsapi_ip_stack_t stack=IPV4_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 default to IPv4 ? Isn't the whole point to have the stack dual configurable and choose at runtime which one is available ?
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.
Set also this to default stack.
#define PRINTPKT_SUPPORT 0 | ||
#define PAP_SUPPORT 0 | ||
#define VJ_SUPPORT 0 | ||
#define PRINTPKT_SUPPORT 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.
Formatting
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.
moved the indentation when longer define was added, no problem there.
#define IP_SOF_BROADCAST 0 | ||
#define IP_SOF_BROADCAST_RECV 0 | ||
#define IP_SOF_BROADCAST 0 | ||
#define IP_SOF_BROADCAST_RECV 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.
formating
#define MAXNAMELEN 64 /* max length of hostname or name for auth */ | ||
#define MAXSECRETLEN 64 | ||
#define MAXNAMELEN 64 /* max length of hostname or name for auth */ | ||
#define MAXSECRETLEN 64 |
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.
Formatting
@@ -16,7 +16,11 @@ | |||
"addr-timeout": { |
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.
Is this left out for backward compatibility ? Why and how ? Isn't the lwipopts.h also updated ?
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.
"addr-timeout" is the amount of time we wait for preferred system address in case we have only non-preferred system address available.
"both-addr-timeout" is the time to wait that both systems addresses are available.
So the flags have different meaning and both are valid.
|
||
#define MAXNAMELEN 64 /* max length of hostname or name for auth */ | ||
#define MAXSECRETLEN 64 | ||
#define MAXNAMELEN 64 /* max length of hostname or name for auth */ |
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.
Formatting
#define PAP_SUPPORT 0 | ||
#define VJ_SUPPORT 0 | ||
#define PRINTPKT_SUPPORT 0 | ||
#define PAP_SUPPORT 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.
Formatting
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.
There will be issues while using dual stack config, as 'add_dns_addr()' function is still not changed in relation to this PR. This particular function calls dns_setserver() internally with same index , so essentially you will overwrite your previous config.
"Hasnain: there will be issues while using dual stack config, as 'add_dns_addr()". Yes, this could be improved maybe so that in dual stack system the DNS resolution could fallback to non-preferred system if it does not for some reason work in more preferred. I'll test this a little to see There is no absolute need to modify the function since the IP address get function (mbed_lwip_get_ip_addr()) fetches either the preferred systems IP address or if not available the non-preferred. So a either ipv4 or ipv6 DNS server (google) will be always added to list if network has not provided DNS server. |
Jenkins is failing in interface up/down/up/down test since variable holding the address status is not reset on bring down. I'll correct that. |
Review defects corrected. I improved the DNS address addition functionality in case network does not provide DNS server addresses. Now in dual mode both ipv4 and ipv6 DNS addresses are added in order of preference defined by flag configuration. Corrected IAR memory pools relocation for UBLOX_C027. Corrected interface up/down/up/down error detected by Jenkins. |
@mikaleppanen I like the changes you did to place some lwip stuff on .ethusbram section for IAR compiler. Great work. |
Yes, ble raas is down. Tools team is aware about it. |
Merged lwip 2.0.2 stable path 1 from https://github.com/ARMmbed/lwip Patch allows lwip to do autonomous address configuration for prefixes that are not on-link. ad7cf16 Add David's IPv6 improvements to CHANGELOG af9d783 Fix (bogus) MSVC 2010 warning about uninitialized variable usage in ip6.c It's wrong because the variables are initialized during first loop iteration due to best_addr == NULL 68358d7 nd6: cull destination cache on router removal 7323fa1 nd6: some work on basic RFC 4861 compliance 10eb2ca ip6: improve source address selection 6c06ecd ip6/nd6: route using on-link prefixes, not addresses 9f1714d nd6: improve router selection 2486b41 netif: more ip6 state changes invoke status callback 519d809 nd6: fix Duplicate Address Detection 9f3c6dd nd6: check link status before sending packets 8c761a2 nd6: improve address autoconfiguration support
Updated lwip not to add neighbor cache entry based on router advertisement if link layer address is not present (PPP case) |
@@ -16,7 +16,11 @@ | |||
"addr-timeout": { | |||
"help": "On dual-stack system how long to wait preferred stack's address in seconds", | |||
"value": 5 | |||
}, | |||
}, | |||
"both-addr-timeout": { |
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 clear from help how this relates to the preferred wait - is it "parallel" or "series"? Could these defaults wait a total of 10, or 5? Having it be an additional wait (if it isn't) might be easier to conceptualise.
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.
Maybe comment to say that it's not terribly meaningful to set both options. How about a boolean that changes what addr-timeout means - extra wait for preferred, or extra wait for all addresses. Make the help clear that is the extra wait on top of the initial wait for any address.
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.
Corrected.
@@ -751,6 +751,10 @@ void link_established(ppp_pcb *pcb) { | |||
if (!doing_multilink) { | |||
for (i = 0; (protp = protocols[i]) != NULL; ++i) | |||
if (protp->protocol != PPP_LCP | |||
#if PPP_IPV4_SUPPORT && PPP_IPV6_SUPPORT |
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.
This feels like it's in the wrong layer. Shouldn't a suppression check be in ip[v6]cp_lowerup?
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.
Corrected.
neighbor_cache[neighbor_index].state = ND6_INCOMPLETE; | ||
neighbor_cache[neighbor_index].counter.probes_sent = 1; | ||
nd6_send_neighbor_cache_probe(&neighbor_cache[neighbor_index], ND6_SEND_FLAG_MULTICAST_DEST); | ||
if (netif->hwaddr_len) { |
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.
Suggested simple alternative - set state to STALE if interface has no HW address. I believe that should stay in STALE forever, without triggering probes. (Because the entries are not used, so don't transition to DELAY)
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.
Corrected.
Added new configuration option "both-addr-timeout" that defines how long to wait that addresses from both systems become available.
If both IPv4 and IPv6 are available, and DNS query fails for first system, second system is tried.
@kjbracey-arm corrected defects. |
I think all has approved this. @hasnainvirk can you update status review status. @theotherjimmy @0xc0170 can this progress? |
/morph test-nightly |
@mikaleppanen How this can be tested ? Is it referenced PR above to cliapp? Any new example (will cellular example get an update) ? |
I have tested this manually using cliapp tests (above pr) and mbed-os-example-client with MTS_DRAGONFLY_F411RE. Cellular example will be updated but currently we do not have echo server for ipv6 connectivity (ublox server works only for ipv4). |
Result: FAILUREYour command has finished executing! Here's what you wrote!
OutputBuild failed! |
If DHCP or PPP does not provide DNS addresses, for dual stack, adds both ipv4 and ipv6 DNS addresses to DNS list.
Updated pull request. Changed memory pool areas that caused nightly tests to fail. Tested to compile with failing targets and tested Ethernet connectivity with LPC1768 and UBLOX_C027. |
@0xc0170 Please restart the test. |
Could you retest this. |
/morph test-nightly |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
Description
Cellular IPv4v6 dual stack support to lwip.
Status
READY
Migrations
YES
nsapi_ppp.h function nsapi_ppp_connect(): Added "const nsapi_ip_stack_t stack" parameter
-> can be used in dual stack case to set either ipv4v6 or ipv4 stack, for non-dual
stack case use value DEFAULT_STACK.
ppp_lwip.h function ppp_lwip_if_init(): Added "const nsapi_ip_stack_t stack" parameter
-> can be used in dual stack case to set either ipv4v6 or ipv4 stack, for non-dual
stack case use value DEFAULT_STACK.
lwip_stack.h function mbed_lwip_bringup_2(): Added "const nsapi_ip_stack_t stack" parameter
-> can be used in dual stack case to set either ipv4v6 or ipv4 stack, for non-dual
stack case use value DEFAULT_STACK.
Related PRs
None
Todos
Deploy notes
None
Steps to test or reproduce
None