From: Mohammad Heib <[email protected]> currently ovn-northd only handle virtual ports with VIP IPv4 and ignores virtual ports with VIP IPv6.
This patch adds support for virtual ports with VIP IPv6 by adding lflows to the lsp_in_arp_rsp logical switch pipeline. Those lflows handle Neighbor Solicitations and Neighbor Advertisement requests that target the virtual port VIPs and bind the virtual port to the desired VIF. Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2003091 Fixes: 054f4c85c413 ("Add a new logical switch port type - 'virtual'") Signed-off-by: Mohammad Heib <[email protected]> --- northd/northd.c | 52 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/northd/northd.c b/northd/northd.c index d1b87891c..d85036dcc 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -7386,16 +7386,30 @@ build_lswitch_arp_nd_responder_known_ips(struct ovn_port *op, * - ARP reply from the virtual ip which belongs to a logical * port of type 'virtual' and bind that port. * */ - ovs_be32 ip; + + union ip { + ovs_be32 ip; + ovs_u128 ipv6; + }ip; + const char *virtual_ip = smap_get(&op->nbsp->options, "virtual-ip"); const char *virtual_parents = smap_get(&op->nbsp->options, "virtual-parents"); - if (!virtual_ip || !virtual_parents || - !ip_parse(virtual_ip, &ip)) { + if (!virtual_ip || !virtual_parents) { return; } + bool is_ipv4 = strchr(virtual_ip, '.') ? true : false; + if (is_ipv4) { + if (!ip_parse(virtual_ip, &ip.ip)) { + return; + } + } else{ + if (!ipv6_parse(virtual_ip, (struct in6_addr *)&ip.ipv6)) + return; + } + char *tokstr = xstrdup(virtual_parents); char *save_ptr = NULL; char *vparent; @@ -7408,13 +7422,31 @@ build_lswitch_arp_nd_responder_known_ips(struct ovn_port *op, continue; } - ds_clear(match); - ds_put_format(match, "inport == \"%s\" && " - "((arp.op == 1 && arp.spa == %s && " - "arp.tpa == %s) || (arp.op == 2 && " - "arp.spa == %s))", - vparent, virtual_ip, virtual_ip, - virtual_ip); + if (is_ipv4) { + ds_clear(match); + ds_put_format(match, "inport == \"%s\" && " + "((arp.op == 1 && arp.spa == %s && " + "arp.tpa == %s) || (arp.op == 2 && " + "arp.spa == %s))", + vparent, virtual_ip, virtual_ip, + virtual_ip); + } else{ + struct ipv6_netaddr na; + /* Find VIP multicast group */ + in6_addr_solicited_node(&na.sn_addr, (struct in6_addr *)&ip.ipv6); + inet_ntop(AF_INET6, &na.sn_addr, na.sn_addr_s, sizeof na.sn_addr_s); + + ds_clear(match); + ds_put_format(match, "inport == \"%s\" && " + "((nd_ns && ip6.dst == {%s, %s} && nd.target == %s) ||" + "(nd_na && nd.target == %s))", + vparent, + virtual_ip, + na.sn_addr_s, + virtual_ip, + virtual_ip); + } + ds_clear(actions); ds_put_format(actions, "bind_vport(%s, inport); " -- 2.27.0 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
