From 309ddb199aa4627e4597653ca12eb3bc8c20ab54 Mon Sep 17 00:00:00 2001 From: hasso Date: Mon, 26 Sep 2005 18:06:47 +0000 Subject: * isis_lsp.c: Put correct metric info into TE TLV's. Wide metric is used only if only wide metric style (extended TLV's) is in use. --- isisd/ChangeLog | 5 +++++ isisd/isis_lsp.c | 24 ++++++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/isisd/ChangeLog b/isisd/ChangeLog index 521df90c..e3fe6257 100644 --- a/isisd/ChangeLog +++ b/isisd/ChangeLog @@ -1,3 +1,8 @@ +2005-09-26 Hasso Tepper + + * isis_lsp.c: Put correct metric info into TE TLV's. Wide metric is + used only if only wide metric style (extended TLV's) is in use. + 2005-09-26 Hasso Tepper * isis_tlv.[ch]: New function tlv_add_in_addr() to put just one IPv4 diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index 81d189df..394aadab 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -1199,7 +1199,12 @@ lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area) te_ipreach = XCALLOC (MTYPE_ISIS_TLV, sizeof (struct te_ipv4_reachability) + ((ipv4->prefixlen + 7)/8) - 1); - te_ipreach->te_metric = htonl (*circuit->te_metric); + + if (area->oldmetric) + te_ipreach->te_metric = htonl (circuit->metrics[level - 1].metric_default); + else + te_ipreach->te_metric = htonl (circuit->te_metric[level - 1]); + te_ipreach->control = (ipv4->prefixlen & 0x3F); memcpy (&te_ipreach->prefix_start, &ipv4->prefix.s_addr, (ipv4->prefixlen + 7)/8); @@ -1225,8 +1230,13 @@ lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area) { ip6reach = XCALLOC (MTYPE_ISIS_TLV, sizeof (struct ipv6_reachability)); - ip6reach->metric = - htonl (circuit->metrics[level - 1].metric_default); + + if (area->oldmetric) + ip6reach->metric = + htonl (circuit->metrics[level - 1].metric_default); + else + ip6reach->metric = htonl (circuit->te_metric[level - 1]); + ip6reach->control_info = 0; ip6reach->prefix_len = ipv6->prefixlen; memcpy (&ip6prefix, &ipv6, sizeof(ip6prefix)); @@ -1278,7 +1288,13 @@ lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area) else memcpy (te_is_neigh->neigh_id, circuit->u.bc.l2_desig_is, ISIS_SYS_ID_LEN + 1); - metric = ((htonl(*circuit->te_metric) >> 8) & 0xffffff); + if (area->oldmetric) + metric = + ((htonl(circuit->metrics[level - 1].metric_default) >> 8) + & 0xffffff); + else + metric = ((htonl(*circuit->te_metric) >> 8) & 0xffffff); + memcpy (te_is_neigh->te_metric, &metric, 3); listnode_add (tlv_data.te_is_neighs, te_is_neigh); } -- cgit v1.2.1