From 0e7b8d09d509af71b96343009aee0ac0253868c6 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 15 Oct 2021 15:49:13 +0200 Subject: [PATCH 1/2] gnrc_ipv6_nib: fix setting RIO flags We have to use NDP_OPT_RI_FLAGS_MASK, not NDP_OPT_PI_FLAGS_MASK. This fixes flags always being 0. --- sys/net/gnrc/network_layer/ndp/gnrc_ndp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c b/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c index c48490a27f..aa5acc7f87 100644 --- a/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c +++ b/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c @@ -216,7 +216,7 @@ gnrc_pktsnip_t *gnrc_ndp_opt_ri_build(const ipv6_addr_t *prefix, ndp_opt_ri_t *ri_opt = pkt->data; ri_opt->prefix_len = prefix_len; - ri_opt->flags = (flags & NDP_OPT_PI_FLAGS_MASK); + ri_opt->flags = (flags & NDP_OPT_RI_FLAGS_MASK); ri_opt->route_ltime = byteorder_htonl(route_ltime); /* Bits beyond prefix_len MUST be 0 */ ipv6_addr_set_unspecified(&ri_opt->prefix); From 9d5808d75672364f433df3631a8439cf8e655e3d Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 15 Oct 2021 15:50:45 +0200 Subject: [PATCH 2/2] gnrc/ipv6_auto_subnets: set RIO priority to ZERO This is required for Linux to accept the RIO with this patch: 2001:db8:8000::/33 via fe80::d0e7:ffff:fe46:6b52 dev tap0 proto ra metric 1024 expires 86338sec pref medium 2001:db8::/32 dev tap0 proto kernel metric 256 pref medium before: 2001:db8::/32 dev tap0 proto kernel metric 256 pref medium --- .../gnrc/routing/ipv6_auto_subnets/gnrc_ipv6_auto_subnets.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/net/gnrc/routing/ipv6_auto_subnets/gnrc_ipv6_auto_subnets.c b/sys/net/gnrc/routing/ipv6_auto_subnets/gnrc_ipv6_auto_subnets.c index 6628fb8037..f94fd41d09 100644 --- a/sys/net/gnrc/routing/ipv6_auto_subnets/gnrc_ipv6_auto_subnets.c +++ b/sys/net/gnrc/routing/ipv6_auto_subnets/gnrc_ipv6_auto_subnets.c @@ -310,7 +310,7 @@ static void _configure_subnets(uint8_t subnets, uint8_t start_idx, gnrc_netif_t /* add route information option with new subnet */ tmp = gnrc_ndp_opt_ri_build(&new_prefix, new_prefix_len, valid_ltime, - NDP_OPT_RI_FLAGS_PRF_NONE, ext_opts); + NDP_OPT_RI_FLAGS_PRF_ZERO, ext_opts); if (tmp == NULL) { DEBUG("auto_subnets: No space left in packet buffer. Not adding RIO\n"); } else { @@ -320,8 +320,7 @@ static void _configure_subnets(uint8_t subnets, uint8_t start_idx, gnrc_netif_t /* immediately send an RA with RIO */ if (ext_opts) { - gnrc_ndp_rtr_adv_send(upstream, NULL, - &ipv6_addr_all_nodes_link_local, true, ext_opts); + gnrc_ndp_rtr_adv_send(upstream, NULL, NULL, true, ext_opts); } else { DEBUG("auto_subnets: Options empty, not sending RA\n"); }