-
Notifications
You must be signed in to change notification settings - Fork 2.1k
rpl, rpble: hint to RPL when on L2 a connection closes #21586
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
Changes from all commits
24efac9
2c91922
4162b67
71bd142
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,6 +129,7 @@ typedef struct { | |
| uint8_t version; /**< DODAG version */ | ||
| uint8_t role; /**< RPL role of the node */ | ||
| uint16_t rank; /**< the node's rank in the DODAG */ | ||
| ipv6_addr_t parent_addr; /**< address of the node's preferred parent */ | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to know the ipv6 address of the parent because RPL doesn't know anything about L2 addresses.. Storing it in the local rpl context is (for now) the easiest solution, but alternatively we could also build it directly from the l2 address or use the neighbor cache (which would require #21580). |
||
| } nimble_rpble_ctx_t; | ||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,6 +129,18 @@ void gnrc_rpl_dodag_remove_all_parents(gnrc_rpl_dodag_t *dodag); | |
| bool gnrc_rpl_parent_add_by_addr(gnrc_rpl_dodag_t *dodag, ipv6_addr_t *addr, | ||
| gnrc_rpl_parent_t **parent); | ||
|
|
||
| /** | ||
| * @brief Iterate over all parents in all DODAGs with IPv6 address @p addr. | ||
| * | ||
| * @param[in] idx Index to start searching from. | ||
| * @param[in] addr IPV6 address of the parent. | ||
| * @param[out] parent Pointer to the parent if one was found. Otherwise NULL. | ||
| * | ||
| * @return Index > 0 to continue next search from, if parent was found. | ||
| * @return -ENONENT if not found. | ||
| */ | ||
| int gnrc_rpl_parent_iter_by_addr(ipv6_addr_t *addr, gnrc_rpl_parent_t **parent, int idx); | ||
|
|
||
|
Comment on lines
+132
to
+143
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function is a bit weird, but it is needed because, theoretically, if we have more than one RPL instance, the same node can be present as parent in multiple dodags, and thus appear multiple times in the |
||
| /** | ||
| * @brief Remove the @p parent from its DODAG. | ||
| * | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -176,6 +176,14 @@ gnrc_rpl_instance_t *gnrc_rpl_root_init(uint8_t instance_id, const ipv6_addr_t * | |
| return inst; | ||
| } | ||
|
|
||
| void gnrc_rpl_addr_unreachable(ipv6_addr_t *addr) | ||
| { | ||
| msg_t msg; | ||
| msg.type = GNRC_RPL_MSG_TYPE_ADDR_UNREACHABLE; | ||
| msg.content.ptr = addr; | ||
| msg_send(&msg, gnrc_rpl_pid); | ||
|
Comment on lines
+182
to
+184
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this cause an issue if it ends-up blocking the caller (in my case the |
||
| } | ||
|
|
||
| static void _receive(gnrc_pktsnip_t *icmpv6) | ||
| { | ||
| gnrc_pktsnip_t *ipv6, *netif; | ||
|
|
@@ -273,6 +281,16 @@ static void _parent_timeout(gnrc_rpl_parent_t *parent) | |
| evtimer_add_msg(&gnrc_rpl_evtimer, &parent->timeout_event, gnrc_rpl_pid); | ||
| } | ||
|
|
||
| static void _addr_unreachable(ipv6_addr_t *addr) | ||
| { | ||
| gnrc_rpl_parent_t *parent; | ||
| int idx = 0; | ||
|
|
||
| while ((idx = gnrc_rpl_parent_iter_by_addr(addr, &parent, idx)) >= 0) { | ||
| _parent_timeout(parent); | ||
| } | ||
| } | ||
|
|
||
| static void *_event_loop(void *args) | ||
| { | ||
| msg_t msg, reply; | ||
|
|
@@ -293,6 +311,7 @@ static void *_event_loop(void *args) | |
| trickle_t *trickle; | ||
| gnrc_rpl_parent_t *parent; | ||
| gnrc_rpl_instance_t *instance; | ||
| ipv6_addr_t *addr; | ||
|
|
||
| /* start event loop */ | ||
| while (1) { | ||
|
|
@@ -311,6 +330,11 @@ static void *_event_loop(void *args) | |
| parent = msg.content.ptr; | ||
| _parent_timeout(parent); | ||
| break; | ||
| case GNRC_RPL_MSG_TYPE_ADDR_UNREACHABLE: | ||
| DEBUG("RPL: GNRC_RPL_MSG_TYPE_ADDR_UNREACHABLE received\n"); | ||
| addr = msg.content.ptr; | ||
| _addr_unreachable(addr); | ||
| break; | ||
| case GNRC_RPL_MSG_TYPE_DODAG_DAO_TX: | ||
| DEBUG("RPL: GNRC_RPL_MSG_TYPE_DODAG_DAO_TX received\n"); | ||
| instance = msg.content.ptr; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
Import needed here because the
{nimble/}host/*imports below have some definitions that conflict with thebyteorder.hthatnet/ipv6/addr.himports.