-
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
Conversation
Iterate through all parents whose address match `addr`. In most cases there will only be a single parent, but if `GNRC_RPL_INSTANCES_NUMOF > 1` then one node can be parent in multiple DODAGs.
Add new message type `GNRC_RPL_MSG_TYPE_ADDR_UNREACHABLE` to inform RPL thread of an unreachable IPv6 address. RPL will then iterate through its parents and timeout the parents with matching address.
Inform RPL that an address is unreachable if the BLE connection to the RPL parent breaks.
| 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 */ |
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.
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).
| #include "thread.h" | ||
| #include "nimble_riot.h" | ||
|
|
||
| #include "net/ipv6/addr.h" |
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 the byteorder.h that net/ipv6/addr.h imports.
| msg.type = GNRC_RPL_MSG_TYPE_ADDR_UNREACHABLE; | ||
| msg.content.ptr = addr; | ||
| msg_send(&msg, gnrc_rpl_pid); |
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.
Could this cause an issue if it ends-up blocking the caller (in my case the nimble thread)? We need to use IPC because the rpl data structures aren't thread safe.
| /** | ||
| * @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); | ||
|
|
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.
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 gnrc_rpl_parents list.
We want to mark the parent as unreachable in all dodags.
|
Update: I am keeping the PR open for now, but I am currently exploring an alternative design that could solve most of the above discussion points and make this PR obsolete. |
New PR: #21608. |
Contribution description
Opening this as draft to get some early feedback.
Use the information about closed connections in
nimble/rpbleto mark a parent as unreachable in RPL.See self-review for discussion points.
Testing procedure
Tested on IOT-testbed with 1 root and 5 other nodes -> when connection to parent closes RPL parent timeout is triggered as expected.
Issues/PRs references
Part of #21574.
Depends on #21585.