From f7692085cb040e1900986e9eb02d30a196be1e98 Mon Sep 17 00:00:00 2001 From: Stephen Worley Date: Mon, 11 Jan 2021 17:30:21 -0500 Subject: [PATCH] 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 --- zebra/zebra_pbr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zebra/zebra_pbr.c b/zebra/zebra_pbr.c index 924aed023d..87ab900092 100644 --- a/zebra/zebra_pbr.c +++ b/zebra/zebra_pbr.c @@ -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) -- 2.39.5