-
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
gnrc_rpl: do not assert netif on auto-init #10895
gnrc_rpl: do not assert netif on auto-init #10895
Conversation
`gnrc_networking` is unusable when compiled for boards that do not have any network devices on-board due to an assertion in RPL's auto-init. I think this is pretty harsh. A friendly info message is enough, as it might not even be an error. Also, if one expects RPL to work without network interfaces they are a fool ;-).
@MichelRottleuthner and me discussed this a couple of days ago. IMO it's really strange that we set |
One thing is a compile time configuration, the other a runtime configuration. Once #10622 is in effect, this could be normal behavior.
IMO not. Just because
This is a possible optimization (or rather: do not include |
My ceterum censeo is that we should not bloat the code with run-time checks, but rather get the compile-time dependencies straight. Adding a run-time check here is a very simple, but palliative solution. This check is unnecessary for correctly compiled applications, so that we add superfluous overhead for properly configured apps (which should be the majority of all compilations) ... |
The problem is as e.g. in #10412 that this error was also caused by runtime errors (e.g. the radio failed to initialize for whatever reason). Basically, this assert (again: the routing protocol making assumptions about the lower layer) hardstops any attempt the lower layer might try to resolve the situation. IMHO the assert is completely in the wrong place. |
It's not the routing protocol; the assert is in the context of auto_init. Don't auto_init, if device initialization can fail, because there is no way to re-run all auto_init functions "after lower layers resolve the situation" (which there is nothing like that in RIOT that I know of). In your example, the correct behaviour would be to "resolve" the situation on the lower layer, i.e., in a blocking way, such that upper layers don't even start to auto_init. Our auto_init does not support a sophisticated error handling and re-running of auto_init functions (yet?). It merely is a sequence of auto_init function calls without any dependency checks. My fear is that putting run-time checks here and there only "shadows" actual problems. Makes it disappear for now, only to come back and haunt us during refactoring attempts or alike. I consider putting an |
Fine, then it is the
Most users will just assess: "Welp, networking doesn't work on my Arduino, because this RPL thing is crashing the system, please help!"
Yes it doesn't support it yet, but this assert blocks future efforts towards this IMHO.
It already steps in at a place where it is not supposed to. So removing it doesn't shadow the problem, it keeps problem to the module responsible for it. E.g. IPv6 doesn't fail either when there are no network interfaces, because it can work with that, and so does RPL (naïve solution would be to type
But so is the assert. It causes a crash due to a problem in the lower layer. At least the
On that note after a night's sleep: If we somehow manage to exclude Finally, there is another valid reason why there might be no network interface at startup: the device might need "manual" bootstrapping (or bootstrapping provided by the dynamic configuration, but which still might need some time). Classic examples: WiFi or Bluetooth. |
I am not saying that There is no clean way to solve this with our current approach of auto_init. IMO, the most appropriate solution would be to have interface up/down events and let rpl auto_init be called on FWIW, the quickest solution in this case is adding the comment. And I would really appreciate it if you make this warning as flashy as you can, so 1) other developers don't see these kind of checks as the normal way to handle such scenarios, and 2) that we have a reminder for ourselves to replace this auto_init with something more appropriate in the future (interface events, etc.) |
Done |
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.
thanks @miri64. That's exactly what I wanted (: ACK
Contribution description
gnrc_networking
is unusable when compiled for boards that do not have any network devices on-board due to an assertion in RPL's auto-init. I think this is pretty harsh. A friendly info message is enough, as it might not even be an error. Also, if one expects RPL to work without network interfaces they are a fool ;-). Also also, theGNRC_NETIF_NUMOF != 1
case doesn't have this assertion either.Testing procedure
Compile
gnrc_networking
for a board without any on-board radios. Without this PR the board will run into a failed assertion on start-up. With it, it will just continue and print a message before the normal welcome message: "Unable to auto-initialize RPL. No interfaces found."Issues/PRs references
None, but discovered in #10412.