[ovs-dev] [ovn-ipv6 13/26] ovn-northd: Use strings from extract_lsp_addresses().

Ben Pfaff blp at ovn.org
Wed Jul 13 03:23:06 UTC 2016


On Mon, Jul 11, 2016 at 11:56:43PM -0700, Justin Pettit wrote:
> Extract port security and logical switch port addresses once and store
> them as part of the ovn_port structure.  Use the string representations
> from the extracted addresses.
> 
> Signed-off-by: Justin Pettit <jpettit at ovn.org>

In build_port_security_l2(), you can combine the following two calls
into one:
> +        ds_put_format(match, "%s", ps_addrs[i].ea_s);
> +        ds_put_char(match, ' ');

In build_port_security_nd(), this can use ds_put_cstr():
+                        ds_put_format(&match, "%s", ps->ipv4_addrs[i].addr_s);

This bit of build_lswitch_flows() would probably benefit from {...}
notation:
                if (op->lsp_addrs[i].n_ipv6_addrs == 1) {
                    ds_put_format(&match, "nd.target == %s",
                                  op->lsp_addrs[i].ipv6_addrs[0].addr_s);
                } else {
                    ds_put_cstr(&match, "(");
                    for (size_t j = 0; j < op->lsp_addrs[i].n_ipv6_addrs; j++) {
                        ds_put_format(&match, "nd.target == %s || ",
                                      op->lsp_addrs[i].ipv6_addrs[j].addr_s);
                    }
                    ds_chomp(&match, ' ');
                    ds_chomp(&match, '|');
                    ds_chomp(&match, '|');
                    ds_chomp(&match, ' ');
                    ds_put_cstr(&match, ")");
                }


Does anything in this series rename 'json_key' to 'key_s'?  It may be
the consistent thing to do.

Acked-by: Ben Pfaff <blp at ovn.org>



More information about the dev mailing list