* 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.
This commit is contained in:
hasso 2005-09-26 17:58:24 +00:00
parent aa4376ec0c
commit 81ad8f6a10
4 changed files with 37 additions and 14 deletions

View File

@ -1,3 +1,10 @@
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> 2005-09-26 Hasso Tepper <hasso at quagga.net>
* isis_lsp.c: Support for originating TE IS and IPv4 TLV's. No any sub * isis_lsp.c: Support for originating TE IS and IPv4 TLV's. No any sub

View File

@ -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) if (lsp->tlv_data.area_addrs && listcount (lsp->tlv_data.area_addrs) > 0)
tlv_add_area_addrs (lsp->tlv_data.area_addrs, lsp->pdu); tlv_add_area_addrs (lsp->tlv_data.area_addrs, lsp->pdu);
memset (&tlv_data, 0, sizeof (struct tlvs)); /* 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
* IPv4 address TLV. We don't follow "C" vendor, but "J" vendor behavior - * LSP and this address is same as router id. */
* one IPv4 address is put into LSP and this address is same as router id.
*/
if (router_id_zebra.s_addr != 0) if (router_id_zebra.s_addr != 0)
{ {
if (lsp->tlv_data.ipv4_addrs == NULL) 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 = XMALLOC (MTYPE_ISIS_TLV, sizeof (struct in_addr));
routerid->s_addr = router_id_zebra.s_addr; routerid->s_addr = router_id_zebra.s_addr;
listnode_add (lsp->tlv_data.ipv4_addrs, routerid); listnode_add (lsp->tlv_data.ipv4_addrs, routerid);
tlv_add_in_addr (routerid, lsp->pdu, IPV4_ADDR);
/* /* Exactly same data is put into TE router ID TLV, but only if new style
* FIXME: Using add_tlv() directly is hack, but tlv_add_ip_addrs() * TLV's are in use. */
* expects list of prefix_ipv4 structures, but we have list of if (area->newmetric)
* in_addr structures. {
*/ lsp->tlv_data.router_id = XMALLOC (MTYPE_ISIS_TLV,
add_tlv (IPV4_ADDR, IPV4_MAX_BYTELEN, (u_char *) &routerid->s_addr, sizeof (struct in_addr));
lsp->pdu); 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 #ifdef TOPOLOGY_GENERATE
/* If topology exists (and we create topology for level 1 only), create /* If topology exists (and we create topology for level 1 only), create
* (hardcoded) link to topology. */ * (hardcoded) link to topology. */

View File

@ -927,6 +927,20 @@ tlv_add_ip_addrs (struct list *ip_addrs, struct stream *stream)
return add_tlv (IPV4_ADDR, pos - value, value, 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 int
tlv_add_dynamic_hostname (struct hostname *hostname, struct stream *stream) tlv_add_dynamic_hostname (struct hostname *hostname, struct stream *stream)
{ {

View File

@ -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); u_int32_t * expected, u_int32_t * found, struct tlvs *tlvs);
void free_tlv (void *val); 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_area_addrs (struct list *area_addrs, struct stream *stream);
int tlv_add_is_neighs (struct list *is_neighs, 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); 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, int tlv_add_authinfo (char auth_type, char authlen, u_char *auth_value,
struct stream *stream); struct stream *stream);
int tlv_add_ip_addrs (struct list *ip_addrs, 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, int tlv_add_dynamic_hostname (struct hostname *hostname,
struct stream *stream); struct stream *stream);
int tlv_add_lsp_entries (struct list *lsps, struct stream *stream); int tlv_add_lsp_entries (struct list *lsps, struct stream *stream);