summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2021-04-24 03:31:11 +0200
committerDonald Sharp <sharpd@nvidia.com>2021-05-12 13:33:08 +0200
commitdb1fcc98dadd679de004c3468b3af8494a122e60 (patch)
treef11a6b508a9a26c4c75280aea4b3c6583732f41e /bgpd
parentbgpd: reduce cut-n-paste code in bgp_pbr.c (diff)
downloadfrr-db1fcc98dadd679de004c3468b3af8494a122e60.tar.xz
frr-db1fcc98dadd679de004c3468b3af8494a122e60.zip
bgpd: reduce cut-n-paste of bgp_zebra_announce_default for install
This bit of code was cut-n-pasted all over the place: if (!bpa->installed && !bpa->install_in_progress) { bgp_send_pbr_rule_action(bpa, NULL, true); bgp_zebra_announce_default(bgp, nh, bpa->afi, bpa->table_id, true); } Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_pbr.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/bgpd/bgp_pbr.c b/bgpd/bgp_pbr.c
index e2e094d0b..27d868afa 100644
--- a/bgpd/bgp_pbr.c
+++ b/bgpd/bgp_pbr.c
@@ -1082,6 +1082,15 @@ static void bgp_pbr_bpa_remove(struct bgp_pbr_action *bpa)
}
}
+static void bgp_pbr_bpa_add(struct bgp_pbr_action *bpa)
+{
+ if (!bpa->installed && !bpa->install_in_progress) {
+ bgp_send_pbr_rule_action(bpa, NULL, true);
+ bgp_zebra_announce_default(bpa->bgp, &bpa->nh, bpa->afi,
+ bpa->table_id, true);
+ }
+}
+
static void bgp_pbr_action_free(void *arg)
{
struct bgp_pbr_action *bpa = arg;
@@ -2356,12 +2365,9 @@ static void bgp_pbr_policyroute_add_to_zebra_unit(struct bgp *bgp,
return;
}
}
- if (!bpa->installed && !bpa->install_in_progress) {
- bgp_send_pbr_rule_action(bpa, NULL, true);
- bgp_zebra_announce_default(bgp, nh,
- bpa->afi,
- bpa->table_id, true);
- }
+
+ bgp_pbr_bpa_add(bpa);
+
/* ip rule add */
if (bpr && !bpr->installed)
bgp_send_pbr_rule_action(bpa, bpr, true);
@@ -2529,11 +2535,7 @@ static void bgp_pbr_policyroute_add_to_zebra_unit(struct bgp *bgp,
* it will be suppressed subsequently
*/
/* ip rule add */
- if (!bpa->installed && !bpa->install_in_progress) {
- bgp_send_pbr_rule_action(bpa, NULL, true);
- bgp_zebra_announce_default(bgp, nh,
- bpa->afi, bpa->table_id, true);
- }
+ bgp_pbr_bpa_add(bpa);
/* ipset create */
if (!bpm->installed)