summaryrefslogtreecommitdiff
path: root/isisd
diff options
context:
space:
mode:
Diffstat (limited to 'isisd')
-rw-r--r--isisd/ChangeLog7
-rw-r--r--isisd/isis_lsp.c28
-rw-r--r--isisd/isis_tlv.c14
-rw-r--r--isisd/isis_tlv.h2
4 files changed, 37 insertions, 14 deletions
diff --git a/isisd/ChangeLog b/isisd/ChangeLog
index 87a9c9e4..521df90c 100644
--- a/isisd/ChangeLog
+++ b/isisd/ChangeLog
@@ -1,5 +1,12 @@
2005-09-26 Hasso Tepper <hasso at quagga.net>
+ * 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.
+
+2005-09-26 Hasso Tepper <hasso at quagga.net>
+
* isis_lsp.c: Support for originating TE IS and IPv4 TLV's. No any sub
TLV handling yet.
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. */
diff --git a/isisd/isis_tlv.c b/isisd/isis_tlv.c
index f4307246..4f8ab393 100644
--- a/isisd/isis_tlv.c
+++ b/isisd/isis_tlv.c
@@ -927,6 +927,20 @@ tlv_add_ip_addrs (struct list *ip_addrs, struct stream *stream)
return add_tlv (IPV4_ADDR, pos - value, value, stream);
}
+/* Used to add TLV containing just one IPv4 address - either IPv4 address TLV
+ * (in case of LSP) or TE router ID TLV. */
+int
+tlv_add_in_addr (struct in_addr *addr, struct stream *stream, u_char tag)
+{
+ u_char value[255];
+ u_char *pos = value;
+
+ memcpy (pos, addr, IPV4_MAX_BYTELEN);
+ pos += IPV4_MAX_BYTELEN;
+
+ return add_tlv (tag, pos - value, value, stream);
+}
+
int
tlv_add_dynamic_hostname (struct hostname *hostname, struct stream *stream)
{
diff --git a/isisd/isis_tlv.h b/isisd/isis_tlv.h
index 1dc030e0..951a254a 100644
--- a/isisd/isis_tlv.h
+++ b/isisd/isis_tlv.h
@@ -276,7 +276,6 @@ int parse_tlvs (char *areatag, u_char * stream, int size,
u_int32_t * expected, u_int32_t * found, struct tlvs *tlvs);
void free_tlv (void *val);
-int add_tlv (u_char, u_char, u_char *, struct stream *);
int tlv_add_area_addrs (struct list *area_addrs, struct stream *stream);
int tlv_add_is_neighs (struct list *is_neighs, struct stream *stream);
int tlv_add_te_is_neighs (struct list *te_is_neighs, struct stream *stream);
@@ -286,6 +285,7 @@ int tlv_add_checksum (struct checksum *checksum, struct stream *stream);
int tlv_add_authinfo (char auth_type, char authlen, u_char *auth_value,
struct stream *stream);
int tlv_add_ip_addrs (struct list *ip_addrs, struct stream *stream);
+int tlv_add_in_addr (struct in_addr *, struct stream *stream, u_char tag);
int tlv_add_dynamic_hostname (struct hostname *hostname,
struct stream *stream);
int tlv_add_lsp_entries (struct list *lsps, struct stream *stream);