summaryrefslogtreecommitdiffstats
path: root/staticd/static_nht.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2021-07-09 21:55:29 +0200
committerIgor Ryzhov <iryzhov@nfware.com>2021-07-09 21:58:45 +0200
commit4067e951407bbbdcdb8f4edb9c64763cd777476d (patch)
tree75c13be9ee6a60f7da70edd4aa5eae570188d0fc /staticd/static_nht.c
parentMerge pull request #8997 from donaldsharp/opaque_length (diff)
downloadfrr-4067e951407bbbdcdb8f4edb9c64763cd777476d.tar.xz
frr-4067e951407bbbdcdb8f4edb9c64763cd777476d.zip
staticd: simplify the northbound code
Add a couple of back pointers to static route/path/nexthop structures to simplify the NB code and save ~200 lines. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'staticd/static_nht.c')
-rw-r--r--staticd/static_nht.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/staticd/static_nht.c b/staticd/static_nht.c
index d42c5c277..e1d6ba15d 100644
--- a/staticd/static_nht.c
+++ b/staticd/static_nht.c
@@ -30,10 +30,9 @@
#include "static_zebra.h"
#include "static_nht.h"
-static void static_nht_update_path(struct route_node *rn,
- struct static_path *pn, struct prefix *nhp,
+static void static_nht_update_path(struct static_path *pn, struct prefix *nhp,
uint32_t nh_num, vrf_id_t nh_vrf_id,
- struct vrf *vrf, safi_t safi)
+ struct vrf *vrf)
{
struct static_nexthop *nh;
@@ -57,7 +56,7 @@ static void static_nht_update_path(struct route_node *rn,
nh->nh_valid = !!nh_num;
if (nh->state == STATIC_START)
- static_zebra_route_add(rn, pn, safi, true);
+ static_zebra_route_add(pn, true);
}
}
@@ -84,8 +83,8 @@ static void static_nht_update_safi(struct prefix *sp, struct prefix *nhp,
if (rn && rn->info) {
si = static_route_info_from_rnode(rn);
frr_each(static_path_list, &si->path_list, pn) {
- static_nht_update_path(rn, pn, nhp, nh_num,
- nh_vrf_id, vrf, safi);
+ static_nht_update_path(pn, nhp, nh_num,
+ nh_vrf_id, vrf);
}
route_unlock_node(rn);
}
@@ -97,8 +96,7 @@ static void static_nht_update_safi(struct prefix *sp, struct prefix *nhp,
if (!si)
continue;
frr_each(static_path_list, &si->path_list, pn) {
- static_nht_update_path(rn, pn, nhp, nh_num, nh_vrf_id,
- vrf, safi);
+ static_nht_update_path(pn, nhp, nh_num, nh_vrf_id, vrf);
}
}
}