From a2827e552226e95c2320c98d1509257ff4393756 Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi Date: Wed, 22 Apr 2020 16:13:03 +0200 Subject: [PATCH] Disable IPv6 prefix reporting if IPv6 PD is disabled Disable IPv6 prefix delegation reporting in Logical_Router_Port table if IPv6 prefix delegation state machine has been disabled for the related logical router port Signed-off-by: Lorenzo Bianconi Signed-off-by: 0-day Robot --- northd/ovn-northd.c | 28 ++++++++++++++++------------ tests/system-ovn.at | 7 +++++++ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index f02dc5d5e5..074beeb50c 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -2701,6 +2701,10 @@ ovn_update_ipv6_prefix(struct hmap *ports) continue; } + if (!smap_get_bool(&op->nbrp->options, "prefix", false)) { + continue; + } + char prefix[IPV6_SCAN_LEN + 6]; unsigned aid; const char *ipv6_pd_list = smap_get(&op->sb->options, @@ -9346,22 +9350,22 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, } struct smap options; + smap_clone(&options, &op->sb->options); + /* enable IPv6 prefix delegation */ bool prefix_delegation = smap_get_bool(&op->nbrp->options, "prefix_delegation", false); - if (prefix_delegation) { - smap_clone(&options, &op->sb->options); - smap_add(&options, "ipv6_prefix_delegation", "true"); - sbrec_port_binding_set_options(op->sb, &options); - smap_destroy(&options); - } + smap_add(&options, "ipv6_prefix_delegation", + prefix_delegation ? "true" : "false"); + sbrec_port_binding_set_options(op->sb, &options); - if (smap_get_bool(&op->nbrp->options, "prefix", false)) { - smap_clone(&options, &op->sb->options); - smap_add(&options, "ipv6_prefix", "true"); - sbrec_port_binding_set_options(op->sb, &options); - smap_destroy(&options); - } + bool ipv6_prefix = smap_get_bool(&op->nbrp->options, + "prefix", false); + smap_add(&options, "ipv6_prefix", + ipv6_prefix ? "true" : "false"); + sbrec_port_binding_set_options(op->sb, &options); + + smap_destroy(&options); const char *address_mode = smap_get( &op->nbrp->ipv6_ra_configs, "address_mode"); diff --git a/tests/system-ovn.at b/tests/system-ovn.at index bdb9768d26..485ad087d3 100644 --- a/tests/system-ovn.at +++ b/tests/system-ovn.at @@ -3920,6 +3920,13 @@ OVS_WAIT_UNTIL([ test "${total_pkts}" = "1" ]) +ovn-nbctl set logical_router_port rp-sw0 options:prefix=false +ovn-nbctl clear logical_router_port rp-sw0 ipv6_prefix +OVS_WAIT_WHILE([test "$(ovn-nbctl get logical_router_port rp-sw0 ipv6_prefix | cut -c3-16)" = "[2001:1db8:3333]"]) +AT_CHECK([ovn-nbctl get logical_router_port rp-sw0 ipv6_prefix | cut -c3-16], [0], [dnl +[] +]) + kill $(pidof tcpdump) kill $(pidof ovn-controller)