zebra: move pbr hash create after update release

Move the pbr hash creation to be after the update release
and dplane install. Now that rules are installed in a separate
dplane pthread, we can have scenarios where we have an interface
flapping and we install/remove rules sufficiently fast enough we
could issue what we think is an update for an identical rule and
end up releasing the rule right after we created it and sent it to
the dplane. This solves the problem of recving duplicate rules
during interface flapping.

Signed-off-by: Stephen Worley <sworley@nvidia.com>
This commit is contained in:
Stephen Worley 2021-01-11 17:30:21 -05:00
parent 8eeca5a201
commit f7692085cb

View File

@ -500,8 +500,6 @@ void zebra_pbr_add_rule(struct zebra_pbr_rule *rule)
*/
found = pbr_rule_lookup_unique(rule);
(void)hash_get(zrouter.rules_hash, rule, pbr_rule_alloc_intern);
/* If found, this is an update */
if (found) {
if (IS_ZEBRA_DEBUG_PBR)
@ -526,6 +524,8 @@ void zebra_pbr_add_rule(struct zebra_pbr_rule *rule)
(void)dplane_pbr_rule_add(rule);
}
(void)hash_get(zrouter.rules_hash, rule, pbr_rule_alloc_intern);
}
void zebra_pbr_del_rule(struct zebra_pbr_rule *rule)