-
Notifications
You must be signed in to change notification settings - Fork 2k
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
paho: use GNRC instead of lwip #18982
Conversation
examples/paho-mqtt/Makefile
Outdated
USEMODULE += auto_init_gnrc_netif | ||
# Activate ICMPv6 error messages | ||
USEMODULE += gnrc_icmpv6_error | ||
# Specify the mandatory networking module for a IPv6 routing node | ||
USEMODULE += gnrc_ipv6_router_default | ||
# Add a routing protocol | ||
USEMODULE += gnrc_rpl | ||
USEMODULE += auto_init_gnrc_rpl | ||
# Additional networking modules that can be dropped if not needed | ||
USEMODULE += gnrc_icmpv6_echo |
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 not support both?
e.g. examples/gcoap
and examples/telnet_server
can be compiled with either GNRC or LWIP.
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.
Sure it would, but what would be the advantage? In my understanding the example applications should be easy to use (and as simple as possible). I think having one example that demonstrates how to build a network application for different stacks is sufficient.
examples/paho-mqtt/Makefile
Outdated
# Activate ICMPv6 error messages | ||
USEMODULE += gnrc_icmpv6_error | ||
# Specify the mandatory networking module for a IPv6 routing node | ||
USEMODULE += gnrc_ipv6_router_default |
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.
USEMODULE += gnrc_ipv6_router_default | |
USEMODULE += gnrc_ipv6_default |
should be enough here
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 actually thought about which GNRC modules are required and which are optional and came to the conclusion that for the ease-of-use requirement adding routing support is beneficial. Same goes for ICMP. If someone wants to the test the application in the IoT-Lab, for instance, having RPL and routing active might be helpful to actually get a route towards the 6lbr - and having ICMP enabled is beneficial to check the connectivity first.
Of course, we could also remove the modules and try to keep the example application as slim as possible.
Both options have their pros and cons IMO.
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 thing is that this will actually make it harder to use. When the node is a router, it will not send router solicitations. That means you’ll have to wait for the next unsolicited router advertisement to get a global 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.
Valid point. So, how about keeping RPL, but switching to host, i.e., RPL leaf node?
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.
tbh I'm not sure if RPL actually is used much at all, at appears to be rather abandoned.
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.
Are you talking about usage or maintenance? As far as I can tell, it is working well.
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 @benpicco isn't using it, it is abandoned ;) I use it regularly in my setups.
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.
(and it is used with gnrc_networking, so most people using that example will use it)
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.
@miri64 are you only using it with static topologies? It appears that repairing the DODAG when a node vanishes just doesn't happen, which is kinda crucial in real-world scenarios. (#17327) Or maybe I'm just under-estimating the time this takes?
When I asked about it more than a year ago I couldn't find anyone who used it outside simple / short lived test scenarios and nobody who maintains the module.
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 this bug is still present basically the same arguments from below (whether to enable LWIP as an alternative or not) apply. If RPL works in some scenarios it is nice to have for this application, but it may get frustrating for users using it an dynamically changing topology. I used RPL on real hardware with bigger topologies only in the IoT-LAB so far, so I've observed the bug myself.
examples/paho-mqtt/Makefile
Outdated
# Add a routing protocol | ||
USEMODULE += gnrc_rpl | ||
USEMODULE += auto_init_gnrc_rpl |
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.
# Add a routing protocol | |
USEMODULE += gnrc_rpl | |
USEMODULE += auto_init_gnrc_rpl |
Not really needed here
@@ -33,25 +33,20 @@ USEMODULE += ps | |||
USEMODULE += netdev_default | |||
USEPKG += paho-mqtt | |||
|
|||
# paho-mqtt depends on TCP support, choose which stacks you want | |||
LWIP_IPV4 ?= 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.
Switching to GNRC will drop support for IPv4 from this example. I think the use of LwIP stack was not only motivated by the missing TCP support in GNRC but also by the missing IPv4 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.
To be honest, the main motivation for this PR was that the LWIP version in the IoT-Lab on IPv6 doesn't work for some reason. (The TCP connection is not established.) Since I didn't want to debug LWIP, I tried with GNRC instead.
In the end, the question remains: what is the main use case we want to support here. My idea is that all networking examples use GNRC whenever possible. Of course, that limits the use case to IPv6 (and 6LoWPAN) only. The other option would be to use LWIP for all networking examples wherever possible to allow for both, IPv4 and IPv6.
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.
But with the sock API we can support both stacks without any changes to the code.
So the Makefile only needs to select different modules, depending on the desired 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.
Well, first of all that would require that this application actually works with both stacks which I couldn't verify (LWIP with 6lbr doesn't seem to work). Second, if we go with this reasoning we should update all networking applications which use sock.
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.
You can use LWIP without 6lbr, it also supports non-6lo interfaces.
It's not unreasonable to try to build with both stacks to ensure they work the same. The changes to the Makefile
are really 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.
You can use LWIP without 6lbr, it also supports non-6lo interfaces.
I would prefer an example that works in all scenarios. Having an example application that is known to be broken in a certain configuration may get frustrating for a user.
It's not unreasonable to try to build with both stacks to ensure they work the same. The changes to the
Makefile
are really small.
I'm not per se against this, but what would be the rationale to enable both stacks for this application, but, for instance, not for the MQTT-SN examples?
Okay, I removed RPL, configure RIOT as a host (instead of router) and let the user select a network 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.
Looks good to me, please squash
ee87b26
to
e4f8f10
Compare
e4f8f10
to
5455c9f
Compare
If you change the default, |
5f0174e
to
ef2b581
Compare
Contribution description
The example application for Paho MQTT is using lwip instead of GNRC because at the time of writing no TCP support for GNRC was available. However, in the meantime the situation has changed and with a tiny tweak of the adapter code Paho works like charm on GNRC TCP sockets.
Testing procedure
Start a MQTT broker, e.g., mosquitto.
On native:
nib route add 7 :: <link-local address of the bridge>
On iotlab-m3 (or similar):
Finally, call
con <Broker IPv6 address>
followed bysub <TOPIC>
and `pub .