]> git.proxmox.com Git - ovs.git/commitdiff
ovn-nbctl: Don't segfault when ovn-northd doesn't configure dynamic addresses.
authorJustin Pettit <jpettit@ovn.org>
Mon, 4 Mar 2019 22:28:58 +0000 (14:28 -0800)
committerJustin Pettit <jpettit@ovn.org>
Wed, 13 Mar 2019 19:42:34 +0000 (12:42 -0700)
When ovn-nbctl is used to configure a logical switch port's addresses, it
does a sanity-check to make sure that a duplicate address isn't being
used.  If a port is configured as "dynamic", ovn-northd is supposed to
populate the "dynamic_addresses" column in the Logical_Switch_Port
table.  If it isn't ovn-nbctl, would dereference a null pointer as part
of the duplicate address check.  This patch checks that "dynamic_addresses"
is actually set first.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
ovn/utilities/ovn-nbctl.c

index cca7dbaa15fbb5a88f5dace88bd747723ac3e7e5..aa5aa32420c39b318ae6366f27a787e1c2437555 100644 (file)
@@ -1488,7 +1488,7 @@ lsp_contains_duplicates(const struct nbrec_logical_switch *ls,
         for (size_t j = 0; j < lsp_test->n_addresses; j++) {
             struct lport_addresses laddrs_test;
             char *addr = lsp_test->addresses[j];
-            if (is_dynamic_lsp_address(addr)) {
+            if (is_dynamic_lsp_address(addr) && lsp_test->dynamic_addresses) {
                 addr = lsp_test->dynamic_addresses;
             }
             if (extract_lsp_addresses(addr, &laddrs_test)) {