Message ID | 20190304223538.125408-1-jpettit@ovn.org |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev] ovn-nbctl: Don't segfault when ovn-northd doesn't configure dynamic addresses. | expand |
On Mon, Mar 04, 2019 at 02:35:38PM -0800, Justin Pettit wrote: > 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>
On Mon, Mar 4, 2019 at 10:52 PM Justin Pettit <jpettit@ovn.org> wrote: > > 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> > --- > ovn/utilities/ovn-nbctl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c > index 8a72e95741e2..2727b410a154 100644 > --- a/ovn/utilities/ovn-nbctl.c > +++ b/ovn/utilities/ovn-nbctl.c > @@ -1489,7 +1489,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)) { > -- > 2.17.1 Looks good to me. Acked-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
> On Mar 4, 2019, at 3:38 PM, Ben Pfaff <blp@ovn.org> wrote: > > On Mon, Mar 04, 2019 at 02:35:38PM -0800, Justin Pettit wrote: >> 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> Thanks. I pushed this to master and branch-2.11. --Justin
diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index 8a72e95741e2..2727b410a154 100644 --- a/ovn/utilities/ovn-nbctl.c +++ b/ovn/utilities/ovn-nbctl.c @@ -1489,7 +1489,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)) {
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> --- ovn/utilities/ovn-nbctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)