summaryrefslogtreecommitdiff
path: root/isisd/isis_lsp.c
diff options
context:
space:
mode:
authorhasso <hasso>2005-09-26 17:58:24 +0000
committerhasso <hasso>2005-09-26 17:58:24 +0000
commit81ad8f6a1040eaf9d4230bd63b71d85397660653 (patch)
tree93ccfab5fe8ca9d9e79b65aed0e359ab21f0a1c1 /isisd/isis_lsp.c
parentaa4376ec0c37b9b2d484e9503ad7b8e1a010afd2 (diff)
* isis_tlv.[ch]: New function tlv_add_in_addr() to put just one IPv4
address into TLV. Used for IPv4 address TLV (in case of LSP) and TE router ID TLV. * isis_lsp.c: Use tlv_add_in_addr() and include router ID in LSP.
Diffstat (limited to 'isisd/isis_lsp.c')
-rw-r--r--isisd/isis_lsp.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index 882c857a..81d189df 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -1100,11 +1100,9 @@ lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area)
if (lsp->tlv_data.area_addrs && listcount (lsp->tlv_data.area_addrs) > 0)
tlv_add_area_addrs (lsp->tlv_data.area_addrs, lsp->pdu);
- memset (&tlv_data, 0, sizeof (struct tlvs));
- /*
- * IPv4 address TLV. We don't follow "C" vendor, but "J" vendor behavior -
- * one IPv4 address is put into LSP and this address is same as router id.
- */
+ /* IPv4 address and TE router ID TLVs. In case of the first one we don't
+ * follow "C" vendor, but "J" vendor behavior - one IPv4 address is put into
+ * LSP and this address is same as router id. */
if (router_id_zebra.s_addr != 0)
{
if (lsp->tlv_data.ipv4_addrs == NULL)
@@ -1115,18 +1113,22 @@ lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area)
routerid = XMALLOC (MTYPE_ISIS_TLV, sizeof (struct in_addr));
routerid->s_addr = router_id_zebra.s_addr;
-
listnode_add (lsp->tlv_data.ipv4_addrs, routerid);
+ tlv_add_in_addr (routerid, lsp->pdu, IPV4_ADDR);
- /*
- * FIXME: Using add_tlv() directly is hack, but tlv_add_ip_addrs()
- * expects list of prefix_ipv4 structures, but we have list of
- * in_addr structures.
- */
- add_tlv (IPV4_ADDR, IPV4_MAX_BYTELEN, (u_char *) &routerid->s_addr,
- lsp->pdu);
+ /* Exactly same data is put into TE router ID TLV, but only if new style
+ * TLV's are in use. */
+ if (area->newmetric)
+ {
+ lsp->tlv_data.router_id = XMALLOC (MTYPE_ISIS_TLV,
+ sizeof (struct in_addr));
+ lsp->tlv_data.router_id->id.s_addr = router_id_zebra.s_addr;
+ tlv_add_in_addr (&lsp->tlv_data.router_id->id, lsp->pdu, TE_ROUTER_ID);
+ }
}
+ memset (&tlv_data, 0, sizeof (struct tlvs));
+
#ifdef TOPOLOGY_GENERATE
/* If topology exists (and we create topology for level 1 only), create
* (hardcoded) link to topology. */