Merge pull request #10895 from miri64/gnrc_rpl/enh/do-not-assert-netif
gnrc_rpl: do not assert netif on auto-init
This commit is contained in:
commit
7931d66f79
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#ifdef MODULE_AUTO_INIT_GNRC_RPL
|
#ifdef MODULE_AUTO_INIT_GNRC_RPL
|
||||||
|
|
||||||
|
#include "log.h"
|
||||||
#include "net/gnrc.h"
|
#include "net/gnrc.h"
|
||||||
#include "net/gnrc/rpl.h"
|
#include "net/gnrc/rpl.h"
|
||||||
|
|
||||||
@ -29,7 +30,12 @@ void auto_init_gnrc_rpl(void)
|
|||||||
{
|
{
|
||||||
#if (GNRC_NETIF_NUMOF == 1)
|
#if (GNRC_NETIF_NUMOF == 1)
|
||||||
gnrc_netif_t *netif = gnrc_netif_iter(NULL);
|
gnrc_netif_t *netif = gnrc_netif_iter(NULL);
|
||||||
assert(netif != NULL);
|
if (netif == NULL) {
|
||||||
|
/* XXX this is just a work-around ideally this would happen with
|
||||||
|
* an `up` event of the interface */
|
||||||
|
LOG_INFO("Unable to auto-initialize RPL. No interfaces found.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
DEBUG("auto_init_gnrc_rpl: initializing RPL on interface %" PRIkernel_pid "\n",
|
DEBUG("auto_init_gnrc_rpl: initializing RPL on interface %" PRIkernel_pid "\n",
|
||||||
netif->pid);
|
netif->pid);
|
||||||
gnrc_rpl_init(netif->pid);
|
gnrc_rpl_init(netif->pid);
|
||||||
@ -41,10 +47,14 @@ void auto_init_gnrc_rpl(void)
|
|||||||
gnrc_rpl_init(GNRC_RPL_DEFAULT_NETIF);
|
gnrc_rpl_init(GNRC_RPL_DEFAULT_NETIF);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/* XXX this is just a work-around ideally this would happen with
|
||||||
|
* an `up` event of the GNRC_RPL_DEFAULT_NETIF */
|
||||||
DEBUG("auto_init_gnrc_rpl: could not initialize RPL on interface %" PRIkernel_pid" - "
|
DEBUG("auto_init_gnrc_rpl: could not initialize RPL on interface %" PRIkernel_pid" - "
|
||||||
"interface does not exist\n", GNRC_RPL_DEFAULT_NETIF);
|
"interface does not exist\n", GNRC_RPL_DEFAULT_NETIF);
|
||||||
return;
|
return;
|
||||||
#else
|
#else
|
||||||
|
/* XXX this is just a work-around ideally this should be defined in some
|
||||||
|
* run-time interface configuration */
|
||||||
DEBUG("auto_init_gnrc_rpl: please specify an interface by setting GNRC_RPL_DEFAULT_NETIF\n");
|
DEBUG("auto_init_gnrc_rpl: please specify an interface by setting GNRC_RPL_DEFAULT_NETIF\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user