summaryrefslogtreecommitdiff
path: root/zebra/zebra_rnh.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_rnh.c')
-rw-r--r--zebra/zebra_rnh.c67
1 files changed, 32 insertions, 35 deletions
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index d960dbd937..dd3fe17702 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -355,7 +355,8 @@ static int zebra_rnh_apply_nht_rmap(int family, struct route_node *prn,
rmap_family = (family == AF_INET) ? AFI_IP : AFI_IP6;
if (prn && re) {
- for (nexthop = re->nexthop; nexthop; nexthop = nexthop->next) {
+ for (nexthop = re->ng.nexthop; nexthop;
+ nexthop = nexthop->next) {
ret = zebra_nht_route_map_check(rmap_family, proto,
&prn->p, re, nexthop);
if (ret != RMAP_DENYMATCH) {
@@ -373,12 +374,10 @@ static int zebra_rnh_apply_nht_rmap(int family, struct route_node *prn,
* Determine appropriate route (RE entry) resolving a tracked BGP route
* for BGP route for import.
*/
-static
-struct route_entry *zebra_rnh_resolve_import_entry(vrf_id_t vrfid,
- int family,
- struct route_node *nrn,
- struct rnh *rnh,
- struct route_node **prn)
+static struct route_entry *
+zebra_rnh_resolve_import_entry(vrf_id_t vrfid, int family,
+ struct route_node *nrn, struct rnh *rnh,
+ struct route_node **prn)
{
struct route_table *route_table;
struct route_node *rn;
@@ -397,15 +396,15 @@ struct route_entry *zebra_rnh_resolve_import_entry(vrf_id_t vrfid,
/* Unlock route node - we don't need to lock when walking the tree. */
route_unlock_node(rn);
- if (CHECK_FLAG(rnh->flags, ZEBRA_NHT_EXACT_MATCH) &&
- !prefix_same(&nrn->p, &rn->p))
+ if (CHECK_FLAG(rnh->flags, ZEBRA_NHT_EXACT_MATCH)
+ && !prefix_same(&nrn->p, &rn->p))
return NULL;
/* Identify appropriate route entry. */
- RNODE_FOREACH_RE(rn, re) {
- if (!CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED) &&
- CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED) &&
- (re->type != ZEBRA_ROUTE_BGP))
+ RNODE_FOREACH_RE (rn, re) {
+ if (!CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED)
+ && CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED)
+ && (re->type != ZEBRA_ROUTE_BGP))
break;
}
@@ -430,7 +429,7 @@ static void zebra_rnh_eval_import_check_entry(vrf_id_t vrfid, int family,
struct nexthop *nexthop;
if (re && (rnh->state == NULL)) {
- for (ALL_NEXTHOPS(re->nexthop, nexthop))
+ for (ALL_NEXTHOPS(re->ng, nexthop))
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB)) {
state_changed = 1;
break;
@@ -561,7 +560,7 @@ static void zebra_rnh_process_static_routes(vrf_id_t vrfid, int family,
* be having multiple. We care here only about
* registered nexthops.
*/
- for (nexthop = sre->nexthop; nexthop;
+ for (nexthop = sre->ng.nexthop; nexthop;
nexthop = nexthop->next) {
switch (nexthop->type) {
case NEXTHOP_TYPE_IPV4:
@@ -628,11 +627,10 @@ static void zebra_rnh_process_static_routes(vrf_id_t vrfid, int family,
* Determine appropriate route (route entry) resolving a tracked
* nexthop.
*/
-static struct route_entry *zebra_rnh_resolve_nexthop_entry(vrf_id_t vrfid,
- int family,
- struct route_node *nrn,
- struct rnh *rnh,
- struct route_node **prn)
+static struct route_entry *
+zebra_rnh_resolve_nexthop_entry(vrf_id_t vrfid, int family,
+ struct route_node *nrn, struct rnh *rnh,
+ struct route_node **prn)
{
struct route_table *route_table;
struct route_node *rn;
@@ -658,12 +656,12 @@ static struct route_entry *zebra_rnh_resolve_nexthop_entry(vrf_id_t vrfid,
/* Do not resolve over default route unless allowed &&
* match route to be exact if so specified
*/
- if (is_default_prefix(&rn->p) &&
- !rnh_resolve_via_default(rn->p.family))
+ if (is_default_prefix(&rn->p)
+ && !rnh_resolve_via_default(rn->p.family))
return NULL;
/* Identify appropriate route entry. */
- RNODE_FOREACH_RE(rn, re) {
+ RNODE_FOREACH_RE (rn, re) {
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue;
if (!CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED))
@@ -676,11 +674,10 @@ static struct route_entry *zebra_rnh_resolve_nexthop_entry(vrf_id_t vrfid,
if (re->type == ZEBRA_ROUTE_NHRP) {
struct nexthop *nexthop;
- for (nexthop = re->nexthop;
- nexthop;
+ for (nexthop = re->ng.nexthop; nexthop;
nexthop = nexthop->next)
if (nexthop->type
- == NEXTHOP_TYPE_IFINDEX)
+ == NEXTHOP_TYPE_IFINDEX)
break;
if (nexthop)
break;
@@ -779,8 +776,8 @@ static void zebra_rnh_evaluate_entry(vrf_id_t vrfid, int family, int force,
/* Identify route entry (RE) resolving this tracked entry. */
if (type == RNH_IMPORT_CHECK_TYPE)
- re = zebra_rnh_resolve_import_entry(vrfid, family, nrn,
- rnh, &prn);
+ re = zebra_rnh_resolve_import_entry(vrfid, family, nrn, rnh,
+ &prn);
else
re = zebra_rnh_resolve_nexthop_entry(vrfid, family, nrn, rnh,
&prn);
@@ -820,8 +817,8 @@ static void zebra_rnh_clear_nhc_flag(vrf_id_t vrfid, int family,
/* Identify route entry (RIB) resolving this tracked entry. */
if (type == RNH_IMPORT_CHECK_TYPE)
- re = zebra_rnh_resolve_import_entry(vrfid, family, nrn,
- rnh, &prn);
+ re = zebra_rnh_resolve_import_entry(vrfid, family, nrn, rnh,
+ &prn);
else
re = zebra_rnh_resolve_nexthop_entry(vrfid, family, nrn, rnh,
&prn);
@@ -929,8 +926,8 @@ static void free_state(vrf_id_t vrf_id, struct route_entry *re,
return;
/* free RE and nexthops */
- zebra_deregister_rnh_static_nexthops(vrf_id, re->nexthop, rn);
- nexthops_free(re->nexthop);
+ zebra_deregister_rnh_static_nexthops(vrf_id, re->ng.nexthop, rn);
+ nexthops_free(re->ng.nexthop);
XFREE(MTYPE_RE, re);
}
@@ -953,7 +950,7 @@ static void copy_state(struct rnh *rnh, struct route_entry *re,
state->metric = re->metric;
state->vrf_id = re->vrf_id;
- route_entry_copy_nexthops(state, re->nexthop);
+ route_entry_copy_nexthops(state, re->ng.nexthop);
rnh->state = state;
}
@@ -1026,7 +1023,7 @@ static int send_client(struct rnh *rnh, struct zserv *client, rnh_type_t type,
num = 0;
nump = stream_get_endp(s);
stream_putc(s, 0);
- for (nexthop = re->nexthop; nexthop; nexthop = nexthop->next)
+ for (nexthop = re->ng.nexthop; nexthop; nexthop = nexthop->next)
if ((CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB)
|| CHECK_FLAG(nexthop->flags,
NEXTHOP_FLAG_RECURSIVE))
@@ -1119,7 +1116,7 @@ static void print_rnh(struct route_node *rn, struct vty *vty)
if (rnh->state) {
vty_out(vty, " resolved via %s\n",
zebra_route_string(rnh->state->type));
- for (nexthop = rnh->state->nexthop; nexthop;
+ for (nexthop = rnh->state->ng.nexthop; nexthop;
nexthop = nexthop->next)
print_nh(nexthop, vty);
} else