Skip to content

Commit

Permalink
northd: Make the enclose handling less error prone
Browse files Browse the repository at this point in the history
The enclose handling was working for all cases
except the drop. Make sure that the enclose is
properly defined for that case and make sure
that it is used properly.

Fixes: cf205ca ("northd: Fix missig "); " from LB flows")
Signed-off-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
(cherry picked from commit ce7f482)
  • Loading branch information
almusil authored and dceara committed Mar 31, 2023
1 parent 21b9305 commit 943520b
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions northd/northd.c
Original file line number Diff line number Diff line change
Expand Up @@ -9951,6 +9951,7 @@ build_lrouter_nat_flows_for_lb(struct ovn_lb_vip *lb_vip,
lb->selection_fields, false,
features->ct_no_masked_label);
bool drop = !!strncmp(ds_cstr(action), "ct_lb", strlen("ct_lb"));
const char *enclose = drop ? "" : ");";
if (!drop) {
/* Remove the trailing ");". */
ds_truncate(action, action->length - 2);
Expand All @@ -9976,8 +9977,8 @@ build_lrouter_nat_flows_for_lb(struct ovn_lb_vip *lb_vip,
const char *skip_snat = features->ct_lb_related && !drop
? "; skip_snat"
: "";
skip_snat_new_action = xasprintf("flags.skip_snat_for_lb = 1; %s%s);",
ds_cstr(action), skip_snat);
skip_snat_new_action = xasprintf("flags.skip_snat_for_lb = 1; %s%s%s",
ds_cstr(action), skip_snat, enclose);
skip_snat_est_action = xasprintf("flags.skip_snat_for_lb = 1; "
"next;");
}
Expand Down Expand Up @@ -10040,11 +10041,9 @@ build_lrouter_nat_flows_for_lb(struct ovn_lb_vip *lb_vip,
const char *force_snat = features->ct_lb_related && !drop
? "; force_snat"
: "";
force_snat_new_action = xasprintf("flags.force_snat_for_lb = 1; %s%s);",
ds_cstr(action), force_snat);
if (!drop) {
ds_put_cstr(action, ");");
}
force_snat_new_action = xasprintf("flags.force_snat_for_lb = 1; %s%s%s",
ds_cstr(action), force_snat, enclose);
ds_put_cstr(action, enclose);

for (size_t i = 0; i < lb->n_nb_lr; i++) {
struct ovn_datapath *od = lb->nb_lr[i];
Expand Down

0 comments on commit 943520b

Please sign in to comment.