Skip to content

Commit 23d3ccd

Browse files
committed
gnrc_ipv6_nib: Ignore PIO with on-link flag
1 parent d83ec63 commit 23d3ccd

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

  • sys/net/gnrc/network_layer/ipv6/nib
  • tests/net/gnrc_ipv6_nib_6ln

sys/net/gnrc/network_layer/ipv6/nib/nib.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1621,7 +1621,9 @@ static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
16211621
valid_ltime = byteorder_ntohl(pio->valid_ltime);
16221622
pref_ltime = byteorder_ntohl(pio->pref_ltime);
16231623
if ((pio->len != NDP_OPT_PI_LEN) || (icmpv6->type != ICMPV6_RTR_ADV) ||
1624-
ipv6_addr_is_link_local(&pio->prefix) || (valid_ltime < pref_ltime)) {
1624+
ipv6_addr_is_link_local(&pio->prefix) || (valid_ltime < pref_ltime) ||
1625+
/* https://datatracker.ietf.org/doc/html/rfc6775#section-5.4 */
1626+
(gnrc_netif_is_6ln(netif) && (pio->flags & NDP_OPT_PI_FLAGS_L))) {
16251627
DEBUG("nib: ignoring PIO with invalid data\n");
16261628
return UINT32_MAX;
16271629
}

tests/net/gnrc_ipv6_nib_6ln/main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,12 @@ static void test_handle_pkt__rtr_adv__success(uint8_t rtr_adv_flags,
10561056
TEST_ASSERT_EQUAL_INT(exp_netif.mtu, _mock_netif->ipv6.mtu);
10571057
}
10581058
state = NULL;
1059+
if (pio_flags & NDP_OPT_PI_FLAGS_L) {
1060+
pio = false;
1061+
/* Should the host erroneously receive a PIO with the L (on-link) flag set,
1062+
* then that PIO MUST be ignored.
1063+
* - https://datatracker.ietf.org/doc/html/rfc6775#section-5.4 */
1064+
}
10591065
if (pio) {
10601066
if (pio_flags & NDP_OPT_PI_FLAGS_A) {
10611067
TEST_ASSERT_MESSAGE(gnrc_netif_ipv6_addr_idx(_mock_netif,

0 commit comments

Comments
 (0)