From 766d39cf3ca60281df8bea7458331f0757a137e5 Mon Sep 17 00:00:00 2001 From: "James R. Leu" Date: Wed, 25 May 2005 21:38:27 -0600 Subject: [PATCH] Make sure that all check for 'egress' utilize mpls_policy_egress_check [git-p4: depot-paths = "//depot/ldp-portable/": change = 1159] --- ldp/ldp_fec.c | 9 +++------ ldp/ldp_label_mapping.c | 14 ++++++++++++-- ldp/ldp_label_request.c | 17 +++++++++++------ 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/ldp/ldp_fec.c b/ldp/ldp_fec.c index 162332f..fb8f1f9 100644 --- a/ldp/ldp_fec.c +++ b/ldp/ldp_fec.c @@ -296,11 +296,13 @@ mpls_return_enum ldp_fec_process_add(ldp_global * g, ldp_fec * f, ldp_session *peer = NULL; ldp_attr *ds_attr = NULL; ldp_attr *us_attr = NULL; - mpls_bool egress = MPLS_BOOL_FALSE; + mpls_bool egress; ldp_outlabel *out; LDP_ENTER(g->user_data, "ldp_fec_process_add"); + egress = mpls_policy_egress_check(g, &f->info, &nh->info); + /* * find the info about the next hop for this FEC */ @@ -366,11 +368,6 @@ mpls_return_enum ldp_fec_process_add(ldp_global * g, ldp_fec * f, return MPLS_FAILURE; } /* FEC.1.DUO3-4 */ - if ((egress == MPLS_BOOL_TRUE) && (mpls_policy_egress_check( - g->user_data, &f->info, &nh->info) == MPLS_BOOL_TRUE)) { - goto next_peer; - } - if (ldp_label_mapping_with_xc(g, peer, f, &us_attr, ds_attr) != MPLS_SUCCESS) { return MPLS_FAILURE; diff --git a/ldp/ldp_label_mapping.c b/ldp/ldp_label_mapping.c index 6312eca..3111c7c 100644 --- a/ldp/ldp_label_mapping.c +++ b/ldp/ldp_label_mapping.c @@ -42,18 +42,28 @@ mpls_return_enum ldp_label_mapping_with_xc(ldp_global * g, ldp_session * s, { mpls_return_enum result = MPLS_SUCCESS; mpls_bool propogating = MPLS_BOOL_TRUE; - mpls_bool egress = MPLS_BOOL_TRUE; + mpls_bool egress = MPLS_BOOL_FALSE; + mpls_bool egress_flag = MPLS_BOOL_FALSE; mpls_bool created = MPLS_BOOL_FALSE; + ldp_nexthop *nh; MPLS_ASSERT(us_attr); + nh = MPLS_LIST_HEAD(&f->nh_root); + while (nh) { + if (egress_flag == MPLS_BOOL_FALSE) { + egress_flag = mpls_policy_egress_check(g->user_data, &f->info, &nh->info); + } + nh = MPLS_LIST_NEXT(&f->nh_root, nh, _fec); + } + if (!(*us_attr)) { if (!((*us_attr) = ldp_attr_create(&f->info))) { return MPLS_FAILURE; } created = MPLS_BOOL_TRUE; } - if (!ds_attr) { + if ((!ds_attr) && (egress_flag == MPLS_BOOL_TRUE)) { propogating = MPLS_BOOL_FALSE; egress = MPLS_BOOL_TRUE; } diff --git a/ldp/ldp_label_request.c b/ldp/ldp_label_request.c index e0ce7d5..82c88bf 100644 --- a/ldp/ldp_label_request.c +++ b/ldp/ldp_label_request.c @@ -378,10 +378,12 @@ mpls_return_enum ldp_label_request_process(ldp_global * g, ldp_session * s, ldp_nexthop *nh = NULL; ldp_attr_list *us_list = NULL; mpls_bool egress = MPLS_BOOL_FALSE; + mpls_bool egress_flag = MPLS_BOOL_FALSE; ldp_attr *ds_attr = NULL; ldp_attr *us_temp = NULL; - if (Check_Received_Attributes(g, s, us_attr, MPLS_LBLREQ_MSGTYPE) != MPLS_SUCCESS) { /* LRp.1 */ + if (Check_Received_Attributes(g, s, us_attr, MPLS_LBLREQ_MSGTYPE) != + MPLS_SUCCESS) { /* LRp.1 */ goto LRq_13; } @@ -393,14 +395,16 @@ mpls_return_enum ldp_label_request_process(ldp_global * g, ldp_session * s, /* just find one valid nexthop session for now */ nh = MPLS_LIST_HEAD(&f->nh_root); while (nh) { - nh_session = ldp_session_for_nexthop(nh); - if (nh_session) { - break; + if (!nh_session) { + nh_session = ldp_session_for_nexthop(nh); + } + if (egress_flag == MPLS_BOOL_FALSE) { + egress_flag = mpls_policy_egress_check(g->user_data, &f->info, &nh->info); } nh = MPLS_LIST_NEXT(&f->nh_root, nh, _fec); } - if (!nh_session) { + if ((!nh_session) && (egress_flag == MPLS_BOOL_TRUE)) { egress = MPLS_BOOL_TRUE; } if (nh_session != NULL && s->index == nh_session->index) { /* LRq.3 */ @@ -443,7 +447,8 @@ mpls_return_enum ldp_label_request_process(ldp_global * g, ldp_session * s, goto LRq_11; } } else { - if ((!(egress == MPLS_BOOL_TRUE || ds_attr)) || (g->label_merge == MPLS_BOOL_FALSE)) { + if ((!(egress == MPLS_BOOL_TRUE || ds_attr)) || + (g->label_merge == MPLS_BOOL_FALSE)) { goto LRq_10; } -- 2.11.4.GIT