[ovs-dev] [PATCH ovn] Disable IPv6 prefix reporting if IPv6 PD is disabled

Numan Siddique numans at ovn.org
Mon Apr 27 10:33:55 UTC 2020


On Wed, Apr 22, 2020 at 7:43 PM Lorenzo Bianconi
<lorenzo.bianconi at redhat.com> wrote:
>
> 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 <lorenzo.bianconi at redhat.com>

Thanks Lorenzo. I applied this patch to master.

Numan

> ---
>  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 f02dc5d5e..074beeb50 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 bdb9768d2..485ad087d 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)
>
> --
> 2.25.3
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>


More information about the dev mailing list