gnrc/rpl: Move GNRC_RPL_WITHOUT_PIO to 'CONFIG_' namespace
Also evaluate its value using IS_ACTIVE when possible.
This commit is contained in:
parent
88edfbad2c
commit
dfa722c519
@ -49,7 +49,7 @@
|
|||||||
*
|
*
|
||||||
* - Exclude Prefix Information Options from DIOs
|
* - Exclude Prefix Information Options from DIOs
|
||||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.mk}
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.mk}
|
||||||
* CFLAGS += -DGNRC_RPL_WITHOUT_PIO
|
* CFLAGS += -DCONFIG_GNRC_RPL_WITHOUT_PIO
|
||||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
*
|
*
|
||||||
* - Modify trickle parameters
|
* - Modify trickle parameters
|
||||||
@ -667,20 +667,21 @@ void gnrc_rpl_send(gnrc_pktsnip_t *pkt, kernel_pid_t iface, ipv6_addr_t *src, ip
|
|||||||
*/
|
*/
|
||||||
uint8_t gnrc_rpl_gen_instance_id(bool local);
|
uint8_t gnrc_rpl_gen_instance_id(bool local);
|
||||||
|
|
||||||
#ifndef GNRC_RPL_WITHOUT_PIO
|
|
||||||
/**
|
/**
|
||||||
* @brief (De-)Activate the transmission of Prefix Information Options within DIOs
|
* @brief (De-)Activate the transmission of Prefix Information Options within DIOs
|
||||||
* for a particular DODAG
|
* for a particular DODAG. This function has no effect if
|
||||||
|
* CONFIG_GNRC_RPL_WITHOUT_PIO is set.
|
||||||
*
|
*
|
||||||
* @param[in] dodag Pointer to the DODAG
|
* @param[in] dodag Pointer to the DODAG
|
||||||
* @param[in] status true for activating PIOs and false for deactivating them
|
* @param[in] status true for activating PIOs and false for deactivating them
|
||||||
*/
|
*/
|
||||||
static inline void gnrc_rpl_config_pio(gnrc_rpl_dodag_t *dodag, bool status)
|
static inline void gnrc_rpl_config_pio(gnrc_rpl_dodag_t *dodag, bool status)
|
||||||
{
|
{
|
||||||
dodag->dio_opts = (dodag->dio_opts & ~GNRC_RPL_REQ_DIO_OPT_PREFIX_INFO) |
|
if (!IS_ACTIVE(CONFIG_GNRC_RPL_WITHOUT_PIO)) {
|
||||||
(status << GNRC_RPL_REQ_DIO_OPT_PREFIX_INFO_SHIFT);
|
dodag->dio_opts = (dodag->dio_opts & ~GNRC_RPL_REQ_DIO_OPT_PREFIX_INFO) |
|
||||||
|
(status << GNRC_RPL_REQ_DIO_OPT_PREFIX_INFO_SHIFT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "kernel_defines.h"
|
||||||
|
|
||||||
#include "net/icmpv6.h"
|
#include "net/icmpv6.h"
|
||||||
#include "net/ipv6.h"
|
#include "net/ipv6.h"
|
||||||
@ -132,9 +133,10 @@ gnrc_rpl_instance_t *gnrc_rpl_root_init(uint8_t instance_id, ipv6_addr_t *dodag_
|
|||||||
dodag->node_status = GNRC_RPL_ROOT_NODE;
|
dodag->node_status = GNRC_RPL_ROOT_NODE;
|
||||||
dodag->my_rank = GNRC_RPL_ROOT_RANK;
|
dodag->my_rank = GNRC_RPL_ROOT_RANK;
|
||||||
dodag->dio_opts |= GNRC_RPL_REQ_DIO_OPT_DODAG_CONF;
|
dodag->dio_opts |= GNRC_RPL_REQ_DIO_OPT_DODAG_CONF;
|
||||||
#ifndef GNRC_RPL_WITHOUT_PIO
|
|
||||||
dodag->dio_opts |= GNRC_RPL_REQ_DIO_OPT_PREFIX_INFO;
|
if (!IS_ACTIVE(CONFIG_GNRC_RPL_WITHOUT_PIO)) {
|
||||||
#endif
|
dodag->dio_opts |= GNRC_RPL_REQ_DIO_OPT_PREFIX_INFO;
|
||||||
|
}
|
||||||
|
|
||||||
trickle_start(gnrc_rpl_pid, &dodag->trickle, GNRC_RPL_MSG_TYPE_TRICKLE_MSG,
|
trickle_start(gnrc_rpl_pid, &dodag->trickle, GNRC_RPL_MSG_TYPE_TRICKLE_MSG,
|
||||||
(1 << dodag->dio_min), dodag->dio_interval_doubl,
|
(1 << dodag->dio_min), dodag->dio_interval_doubl,
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "kernel_defines.h"
|
||||||
|
|
||||||
#include "net/af.h"
|
#include "net/af.h"
|
||||||
#include "net/icmpv6.h"
|
#include "net/icmpv6.h"
|
||||||
@ -285,7 +286,6 @@ gnrc_pktsnip_t *_dis_solicited_opt_build(gnrc_pktsnip_t *pkt, gnrc_rpl_internal_
|
|||||||
return opt_snip;
|
return opt_snip;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef GNRC_RPL_WITHOUT_PIO
|
|
||||||
static bool _get_pl_entry(unsigned iface, ipv6_addr_t *pfx,
|
static bool _get_pl_entry(unsigned iface, ipv6_addr_t *pfx,
|
||||||
unsigned pfx_len, gnrc_ipv6_nib_pl_t *ple)
|
unsigned pfx_len, gnrc_ipv6_nib_pl_t *ple)
|
||||||
{
|
{
|
||||||
@ -340,7 +340,6 @@ gnrc_pktsnip_t *_dio_prefix_info_build(gnrc_pktsnip_t *pkt, gnrc_rpl_dodag_t *do
|
|||||||
prefix_info->prefix_len);
|
prefix_info->prefix_len);
|
||||||
return opt_snip;
|
return opt_snip;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void gnrc_rpl_send_DIO(gnrc_rpl_instance_t *inst, ipv6_addr_t *destination)
|
void gnrc_rpl_send_DIO(gnrc_rpl_instance_t *inst, ipv6_addr_t *destination)
|
||||||
{
|
{
|
||||||
@ -365,13 +364,12 @@ void gnrc_rpl_send_DIO(gnrc_rpl_instance_t *inst, ipv6_addr_t *destination)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GNRC_RPL_WITHOUT_PIO
|
if (!IS_ACTIVE(CONFIG_GNRC_RPL_WITHOUT_PIO) &&
|
||||||
if (dodag->dio_opts & GNRC_RPL_REQ_DIO_OPT_PREFIX_INFO) {
|
dodag->dio_opts & GNRC_RPL_REQ_DIO_OPT_PREFIX_INFO) {
|
||||||
if ((pkt = _dio_prefix_info_build(pkt, dodag)) == NULL) {
|
if ((pkt = _dio_prefix_info_build(pkt, dodag)) == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (dodag->dio_opts & GNRC_RPL_REQ_DIO_OPT_DODAG_CONF) {
|
if (dodag->dio_opts & GNRC_RPL_REQ_DIO_OPT_DODAG_CONF) {
|
||||||
if ((pkt = _dio_dodag_conf_build(pkt, dodag)) == NULL) {
|
if ((pkt = _dio_dodag_conf_build(pkt, dodag)) == NULL) {
|
||||||
@ -556,9 +554,11 @@ bool _parse_options(int msg_type, gnrc_rpl_instance_t *inst, gnrc_rpl_opt_t *opt
|
|||||||
case (GNRC_RPL_OPT_PREFIX_INFO):
|
case (GNRC_RPL_OPT_PREFIX_INFO):
|
||||||
DEBUG("RPL: Prefix Information DIO option parsed\n");
|
DEBUG("RPL: Prefix Information DIO option parsed\n");
|
||||||
*included_opts |= ((uint32_t) 1) << GNRC_RPL_OPT_PREFIX_INFO;
|
*included_opts |= ((uint32_t) 1) << GNRC_RPL_OPT_PREFIX_INFO;
|
||||||
#ifndef GNRC_RPL_WITHOUT_PIO
|
|
||||||
dodag->dio_opts |= GNRC_RPL_REQ_DIO_OPT_PREFIX_INFO;
|
if (!IS_ACTIVE(CONFIG_GNRC_RPL_WITHOUT_PIO)) {
|
||||||
#endif
|
dodag->dio_opts |= GNRC_RPL_REQ_DIO_OPT_PREFIX_INFO;
|
||||||
|
}
|
||||||
|
|
||||||
gnrc_rpl_opt_prefix_info_t *pi = (gnrc_rpl_opt_prefix_info_t *) opt;
|
gnrc_rpl_opt_prefix_info_t *pi = (gnrc_rpl_opt_prefix_info_t *) opt;
|
||||||
/* check for the auto address-configuration flag */
|
/* check for the auto address-configuration flag */
|
||||||
gnrc_netif_t *netif = gnrc_netif_get_by_pid(dodag->iface);
|
gnrc_netif_t *netif = gnrc_netif_get_by_pid(dodag->iface);
|
||||||
|
|||||||
@ -344,7 +344,6 @@ int _gnrc_rpl_operation(bool leaf, char *arg1)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef GNRC_RPL_WITHOUT_PIO
|
|
||||||
int _gnrc_rpl_set_pio(char *inst_id, bool status)
|
int _gnrc_rpl_set_pio(char *inst_id, bool status)
|
||||||
{
|
{
|
||||||
uint8_t instance_id = atoi(inst_id);
|
uint8_t instance_id = atoi(inst_id);
|
||||||
@ -360,7 +359,6 @@ int _gnrc_rpl_set_pio(char *inst_id, bool status)
|
|||||||
printf("success: %sactivated PIO transmissions\n", status ? "" : "de");
|
printf("success: %sactivated PIO transmissions\n", status ? "" : "de");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
int _gnrc_rpl(int argc, char **argv)
|
int _gnrc_rpl(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -408,8 +406,7 @@ int _gnrc_rpl(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(argv[1], "set") == 0) {
|
else if (strcmp(argv[1], "set") == 0) {
|
||||||
if (argc > 2) {
|
if ((argc > 2) && !IS_ACTIVE(CONFIG_GNRC_RPL_WITHOUT_PIO)) {
|
||||||
#ifndef GNRC_RPL_WITHOUT_PIO
|
|
||||||
if (strcmp(argv[2], "pio") == 0) {
|
if (strcmp(argv[2], "pio") == 0) {
|
||||||
if ((argc == 5) && (strcmp(argv[3], "on") == 0)) {
|
if ((argc == 5) && (strcmp(argv[3], "on") == 0)) {
|
||||||
return _gnrc_rpl_set_pio(argv[4], true);
|
return _gnrc_rpl_set_pio(argv[4], true);
|
||||||
@ -418,7 +415,6 @@ int _gnrc_rpl(int argc, char **argv)
|
|||||||
return _gnrc_rpl_set_pio(argv[4], false);
|
return _gnrc_rpl_set_pio(argv[4], false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef MODULE_GNRC_RPL_P2P
|
#ifdef MODULE_GNRC_RPL_P2P
|
||||||
@ -448,9 +444,11 @@ int _gnrc_rpl(int argc, char **argv)
|
|||||||
puts("* router <instance_id>\t\t\t- operate as router in the instance");
|
puts("* router <instance_id>\t\t\t- operate as router in the instance");
|
||||||
puts("* send dis\t\t\t\t- send a multicast DIS");
|
puts("* send dis\t\t\t\t- send a multicast DIS");
|
||||||
puts("* send dis <VID_flags> <version> <instance_id> <dodag_id> - send a multicast DIS with SOL option");
|
puts("* send dis <VID_flags> <version> <instance_id> <dodag_id> - send a multicast DIS with SOL option");
|
||||||
#ifndef GNRC_RPL_WITHOUT_PIO
|
|
||||||
puts("* set pio <on/off> <instance_id>\t- (de-)activate PIO transmissions in DIOs");
|
if (!IS_ACTIVE(CONFIG_GNRC_RPL_WITHOUT_PIO)) {
|
||||||
#endif
|
puts("* set pio <on/off> <instance_id>\t- (de-)activate PIO transmissions in DIOs");
|
||||||
|
}
|
||||||
|
|
||||||
puts("* show\t\t\t\t\t- show instance and dodag tables");
|
puts("* show\t\t\t\t\t- show instance and dodag tables");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user