Skip to content

Commit

Permalink
ovn: Add router load balancer undnat rule for IPv6
Browse files Browse the repository at this point in the history
When configuring a router port to have a redirect-chassis and using an
IPv6 load balancer rule that specifies a TCP/UDP port, load balancing
would not work as expected. This is because a rule to un-dnat the return
traffic from the load balancer destination was not installed. This is
because this rule was only being installed for IPv4 load balancers.

This change adds the same rule for IPv6 load balancers as well.

Signed-off-by: Mark Michelson <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
putnopvut authored and blp committed Jul 6, 2018
1 parent 814b1d4 commit 215da44
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ovn/northd/ovn-northd.c
Original file line number Diff line number Diff line change
Expand Up @@ -4659,8 +4659,7 @@ add_router_lb_flow(struct hmap *lflows, struct ovn_datapath *od,
free(new_match);
free(est_match);

if (!od->l3dgw_port || !od->l3redirect_port || !backend_ips
|| addr_family != AF_INET) {
if (!od->l3dgw_port || !od->l3redirect_port || !backend_ips) {
return;
}

Expand All @@ -4669,7 +4668,11 @@ add_router_lb_flow(struct hmap *lflows, struct ovn_datapath *od,
* router has a gateway router port associated.
*/
struct ds undnat_match = DS_EMPTY_INITIALIZER;
ds_put_cstr(&undnat_match, "ip4 && (");
if (addr_family == AF_INET) {
ds_put_cstr(&undnat_match, "ip4 && (");
} else {
ds_put_cstr(&undnat_match, "ip6 && (");
}
char *start, *next, *ip_str;
start = next = xstrdup(backend_ips);
ip_str = strsep(&next, ",");
Expand All @@ -4684,7 +4687,11 @@ add_router_lb_flow(struct hmap *lflows, struct ovn_datapath *od,
break;
}

ds_put_format(&undnat_match, "(ip4.src == %s", ip_address);
if (addr_family_ == AF_INET) {
ds_put_format(&undnat_match, "(ip4.src == %s", ip_address);
} else {
ds_put_format(&undnat_match, "(ip6.src == %s", ip_address);
}
free(ip_address);
if (port) {
ds_put_format(&undnat_match, " && %s.src == %d) || ",
Expand Down

0 comments on commit 215da44

Please sign in to comment.