With the addition of IPv6 routing, there won't be much need to special-case not parsing IPv6 addresses.
Signed-off-by: Justin Pettit <jpet...@ovn.org> --- ovn/controller/pinctrl.c | 2 +- ovn/lib/ovn-util.c | 22 +++------------------- ovn/lib/ovn-util.h | 3 +-- ovn/northd/ovn-northd.c | 10 ++++------ 4 files changed, 9 insertions(+), 28 deletions(-) diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c index 5f0fd81..1370301 100644 --- a/ovn/controller/pinctrl.c +++ b/ovn/controller/pinctrl.c @@ -734,7 +734,7 @@ send_garp_update(const struct sbrec_port_binding *binding_rec, int i; for (i = 0; i < binding_rec->n_mac; i++) { struct lport_addresses laddrs; - if (!extract_lsp_addresses(binding_rec->mac[i], &laddrs, false) + if (!extract_lsp_addresses(binding_rec->mac[i], &laddrs) || !laddrs.n_ipv4_addrs) { continue; } diff --git a/ovn/lib/ovn-util.c b/ovn/lib/ovn-util.c index 5499c45..f732b85 100644 --- a/ovn/lib/ovn-util.c +++ b/ovn/lib/ovn-util.c @@ -23,30 +23,14 @@ VLOG_DEFINE_THIS_MODULE(ovn_util); * Extracts the mac, ipv4 and ipv6 addresses from the input param 'address' * which should be of the format 'MAC [IP1 IP2 ..]" where IPn should be * a valid IPv4 or IPv6 address and stores them in the 'ipv4_addrs' and - * 'ipv6_addrs' fields of input param 'laddrs'. If input param - * 'store_ipv6' is true only then extracted ipv6 addresses are stored in - * 'ipv6_addrs' fields. + * 'ipv6_addrs' fields of input param 'laddrs'. * * Return true if at least 'MAC' is found in 'address', false otherwise. * * The caller must call destroy_lport_addresses(). - * - * Eg 1. - * If 'address' = '00:00:00:00:00:01 10.0.0.4 fe80::ea2a:eaff:fe28:3390/64 - * 30.0.0.3/23' and 'store_ipv6' = true - * then returns true with laddrs->n_ipv4_addrs = 2, naddrs->n_ipv6_addrs = 1. - * - * Eg. 2 - * If 'address' = '00:00:00:00:00:01 10.0.0.4 fe80::ea2a:eaff:fe28:3390/64 - * 30.0.0.3/23' and 'store_ipv6' = false - * then returns true with laddrs->n_ipv4_addrs = 2, naddrs->n_ipv6_addrs = 0. - * - * Eg 3. If 'address' = '00:00:00:00:00:01 10.0.0.4 addr 30.0.0.4', then - * returns true with laddrs->n_ipv4_addrs = 1 and laddrs->n_ipv6_addrs = 0. */ bool -extract_lsp_addresses(char *address, struct lport_addresses *laddrs, - bool store_ipv6) +extract_lsp_addresses(char *address, struct lport_addresses *laddrs) { memset(laddrs, 0, sizeof *laddrs); @@ -95,7 +79,7 @@ extract_lsp_addresses(char *address, struct lport_addresses *laddrs, } free(error); error = ipv6_parse_cidr_len(buf, &buf_index, &ip6, &plen); - if (!error && store_ipv6) { + if (!error) { laddrs->n_ipv6_addrs++; laddrs->ipv6_addrs = xrealloc( laddrs->ipv6_addrs, diff --git a/ovn/lib/ovn-util.h b/ovn/lib/ovn-util.h index 318b082..83bfbb3 100644 --- a/ovn/lib/ovn-util.h +++ b/ovn/lib/ovn-util.h @@ -49,8 +49,7 @@ struct lport_addresses { }; -bool extract_lsp_addresses(char *address, struct lport_addresses *laddrs, - bool store_ipv6); +bool extract_lsp_addresses(char *address, struct lport_addresses *); void destroy_lport_addresses(struct lport_addresses *); char *alloc_nat_zone_key(const char *key, const char *type); diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index de88806..2fba68f 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -1101,7 +1101,7 @@ build_port_security_nd(struct ovn_port *op, struct hmap *lflows) { for (size_t i = 0; i < op->nbs->n_port_security; i++) { struct lport_addresses ps; - if (!extract_lsp_addresses(op->nbs->port_security[i], &ps, true)) { + if (!extract_lsp_addresses(op->nbs->port_security[i], &ps)) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1); VLOG_INFO_RL(&rl, "invalid syntax '%s' in port security. No MAC" " address found", op->nbs->port_security[i]); @@ -1195,7 +1195,7 @@ build_port_security_ip(enum ovn_pipeline pipeline, struct ovn_port *op, for (size_t i = 0; i < op->nbs->n_port_security; i++) { struct lport_addresses ps; - if (!extract_lsp_addresses(op->nbs->port_security[i], &ps, true)) { + if (!extract_lsp_addresses(op->nbs->port_security[i], &ps)) { continue; } @@ -1831,8 +1831,7 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports, for (size_t i = 0; i < op->nbs->n_addresses; i++) { struct lport_addresses laddrs; - if (!extract_lsp_addresses(op->nbs->addresses[i], &laddrs, - true)) { + if (!extract_lsp_addresses(op->nbs->addresses[i], &laddrs)) { continue; } for (size_t j = 0; j < laddrs.n_ipv4_addrs; j++) { @@ -2550,8 +2549,7 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, for (size_t i = 0; i < op->nbs->n_addresses; i++) { struct lport_addresses laddrs; - if (!extract_lsp_addresses(op->nbs->addresses[i], &laddrs, - false)) { + if (!extract_lsp_addresses(op->nbs->addresses[i], &laddrs)) { continue; } -- 1.9.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev