mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Merge pull request #4107 from cgundogan/pr/rpl/make_fib_rpl_aware
Introduce RPL awareness to fib entries
This commit is contained in:
commit
8af6a6630d
@ -62,6 +62,11 @@ typedef struct fib_destination_set_entry_t {
|
|||||||
*/
|
*/
|
||||||
#define FIB_LIFETIME_NO_EXPIRE (0xFFFFFFFFffffffff)
|
#define FIB_LIFETIME_NO_EXPIRE (0xFFFFFFFFffffffff)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief flag to identify if a route was set by RPL
|
||||||
|
*/
|
||||||
|
#define FIB_FLAG_RPL_ROUTE (1UL << 0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief initializes all FIB entries with 0
|
* @brief initializes all FIB entries with 0
|
||||||
*
|
*
|
||||||
|
@ -37,6 +37,7 @@ static char addr_str[IPV6_ADDR_MAX_STR_LEN];
|
|||||||
#define GNRC_RPL_OPT_DODAG_CONF_LEN (14)
|
#define GNRC_RPL_OPT_DODAG_CONF_LEN (14)
|
||||||
#define GNRC_RPL_OPT_PREFIX_INFO_LEN (30)
|
#define GNRC_RPL_OPT_PREFIX_INFO_LEN (30)
|
||||||
#define GNRC_RPL_OPT_TARGET_LEN (18)
|
#define GNRC_RPL_OPT_TARGET_LEN (18)
|
||||||
|
#define GNRC_RPL_OPT_TRANSIT_E_FLAG (1 << 7)
|
||||||
#define GNRC_RPL_OPT_TRANSIT_INFO_LEN (4)
|
#define GNRC_RPL_OPT_TRANSIT_INFO_LEN (4)
|
||||||
#define GNRC_RPL_SHIFTED_MOP_MASK (0x7)
|
#define GNRC_RPL_SHIFTED_MOP_MASK (0x7)
|
||||||
#define GNRC_RPL_PRF_MASK (0x7)
|
#define GNRC_RPL_PRF_MASK (0x7)
|
||||||
@ -415,8 +416,8 @@ bool _parse_options(int msg_type, gnrc_rpl_dodag_t *dodag, gnrc_rpl_opt_t *opt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fib_add_entry(&gnrc_ipv6_fib_table, if_id, target->target.u8,
|
fib_add_entry(&gnrc_ipv6_fib_table, if_id, target->target.u8,
|
||||||
sizeof(ipv6_addr_t), AF_INET6, src->u8,
|
sizeof(ipv6_addr_t), 0x0, src->u8,
|
||||||
sizeof(ipv6_addr_t), AF_INET6,
|
sizeof(ipv6_addr_t), FIB_FLAG_RPL_ROUTE,
|
||||||
(dodag->default_lifetime * dodag->lifetime_unit) *
|
(dodag->default_lifetime * dodag->lifetime_unit) *
|
||||||
SEC_IN_MS);
|
SEC_IN_MS);
|
||||||
break;
|
break;
|
||||||
@ -435,7 +436,9 @@ a preceding RPL TARGET DAO option\n");
|
|||||||
fib_update_entry(&gnrc_ipv6_fib_table,
|
fib_update_entry(&gnrc_ipv6_fib_table,
|
||||||
first_target->target.u8,
|
first_target->target.u8,
|
||||||
sizeof(ipv6_addr_t), src->u8,
|
sizeof(ipv6_addr_t), src->u8,
|
||||||
sizeof(ipv6_addr_t), AF_INET6,
|
sizeof(ipv6_addr_t),
|
||||||
|
((transit->e_flags & GNRC_RPL_OPT_TRANSIT_E_FLAG) ?
|
||||||
|
0x0 : FIB_FLAG_RPL_ROUTE),
|
||||||
(transit->path_lifetime *
|
(transit->path_lifetime *
|
||||||
dodag->lifetime_unit * SEC_IN_MS));
|
dodag->lifetime_unit * SEC_IN_MS));
|
||||||
first_target = (gnrc_rpl_opt_target_t *) (((uint8_t *) (first_target)) +
|
first_target = (gnrc_rpl_opt_target_t *) (((uint8_t *) (first_target)) +
|
||||||
|
@ -274,9 +274,9 @@ bool gnrc_rpl_parent_add_by_addr(gnrc_rpl_dodag_t *dodag, ipv6_addr_t *addr, gnr
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (fib_add_entry(&gnrc_ipv6_fib_table, if_id, def.u8,
|
if (fib_add_entry(&gnrc_ipv6_fib_table, if_id, def.u8,
|
||||||
sizeof(ipv6_addr_t), AF_INET6,
|
sizeof(ipv6_addr_t), 0x0,
|
||||||
dodag->parents->addr.u8, sizeof(ipv6_addr_t),
|
dodag->parents->addr.u8, sizeof(ipv6_addr_t),
|
||||||
AF_INET6, (dodag->default_lifetime *
|
FIB_FLAG_RPL_ROUTE, (dodag->default_lifetime *
|
||||||
dodag->lifetime_unit) * SEC_IN_MS) != 0) {
|
dodag->lifetime_unit) * SEC_IN_MS) != 0) {
|
||||||
DEBUG("RPL: error adding parent to FIB\n");
|
DEBUG("RPL: error adding parent to FIB\n");
|
||||||
gnrc_rpl_parent_remove(*parent);
|
gnrc_rpl_parent_remove(*parent);
|
||||||
@ -355,9 +355,9 @@ void gnrc_rpl_parent_update(gnrc_rpl_dodag_t *dodag, gnrc_rpl_parent_t *parent)
|
|||||||
kernel_pid_t if_id;
|
kernel_pid_t if_id;
|
||||||
if ((if_id = gnrc_ipv6_netif_find_by_addr(NULL, &all_RPL_nodes)) != KERNEL_PID_UNDEF) {
|
if ((if_id = gnrc_ipv6_netif_find_by_addr(NULL, &all_RPL_nodes)) != KERNEL_PID_UNDEF) {
|
||||||
fib_add_entry(&gnrc_ipv6_fib_table, if_id, def.u8,
|
fib_add_entry(&gnrc_ipv6_fib_table, if_id, def.u8,
|
||||||
sizeof(ipv6_addr_t), AF_INET6,
|
sizeof(ipv6_addr_t), 0x0,
|
||||||
dodag->parents->addr.u8, sizeof(ipv6_addr_t),
|
dodag->parents->addr.u8, sizeof(ipv6_addr_t),
|
||||||
AF_INET6, (dodag->default_lifetime *
|
FIB_FLAG_RPL_ROUTE, (dodag->default_lifetime *
|
||||||
dodag->lifetime_unit) * SEC_IN_MS);
|
dodag->lifetime_unit) * SEC_IN_MS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -422,8 +422,8 @@ static gnrc_rpl_parent_t *_gnrc_rpl_find_preferred_parent(gnrc_rpl_dodag_t *doda
|
|||||||
}
|
}
|
||||||
|
|
||||||
fib_add_entry(&gnrc_ipv6_fib_table, if_id, def.u8, sizeof(ipv6_addr_t),
|
fib_add_entry(&gnrc_ipv6_fib_table, if_id, def.u8, sizeof(ipv6_addr_t),
|
||||||
AF_INET6, dodag->parents->addr.u8, sizeof(ipv6_addr_t),
|
0x0, dodag->parents->addr.u8, sizeof(ipv6_addr_t),
|
||||||
AF_INET6, (dodag->default_lifetime *
|
FIB_FLAG_RPL_ROUTE, (dodag->default_lifetime *
|
||||||
dodag->lifetime_unit) * SEC_IN_MS);
|
dodag->lifetime_unit) * SEC_IN_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user