]> git.proxmox.com Git - mirror_frr.git/commitdiff
* isis_tlv.[ch]: New function tlv_add_in_addr() to put just one IPv4
authorhasso <hasso>
Mon, 26 Sep 2005 17:58:24 +0000 (17:58 +0000)
committerhasso <hasso>
Mon, 26 Sep 2005 17:58:24 +0000 (17:58 +0000)
  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.

isisd/ChangeLog
isisd/isis_lsp.c
isisd/isis_tlv.c
isisd/isis_tlv.h

index 87a9c9e4e4336a87a1db7ecd55d7b2a6b6af1bca..521df90c774f8c53c7d74989f97943876e39aa1c 100644 (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>
 
        * isis_lsp.c: Support for originating TE IS and IPv4 TLV's. No any sub
index 882c857a41f04f01c030f4d08aabd82fccea7cfa..81d189dfd9de495e700b7bb0def8746d5ff606ae 100644 (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)
     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. */
index f43072466601e59da27976eef875d69af094a5b9..4f8ab393bded5ae302d36b0bedf273508a5972b4 100644 (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);
 }
 
+/* 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)
 {
index 1dc030e00706c51167b95694f171ea6d2b26079b..951a254a97c4e3d73064bf57828b3252d6f0552c 100644 (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);
 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);