diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-06-01 13:26:25 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-06-01 14:00:05 +0200 |
commit | f0f77c9a590bf538033602a0b2da6084c9ea22e2 (patch) | |
tree | 80113c30accb622589bcd67ef25fdda17fba0189 /zebra/zebra_mpls.c | |
parent | Merge pull request #634 from dwalton76/bgp-ipv6-nexthop-ll-and-global-takeII (diff) | |
download | frr-f0f77c9a590bf538033602a0b2da6084c9ea22e2.tar.xz frr-f0f77c9a590bf538033602a0b2da6084c9ea22e2.zip |
zebra: Refactor 'struct rib' to be 'struct route_entry'
The 'struct rib' data structure is missnamed. It really
is a 'struct route_entry' as part of the 'struct route_node'.
We have 1 'struct route_entry' per route src. As such
1 route node can have multiple route entries if multiple
protocols attempt to install the same route.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_mpls.c')
-rw-r--r-- | zebra/zebra_mpls.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index b547c6256..db02a025f 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -65,7 +65,7 @@ static u_int32_t fec_derive_label_from_index (struct zebra_vrf *vrf, zebra_fec_t *fec); static int lsp_install (struct zebra_vrf *zvrf, mpls_label_t label, - struct route_node *rn, struct rib *rib); + struct route_node *rn, struct route_entry *re); static int lsp_uninstall (struct zebra_vrf *zvrf, mpls_label_t label); static int @@ -168,7 +168,7 @@ mpls_processq_init (struct zebra_t *zebra); */ static int lsp_install (struct zebra_vrf *zvrf, mpls_label_t label, - struct route_node *rn, struct rib *rib) + struct route_node *rn, struct route_entry *re) { struct hash *lsp_table; zebra_ile_t tmp_ile; @@ -184,7 +184,7 @@ lsp_install (struct zebra_vrf *zvrf, mpls_label_t label, if (!lsp_table) return -1; - lsp_type = lsp_type_from_rib_type (rib->type); + lsp_type = lsp_type_from_re_type (re->type); added = changed = 0; /* Locate or allocate LSP entry. */ @@ -198,7 +198,7 @@ lsp_install (struct zebra_vrf *zvrf, mpls_label_t label, * the label advertised by the recursive nexthop (plus we don't have the * logic yet to push multiple labels). */ - for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next) + for (nexthop = re->nexthop; nexthop; nexthop = nexthop->next) { /* Skip inactive and recursive entries. */ if (!CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE)) @@ -441,7 +441,7 @@ fec_change_update_lsp (struct zebra_vrf *zvrf, zebra_fec_t *fec, mpls_label_t ol { struct route_table *table; struct route_node *rn; - struct rib *rib; + struct route_entry *re; afi_t afi; /* Uninstall label forwarding entry, if previously installed. */ @@ -464,16 +464,16 @@ fec_change_update_lsp (struct zebra_vrf *zvrf, zebra_fec_t *fec, mpls_label_t ol if (!rn) return 0; - RNODE_FOREACH_RIB (rn, rib) + RNODE_FOREACH_RE (rn, re) { - if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)) + if (CHECK_FLAG (re->flags, ZEBRA_FLAG_SELECTED)) break; } - if (!rib || !zebra_rib_labeled_unicast (rib)) + if (!re || !zebra_rib_labeled_unicast (re)) return 0; - if (lsp_install (zvrf, fec->label, rn, rib)) + if (lsp_install (zvrf, fec->label, rn, re)) return -1; return 0; @@ -656,7 +656,7 @@ nhlfe_nexthop_active_ipv4 (zebra_nhlfe_t *nhlfe, struct nexthop *nexthop) struct route_table *table; struct prefix_ipv4 p; struct route_node *rn; - struct rib *match; + struct route_entry *match; struct nexthop *match_nh; table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT); @@ -676,9 +676,9 @@ nhlfe_nexthop_active_ipv4 (zebra_nhlfe_t *nhlfe, struct nexthop *nexthop) route_unlock_node (rn); /* Locate a valid connected route. */ - RNODE_FOREACH_RIB (rn, match) + RNODE_FOREACH_RE (rn, match) { - if (CHECK_FLAG (match->status, RIB_ENTRY_REMOVED) || + if (CHECK_FLAG (match->status, ROUTE_ENTRY_REMOVED) || !CHECK_FLAG (match->flags, ZEBRA_FLAG_SELECTED)) continue; @@ -708,7 +708,7 @@ nhlfe_nexthop_active_ipv6 (zebra_nhlfe_t *nhlfe, struct nexthop *nexthop) struct route_table *table; struct prefix_ipv6 p; struct route_node *rn; - struct rib *match; + struct route_entry *match; table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, VRF_DEFAULT); if (!table) @@ -727,10 +727,10 @@ nhlfe_nexthop_active_ipv6 (zebra_nhlfe_t *nhlfe, struct nexthop *nexthop) route_unlock_node (rn); /* Locate a valid connected route. */ - RNODE_FOREACH_RIB (rn, match) + RNODE_FOREACH_RE (rn, match) { if ((match->type == ZEBRA_ROUTE_CONNECT) && - !CHECK_FLAG (match->status, RIB_ENTRY_REMOVED) && + !CHECK_FLAG (match->status, ROUTE_ENTRY_REMOVED) && CHECK_FLAG (match->flags, ZEBRA_FLAG_SELECTED)) break; } @@ -1809,7 +1809,7 @@ mpls_label2str (u_int8_t num_labels, mpls_label_t *labels, * Install dynamic LSP entry. */ int -zebra_mpls_lsp_install (struct zebra_vrf *zvrf, struct route_node *rn, struct rib *rib) +zebra_mpls_lsp_install (struct zebra_vrf *zvrf, struct route_node *rn, struct route_entry *re) { struct route_table *table; zebra_fec_t *fec; @@ -1829,7 +1829,7 @@ zebra_mpls_lsp_install (struct zebra_vrf *zvrf, struct route_node *rn, struct ri if (fec->label == MPLS_IMP_NULL_LABEL) return 0; - if (lsp_install (zvrf, fec->label, rn, rib)) + if (lsp_install (zvrf, fec->label, rn, re)) return -1; return 0; @@ -1839,7 +1839,7 @@ zebra_mpls_lsp_install (struct zebra_vrf *zvrf, struct route_node *rn, struct ri * Uninstall dynamic LSP entry, if any. */ int -zebra_mpls_lsp_uninstall (struct zebra_vrf *zvrf, struct route_node *rn, struct rib *rib) +zebra_mpls_lsp_uninstall (struct zebra_vrf *zvrf, struct route_node *rn, struct route_entry *re) { struct route_table *table; zebra_fec_t *fec; @@ -2296,7 +2296,7 @@ mpls_ftn_update (int add, struct zebra_vrf *zvrf, enum lsp_types_t type, { struct route_table *table; struct route_node *rn; - struct rib *rib; + struct route_entry *re; struct nexthop *nexthop; /* Lookup table. */ @@ -2306,18 +2306,18 @@ mpls_ftn_update (int add, struct zebra_vrf *zvrf, enum lsp_types_t type, /* Lookup existing route */ rn = route_node_get (table, prefix); - RNODE_FOREACH_RIB (rn, rib) + RNODE_FOREACH_RE (rn, re) { - if (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED)) + if (CHECK_FLAG (re->status, ROUTE_ENTRY_REMOVED)) continue; - if (rib->distance == distance) + if (re->distance == distance) break; } - if (rib == NULL) + if (re == NULL) return -1; - for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next) + for (nexthop = re->nexthop; nexthop; nexthop = nexthop->next) { switch (nexthop->type) { @@ -2356,8 +2356,8 @@ mpls_ftn_update (int add, struct zebra_vrf *zvrf, enum lsp_types_t type, else return 0; - SET_FLAG (rib->status, RIB_ENTRY_CHANGED); - SET_FLAG (rib->status, RIB_ENTRY_NEXTHOPS_CHANGED); + SET_FLAG (re->status, ROUTE_ENTRY_CHANGED); + SET_FLAG (re->status, ROUTE_ENTRY_NEXTHOPS_CHANGED); rib_queue_add (rn); return 0; @@ -2534,7 +2534,7 @@ mpls_ldp_ftn_uninstall_all (struct zebra_vrf *zvrf, int afi) { struct route_table *table; struct route_node *rn; - struct rib *rib; + struct route_entry *re; struct nexthop *nexthop; int update; @@ -2546,13 +2546,13 @@ mpls_ldp_ftn_uninstall_all (struct zebra_vrf *zvrf, int afi) for (rn = route_top (table); rn; rn = route_next (rn)) { update = 0; - RNODE_FOREACH_RIB (rn, rib) - for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next) + RNODE_FOREACH_RE (rn, re) + for (nexthop = re->nexthop; nexthop; nexthop = nexthop->next) if (nexthop->nh_label_type == ZEBRA_LSP_LDP) { nexthop_del_labels (nexthop); - SET_FLAG (rib->status, RIB_ENTRY_CHANGED); - SET_FLAG (rib->status, RIB_ENTRY_NEXTHOPS_CHANGED); + SET_FLAG (re->status, ROUTE_ENTRY_CHANGED); + SET_FLAG (re->status, ROUTE_ENTRY_NEXTHOPS_CHANGED); update = 1; } |