Skip to content

Commit

Permalink
Merge pull request RIOT-OS#20418 from xnumad/6ln-onlink-pfx
Browse files Browse the repository at this point in the history
gnrc_ipv6_nib: Ignore PIO with on-link flag
  • Loading branch information
benpicco authored Feb 22, 2024
2 parents f9de5fd + 23d3ccd commit 0b385c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sys/net/gnrc/network_layer/ipv6/nib/nib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1621,7 +1621,9 @@ static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
valid_ltime = byteorder_ntohl(pio->valid_ltime);
pref_ltime = byteorder_ntohl(pio->pref_ltime);
if ((pio->len != NDP_OPT_PI_LEN) || (icmpv6->type != ICMPV6_RTR_ADV) ||
ipv6_addr_is_link_local(&pio->prefix) || (valid_ltime < pref_ltime)) {
ipv6_addr_is_link_local(&pio->prefix) || (valid_ltime < pref_ltime) ||
/* https://datatracker.ietf.org/doc/html/rfc6775#section-5.4 */
(gnrc_netif_is_6ln(netif) && (pio->flags & NDP_OPT_PI_FLAGS_L))) {
DEBUG("nib: ignoring PIO with invalid data\n");
return UINT32_MAX;
}
Expand Down
6 changes: 6 additions & 0 deletions tests/net/gnrc_ipv6_nib_6ln/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,12 @@ static void test_handle_pkt__rtr_adv__success(uint8_t rtr_adv_flags,
TEST_ASSERT_EQUAL_INT(exp_netif.mtu, _mock_netif->ipv6.mtu);
}
state = NULL;
if (pio_flags & NDP_OPT_PI_FLAGS_L) {
pio = false;
/* Should the host erroneously receive a PIO with the L (on-link) flag set,
* then that PIO MUST be ignored.
* - https://datatracker.ietf.org/doc/html/rfc6775#section-5.4 */
}
if (pio) {
if (pio_flags & NDP_OPT_PI_FLAGS_A) {
TEST_ASSERT_MESSAGE(gnrc_netif_ipv6_addr_idx(_mock_netif,
Expand Down

0 comments on commit 0b385c6

Please sign in to comment.