From 5dce0de78552da07577dbb2db4d42f47a2b6b79c Mon Sep 17 00:00:00 2001 From: "James R. Leu" Date: Tue, 17 Jun 2003 21:09:02 -0600 Subject: [PATCH] Create a ldp_nexthop which mirrors the functionality of mpls_nexthop but store pointers to LDP structures. [git-p4: depot-paths = "//depot/ldp-portable/": change = 372] --- ldp/ldp_attr.c | 38 +++++++++++++++++++++++++++ ldp/ldp_attr.h | 3 +++ ldp/ldp_cfg.c | 16 ++++++++++-- ldp/ldp_cfg.h | 2 +- ldp/ldp_fec.c | 8 +++--- ldp/ldp_global.c | 16 ++++++++++++ ldp/ldp_global.h | 2 ++ ldp/ldp_label_mapping.c | 14 ++++------ ldp/ldp_label_mapping.h | 2 +- ldp/ldp_label_request.c | 8 +++--- ldp/ldp_notif.c | 4 +-- ldp/ldp_outlabel.c | 69 +++++++++++++++++++++++++++++++------------------ ldp/ldp_outlabel.h | 9 +++---- ldp/ldp_struct.h | 27 ++++++++++++++++--- 14 files changed, 158 insertions(+), 60 deletions(-) diff --git a/ldp/ldp_attr.c b/ldp/ldp_attr.c index 270eee1..b0d2a13 100644 --- a/ldp/ldp_attr.c +++ b/ldp/ldp_attr.c @@ -80,6 +80,20 @@ void ldp_attr_del_us2ds(ldp_attr * us, ldp_attr * ds) } } +void ldp_attr_add_fec(ldp_attr *a, ldp_fec *fec) { + MPLS_ASSERT(a && fec); + MPLS_REFCNT_HOLD(fec); + a->fec = fec; +} + +void ldp_attr_del_fec(ldp_attr *a) { + MPLS_ASSERT(a); + if (a->fec) { + MPLS_REFCNT_RELEASE(a->fec, ldp_fec_delete); + a->fec = NULL; + } +} + void ldp_attr_add_us2ds(ldp_attr * us, ldp_attr * ds) { @@ -538,6 +552,7 @@ mpls_return_enum ldp_attr_insert_upstream(ldp_global * g, ldp_session * s, } ldp_attr_add_session(a, s); + ldp_attr_add_fec(a, fnode); retval = _ldp_fs_add_attr(fs, a); _ldp_global_add_attr(g, a); @@ -566,6 +581,7 @@ mpls_return_enum ldp_attr_insert_downstream(ldp_global * g, ldp_session * s, } ldp_attr_add_session(a, s); + ldp_attr_add_fec(a, fnode); retval = _ldp_fs_add_attr(fs, a); _ldp_global_add_attr(g, a); @@ -634,6 +650,7 @@ void ldp_attr_delete_upstream(ldp_global * g, ldp_session * s, ldp_attr * a) } ldp_attr_del_session(a); + ldp_attr_del_fec(a); if (_ldp_fs_del_attr(fs, a) == MPLS_BOOL_TRUE) { _ldp_fec_del_fs_us(fnode, fs); @@ -661,6 +678,7 @@ void ldp_attr_delete_downstream(ldp_global * g, ldp_session * s, ldp_attr * a) } ldp_attr_del_session(a); + ldp_attr_del_fec(a); if (_ldp_fs_del_attr(fs, a) == MPLS_BOOL_TRUE) { _ldp_fec_del_fs_ds(fnode, fs); @@ -778,6 +796,26 @@ ldp_fec *_ldp_attr_get_fec2(ldp_global * g, mpls_fec * f, mpls_bool flag) /* this FEC doesn't exist in the tree yet, create one ... */ fnode = ldp_fec_create(); mpls_fec2ldp_fec(f, fnode); + if (f->nh.type & MPLS_NH_IP) { + fnode->nh.addr = NULL; + mpls_tree_get(g->addr_tree, f->nh.ip.u.ipv4, 32, (void**)&fnode->nh.addr); + if (fnode->nh.addr) { + fnode->nh.type |= MPLS_NH_IP; + } + } + if (f->nh.type & MPLS_NH_IF) { + fnode->nh.iff = ldp_global_find_if_handle(g, f->nh.if_handle); + if (fnode->nh.iff) { + fnode->nh.type |= MPLS_NH_IF; + } + } + if (f->nh.type & MPLS_NH_OUTSEGMENT) { + fnode->nh.outlabel = ldp_global_find_outlabel_handle(g, + f->nh.outsegment_handle); + if (fnode->nh.outlabel) { + fnode->nh.type |= MPLS_NH_OUTSEGMENT; + } + } MPLS_REFCNT_HOLD(fnode); /* ... add it to the tree ... */ diff --git a/ldp/ldp_attr.h b/ldp/ldp_attr.h index 55d4355..983514e 100644 --- a/ldp/ldp_attr.h +++ b/ldp/ldp_attr.h @@ -26,6 +26,9 @@ extern ldp_fec *_ldp_attr_get_fec2(ldp_global * g, mpls_fec * f, mpls_bool flag) extern void ldp_attr_action_callback(mpls_timer_handle timer, void *extra, mpls_cfg_handle g); +extern void ldp_attr_add_fec(ldp_attr *a, ldp_fec *fec); +extern void ldp_attr_del_fec(ldp_attr *a); + extern void ldp_attr_add_us2ds(ldp_attr * us, ldp_attr * ds); extern void ldp_attr_del_us2ds(ldp_attr * us, ldp_attr * ds); extern mpls_bool ldp_attr_us_partof_ds(ldp_attr * us, ldp_attr * ds); diff --git a/ldp/ldp_cfg.c b/ldp/ldp_cfg.c index 8bf54e4..a91f128 100644 --- a/ldp/ldp_cfg.c +++ b/ldp/ldp_cfg.c @@ -1779,8 +1779,20 @@ mpls_return_enum ldp_cfg_outlabel_get(mpls_cfg_handle handle, ldp_outlabel * o, if (ldp_global_find_outlabel_index(global, o->index, &outlabel) != MPLS_SUCCESS) goto ldp_cfg_outlabel_get_end; - if (flag & LDP_OUTLABEL_CFG_ADDR_INDEX) { - o->addr_index = (outlabel->addr) ? (outlabel->addr->index) : 0; + if (flag & LDP_OUTLABEL_CFG_NH_INDEX) { + if (outlabel->nh.type & MPLS_NH_IP) { + o->addr_index = (outlabel->nh.addr) ? (outlabel->nh.addr->index) : 0; + o->nh_type |= MPLS_NH_IP; + } + if (outlabel->nh.type & MPLS_NH_IF) { + o->if_index = (outlabel->nh.iff) ? (outlabel->nh.iff->index) : 0; + o->nh_type |= MPLS_NH_IF; + } + if (outlabel->nh.type & MPLS_NH_OUTSEGMENT) { + o->outlabel_index = (outlabel->nh.outlabel) ? + (outlabel->nh.outlabel->index) : 0; + o->nh_type |= MPLS_NH_OUTSEGMENT; + } } if (flag & LDP_OUTLABEL_CFG_SESSION_INDEX) { o->session_index = (outlabel->session) ? (outlabel->session->index) : 0; diff --git a/ldp/ldp_cfg.h b/ldp/ldp_cfg.h index b502dcb..8e67328 100644 --- a/ldp/ldp_cfg.h +++ b/ldp/ldp_cfg.h @@ -155,7 +155,7 @@ #define LDP_INLABEL_CFG_LABEL 0x00000004 #define LDP_INLABEL_CFG_OUTLABEL_INDEX 0x00000008 -#define LDP_OUTLABEL_CFG_ADDR_INDEX 0x00000002 +#define LDP_OUTLABEL_CFG_NH_INDEX 0x00000002 #define LDP_OUTLABEL_CFG_SESSION_INDEX 0x00000004 #define LDP_OUTLABEL_CFG_LABEL 0x00000008 #define LDP_OUTLABEL_CFG_MERGE_COUNT 0x00000010 diff --git a/ldp/ldp_fec.c b/ldp/ldp_fec.c index 61d2134..ee2bd0f 100644 --- a/ldp/ldp_fec.c +++ b/ldp/ldp_fec.c @@ -36,7 +36,6 @@ mpls_return_enum Recognize_New_Fec(ldp_global * g, mpls_fec * f) ldp_attr *ds_attr = NULL; ldp_attr *us_attr = NULL; mpls_bool egress = MPLS_BOOL_FALSE; - ldp_addr *nh_addr; ldp_outlabel *out; LDP_ENTER(g->user_data, "Recognize_New_Fec"); @@ -44,7 +43,7 @@ mpls_return_enum Recognize_New_Fec(ldp_global * g, mpls_fec * f) /* * find the info about the next hop for this FEC */ - switch (ldp_get_next_hop_session_for_fec(g, f, &nh_addr, &nh_session)) { + switch (ldp_get_next_hop_session_for_fec(g, f, &nh_session)) { case MPLS_SUCCESS: break; case MPLS_FAILURE: @@ -63,7 +62,7 @@ mpls_return_enum Recognize_New_Fec(ldp_global * g, mpls_fec * f) ds_attr = ldp_attr_find_downstream_state(g, nh_session, f, LDP_LSP_STATE_MAP_RECV); if (ds_attr && !ds_attr->outlabel) { - out = ldp_outlabel_create_complete(g, nh_session, nh_addr, ds_attr); + out = ldp_outlabel_create_complete(g, nh_session, ds_attr); if (!out) { return MPLS_FAILURE; } @@ -167,12 +166,11 @@ mpls_return_enum Detect_Change_Fec_Next_Hop(ldp_global * g, mpls_fec * f, ldp_attr *us_attr = NULL; ldp_attr *ds_attr = NULL; ldp_session *nh_session_new = NULL; - ldp_addr *nh_new = NULL; mpls_return_enum result; LDP_ENTER(g->user_data, "Detect_Change_Fec_Next_Hop"); - result = ldp_get_next_hop_session_for_fec(g, f, &nh_new, &nh_session_new); + result = ldp_get_next_hop_session_for_fec(g, f, &nh_session_new); /* * NH 1-5 decide if we need to release an existing mapping diff --git a/ldp/ldp_global.c b/ldp/ldp_global.c index 55923e9..2afd343 100644 --- a/ldp/ldp_global.c +++ b/ldp/ldp_global.c @@ -762,6 +762,22 @@ mpls_return_enum ldp_global_find_outlabel_index(ldp_global * g, uint32_t index, return MPLS_FAILURE; } +ldp_outlabel *ldp_global_find_outlabel_handle(ldp_global * g, + mpls_outsegment_handle handle) +{ + ldp_outlabel *o = MPLS_LIST_HEAD(&g->outlabel); + + if (g) { + while (o != NULL) { + if (!mpls_outsegment_handle_compare(o->info.handle, handle)) + return o; + + o = MPLS_LIST_NEXT(&g->outlabel, o, _global); + } + } + return NULL; +} + mpls_return_enum ldp_global_find_entity_index(ldp_global * g, uint32_t index, ldp_entity ** entity) { diff --git a/ldp/ldp_global.h b/ldp/ldp_global.h index f0d59df..8b1a862 100644 --- a/ldp/ldp_global.h +++ b/ldp/ldp_global.h @@ -41,6 +41,8 @@ extern mpls_return_enum ldp_global_find_inlabel_index(ldp_global * g, uint32_t, ldp_inlabel ** inlabel); extern mpls_return_enum ldp_global_find_outlabel_index(ldp_global * g, uint32_t, ldp_outlabel ** outlabel); +extern ldp_outlabel *ldp_global_find_outlabel_handle(ldp_global * g, + mpls_outsegment_handle handle); extern mpls_return_enum ldp_global_find_tunnel_index(ldp_global * g, uint32_t index, ldp_tunnel ** tunnel); diff --git a/ldp/ldp_label_mapping.c b/ldp/ldp_label_mapping.c index 6f5fb19..33959a0 100644 --- a/ldp/ldp_label_mapping.c +++ b/ldp/ldp_label_mapping.c @@ -125,17 +125,16 @@ ldp_session *ldp_get_session_by_next_hop(ldp_global * g, mpls_nexthop * a, } mpls_return_enum ldp_get_next_hop_session_for_fec(ldp_global * g, - mpls_fec * fec, ldp_addr ** next_hop, ldp_session ** next_hop_session) + mpls_fec * fec, ldp_session ** next_hop_session) { ldp_session *session = NULL; ldp_addr *addr = NULL; mpls_fec route; int count; - MPLS_ASSERT(next_hop_session && next_hop); + MPLS_ASSERT(next_hop_session); *next_hop_session = NULL; - *next_hop = NULL; if ((count = mpls_fib_get_route(g->fib_handle, 1, fec, &route)) != 1) { if (count > 1) { @@ -160,7 +159,6 @@ mpls_return_enum ldp_get_next_hop_session_for_fec(ldp_global * g, } *next_hop_session = session; - *next_hop = addr; return MPLS_SUCCESS; } @@ -419,7 +417,6 @@ void ldp_label_mapping_initial_callback(mpls_timer_handle timer, void *extra, ldp_global *g = (ldp_global*)handle; ldp_attr *ds_attr = NULL; ldp_attr *us_attr = NULL; - ldp_addr *nh_addr = NULL; ldp_session *nh_session = NULL; mpls_bool done = MPLS_BOOL_FALSE; mpls_fec dest; @@ -470,7 +467,7 @@ void ldp_label_mapping_initial_callback(mpls_timer_handle timer, void *extra, continue; } - result = ldp_get_next_hop_session_for_fec(g,&dest,&nh_addr,&nh_session); + result = ldp_get_next_hop_session_for_fec(g,&dest,&nh_session); if ((result == MPLS_FAILURE) || (result == MPLS_NO_ROUTE)) { ds_attr = NULL; } else { @@ -683,7 +680,6 @@ mpls_return_enum ldp_label_mapping_process(ldp_global * g, ldp_session * s, ldp_attr dumb_attr; ldp_outlabel *out = NULL; - ldp_addr *nh_addr = NULL; mpls_bool requested = MPLS_BOOL_FALSE; ldp_attr *update = NULL; mpls_bool need_request = MPLS_BOOL_FALSE; @@ -797,7 +793,7 @@ LMp_11: * update ONLY has a value for updated label mapping */ /* LMp.11 */ - result = ldp_get_next_hop_session_for_fec(g, fec, &nh_addr, &nh_session); + result = ldp_get_next_hop_session_for_fec(g, fec, &nh_session); /* * the following departs from the procedure, it allows for filtering @@ -874,7 +870,7 @@ LMp_11: * and we had this mapping in our database (!update->outlabel)) */ - if (!(out = ldp_outlabel_create_complete(g, s, nh_addr, ds_attr))) { + if (!(out = ldp_outlabel_create_complete(g, s, ds_attr))) { LDP_PRINT(g->user_data, "LMp.15 failure creating outlabel\n"); goto LMp_32; } diff --git a/ldp/ldp_label_mapping.h b/ldp/ldp_label_mapping.h index d26b8f6..ed0bbe3 100644 --- a/ldp/ldp_label_mapping.h +++ b/ldp/ldp_label_mapping.h @@ -33,7 +33,7 @@ extern mpls_return_enum Check_Received_Attributes(ldp_global * g, ldp_session * s, ldp_attr * r_attr, uint16_t type); extern mpls_return_enum ldp_get_next_hop_session_for_fec(ldp_global * g, - mpls_fec * fec, ldp_addr ** next_hop, ldp_session ** next_hop_session); + mpls_fec * fec, ldp_session ** next_hop_session); extern ldp_session *ldp_get_session_by_next_hop(ldp_global * g, mpls_nexthop * a, ldp_addr ** next_hop); diff --git a/ldp/ldp_label_request.c b/ldp/ldp_label_request.c index eece8a9..e47944a 100644 --- a/ldp/ldp_label_request.c +++ b/ldp/ldp_label_request.c @@ -181,7 +181,6 @@ void ldp_label_request_initial_callback(mpls_timer_handle timer, void *extra, { ldp_session *s = (ldp_session *) extra; ldp_global *g = (ldp_global*)handle; - ldp_addr *nh_addr = NULL; ldp_session *nh_session = NULL; mpls_bool done = MPLS_BOOL_FALSE; mpls_fec dest; @@ -213,7 +212,7 @@ void ldp_label_request_initial_callback(mpls_timer_handle timer, void *extra, } /* find the next hop session corresponding to this FEC */ - result = ldp_get_next_hop_session_for_fec(g,&dest,&nh_addr,&nh_session); + result = ldp_get_next_hop_session_for_fec(g,&dest,&nh_session); /* do we have a valid next hop session, and is the nexp hop session * this session? */ @@ -348,7 +347,6 @@ mpls_return_enum ldp_label_request_process(ldp_global * g, ldp_session * s, ldp_adj * a, ldp_entity * e, ldp_attr * us_attr, mpls_fec * fec) { ldp_session *nh_session = NULL; - ldp_addr *nh_addr = NULL; ldp_attr_list *us_list = NULL; mpls_bool egress = MPLS_BOOL_FALSE; ldp_attr *ds_attr = NULL; @@ -358,10 +356,10 @@ mpls_return_enum ldp_label_request_process(ldp_global * g, ldp_session * s, goto LRq_13; } - switch (ldp_get_next_hop_session_for_fec(g, fec, &nh_addr, &nh_session)) { + switch (ldp_get_next_hop_session_for_fec(g, fec, &nh_session)) { case MPLS_SUCCESS: /* LRq.2 */ { - if (nh_addr == NULL) { + if (nh_session == NULL) { egress = MPLS_BOOL_TRUE; } if (nh_session != NULL && s->index == nh_session->index) { /* LRq.3 */ diff --git a/ldp/ldp_notif.c b/ldp/ldp_notif.c index c470af0..3c8953c 100644 --- a/ldp/ldp_notif.c +++ b/ldp/ldp_notif.c @@ -340,7 +340,6 @@ mpls_return_enum ldp_notif_label_resources_available(ldp_global * g, { ldp_attr *ds_attr = NULL; ldp_session *nh_session = NULL; - ldp_addr *nh_addr = NULL; mpls_fec nfec; mpls_return_enum result; @@ -353,8 +352,7 @@ mpls_return_enum ldp_notif_label_resources_available(ldp_global * g, if (ds_attr->state == LDP_LSP_STATE_NO_LABEL_RESOURCE_RECV) { fec_tlv2mpls_fec(&ds_attr->fecTlv, 0, &nfec); - result = - ldp_get_next_hop_session_for_fec(g, &nfec, &nh_addr, &nh_session); + result = ldp_get_next_hop_session_for_fec(g, &nfec, &nh_session); switch (result) { case MPLS_SUCCESS: if (nh_session) { diff --git a/ldp/ldp_outlabel.c b/ldp/ldp_outlabel.c index 6c645fe..54d2ff9 100644 --- a/ldp/ldp_outlabel.c +++ b/ldp/ldp_outlabel.c @@ -10,6 +10,7 @@ #include #include "ldp_struct.h" #include "ldp_addr.h" +#include "ldp_if.h" #include "ldp_attr.h" #include "ldp_outlabel.h" #include "ldp_inlabel.h" @@ -41,30 +42,19 @@ ldp_outlabel *ldp_outlabel_create() } ldp_outlabel *ldp_outlabel_create_complete(ldp_global * g, ldp_session * s, - ldp_addr * nh, ldp_attr * a) + ldp_attr * a) { ldp_outlabel *out = ldp_outlabel_create(); - /* JLEU: for now pick the first adj */ - ldp_adj *adj = MPLS_LIST_HEAD(&s->adj_root); - ldp_entity *e = adj->entity; if (out != NULL) { - ldp_outlabel_add_nexthop(out, nh); + ldp_outlabel_add_nexthop(out, &a->fec->nh); ldp_session_add_outlabel(s, out); out->info.push_label = MPLS_BOOL_TRUE; out->info.owner = MPLS_OWNER_LDP; - memcpy(&out->info.nexthop.ip, &nh->address, sizeof(mpls_inet_addr)); - - memcpy(&out->info.nexthop.if_handle, - &e->p.iff->handle, sizeof(mpls_if_handle)); - out->info.nexthop.type = MPLS_NH_IP | MPLS_NH_IF; - ldp_attr2mpls_label_struct(a, &out->info.label); - _ldp_global_add_outlabel(g, out); - ldp_attr_add_outlabel(a, out); } return out; @@ -129,24 +119,53 @@ mpls_return_enum _ldp_outlabel_del_attr(ldp_outlabel * o) return MPLS_FAILURE; } -mpls_return_enum ldp_outlabel_add_nexthop(ldp_outlabel * o, ldp_addr * nh) +void ldp_outlabel_add_nexthop(ldp_outlabel * o, ldp_nexthop * nh) { - if (o && nh) { - MPLS_REFCNT_HOLD(nh); - o->addr = nh; - return MPLS_SUCCESS; + MPLS_ASSERT(o && nh); + + if (nh->type & MPLS_NH_IP) { + MPLS_REFCNT_HOLD(nh->addr); + o->nh.addr = nh->addr; + o->nh.type |= MPLS_NH_IP; + memcpy(&o->info.nexthop.ip, &nh->addr->address, sizeof(mpls_inet_addr)); + o->info.nexthop.type |= MPLS_NH_IP; + } + if (nh->type & MPLS_NH_IF) { + MPLS_REFCNT_HOLD(nh->iff); + o->nh.iff = nh->iff; + o->nh.type |= MPLS_NH_IF; + memcpy(&o->info.nexthop.if_handle, &nh->iff->handle, + sizeof(mpls_if_handle)); + o->info.nexthop.type |= MPLS_NH_IF; + } + if (nh->type & MPLS_NH_OUTSEGMENT) { + MPLS_REFCNT_HOLD(nh->outlabel); + o->nh.outlabel = nh->outlabel; + o->nh.type |= MPLS_NH_OUTSEGMENT; + memcpy(&o->info.nexthop.outsegment_handle, &nh->outlabel->info.handle, + sizeof(mpls_outsegment_handle)); + o->info.nexthop.type |= MPLS_NH_OUTSEGMENT; } - return MPLS_FAILURE; } -mpls_return_enum ldp_outlabel_del_nexthop(ldp_outlabel * o) +void ldp_outlabel_del_nexthop(ldp_outlabel * o) { - if (o && o->addr) { - MPLS_REFCNT_RELEASE(o->addr, ldp_addr_delete); - o->addr = NULL; - return MPLS_SUCCESS; + MPLS_ASSERT(o); + if (o->nh.type & MPLS_NH_IP) { + MPLS_REFCNT_RELEASE(o->nh.addr, ldp_addr_delete); + o->nh.addr = NULL; + o->nh.type &= ~MPLS_NH_IP; + } + if (o->nh.type & MPLS_NH_IF) { + MPLS_REFCNT_RELEASE(o->nh.iff, ldp_if_delete); + o->nh.iff = NULL; + o->nh.type &= ~MPLS_NH_IF; + } + if (o->nh.type & MPLS_NH_OUTSEGMENT) { + MPLS_REFCNT_RELEASE(o->nh.outlabel, ldp_outlabel_delete); + o->nh.outlabel = NULL; + o->nh.type &= ~MPLS_NH_OUTSEGMENT; } - return MPLS_FAILURE; } mpls_return_enum _ldp_outlabel_add_session(ldp_outlabel * o, ldp_session * s) diff --git a/ldp/ldp_outlabel.h b/ldp/ldp_outlabel.h index 89016a0..3834d6d 100644 --- a/ldp/ldp_outlabel.h +++ b/ldp/ldp_outlabel.h @@ -16,7 +16,7 @@ extern ldp_outlabel *ldp_outlabel_create(); extern void ldp_outlabel_delete(ldp_outlabel * i); extern ldp_outlabel *ldp_outlabel_create_complete(ldp_global * g, - ldp_session * s, ldp_addr * nh, ldp_attr * a); + ldp_session * s, ldp_attr * a); extern void ldp_outlabel_delete_complete(ldp_global * g, ldp_outlabel * out); extern mpls_return_enum _ldp_outlabel_add_inlabel(ldp_outlabel *, ldp_inlabel *); @@ -28,10 +28,9 @@ extern mpls_return_enum _ldp_outlabel_del_session(ldp_outlabel * o); extern uint32_t _ldp_outlabel_get_next_index(); extern mpls_return_enum _ldp_outlabel_add_attr(ldp_outlabel * o, ldp_attr * a); extern mpls_return_enum _ldp_outlabel_del_attr(ldp_outlabel * o); -extern mpls_return_enum ldp_outlabel_add_nexthop(ldp_outlabel * o, - - ldp_addr * nh); -extern mpls_return_enum ldp_outlabel_del_nexthop(ldp_outlabel * o); +extern void ldp_outlabel_add_nexthop(ldp_outlabel * o, + ldp_nexthop * nh); +extern void ldp_outlabel_del_nexthop(ldp_outlabel * o); extern mpls_return_enum _ldp_outlabel_add_tunnel(ldp_outlabel * o, diff --git a/ldp/ldp_struct.h b/ldp/ldp_struct.h index 7629a9d..ca8e337 100644 --- a/ldp/ldp_struct.h +++ b/ldp/ldp_struct.h @@ -493,6 +493,15 @@ typedef struct ldp_addr { uint32_t index; } ldp_addr; +struct ldp_outlabel; + +typedef struct ldp_nexthop { + enum mpls_nexthop_enum type; + struct ldp_addr *addr; + struct ldp_if *iff; + struct ldp_outlabel *outlabel; +} ldp_nexthop; + typedef struct ldp_outlabel { MPLS_REFCNT_FIELD; struct ldp_inlabel_list inlabel_root; @@ -503,13 +512,16 @@ typedef struct ldp_outlabel { uint32_t merge_count; uint32_t index; struct ldp_session *session; - struct ldp_addr *addr; struct mpls_outsegment info; + struct ldp_nexthop nh; mpls_bool switching; /* only used by get() */ uint32_t session_index; + enum mpls_nexthop_enum nh_type; + uint32_t if_index; uint32_t addr_index; + uint32_t outlabel_index; } ldp_outlabel; typedef struct ldp_inlabel { @@ -539,6 +551,13 @@ typedef struct ldp_fec { struct ldp_fs_list fs_root_us; struct ldp_fs_list fs_root_ds; struct mpls_fec info; + struct ldp_nexthop nh; + + /* only used by get() */ + enum mpls_nexthop_enum nh_type; + uint32_t if_index; + uint32_t addr_index; + uint32_t outlabel_index; } ldp_fec; typedef struct ldp_l2cc { @@ -576,6 +595,7 @@ typedef struct ldp_attr { uint32_t attempt_count; mpls_timer_handle action_timer; ldp_lsp_state action; + ldp_fec *fec; MPLS_LIST_ELEM(ldp_attr) _session; MPLS_LIST_ELEM(ldp_attr) _global; @@ -632,7 +652,7 @@ typedef struct ldp_hop { uint32_t index; uint32_t hop_list_index; uint32_t path_option; - ldp_addr addr; + mpls_inet_addr addr; uint32_t type; } ldp_hop; @@ -649,7 +669,7 @@ typedef struct ldp_tunnel { MPLS_LIST_ELEM(ldp_tunnel) _global; MPLS_LIST_ELEM(ldp_tunnel) _outlabel; uint32_t index; - ldp_addr ingress_lsrid; + mpls_inet_addr ingress_lsrid; ldp_addr egress_lsrid; char name[MPLS_MAX_IF_NAME]; mpls_bool is_interface; @@ -682,5 +702,4 @@ typedef void (*ldp_ifmgr_callback) (mpls_cfg_handle cfg, mpls_update_enum type, mpls_inet_addr *addr); typedef void (*ldp_tree_callback) (void *); - #endif -- 2.11.4.GIT