Common router id.
diff --git a/isisd/ChangeLog b/isisd/ChangeLog
index b95bdbf..c280bf2 100644
--- a/isisd/ChangeLog
+++ b/isisd/ChangeLog
@@ -1,3 +1,10 @@
+2004-10-03 Hasso Tepper <hasso at quagga.net>
+
+	* isis_zebra.c: Read router id related messages from zebra daemon.
+	* isis_lsp.c: Use router id in IP address TLV in LSP's. It's how Junos
+	  routers behave as well.
+	* isis_tlv.h: Export add_tlv() function.
+
 2004-09-27 Hasso Tepper <hasso at quagga.net>
 
 	* isis_pdu.c: Fix accessing NULL found by valgrind.
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index 2f18543..567afa3 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -59,6 +59,7 @@
 
 extern struct isis *isis;
 extern struct thread_master *master;
+extern struct in_addr router_id_zebra;
 
 /* staticly assigned vars for printing purposes */
 char lsp_bits_string[200];     /* FIXME: enough ? */
@@ -1380,6 +1381,7 @@
   struct tlvs tlv_data;
   struct isis_lsp *lsp0 = lsp;
   struct isis_passwd *passwd;
+  struct in_addr *routerid;
 
   /*
    * First add the tlvs related to area
@@ -1446,6 +1448,30 @@
 
   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.
+   */
+  if (router_id_zebra.s_addr != 0)
+    {
+      u_char value[4];
+
+      if (lsp->tlv_data.ipv4_addrs == NULL)
+	lsp->tlv_data.ipv4_addrs = list_new ();
+
+      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);
+
+      /* 
+       * 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);
+    }
+  /*
    * Then build lists of tlvs related to circuits
    */
   for (node = listhead (area->circuit_list); node; nextnode (node))
diff --git a/isisd/isis_tlv.h b/isisd/isis_tlv.h
index 72f883d..b82be5b 100644
--- a/isisd/isis_tlv.h
+++ b/isisd/isis_tlv.h
@@ -260,6 +260,7 @@
 		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_lan_neighs (struct list *lan_neighs, struct stream *stream);
diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c
index 8e12208..f56c5d4 100644
--- a/isisd/isis_zebra.c
+++ b/isisd/isis_zebra.c
@@ -43,6 +43,22 @@
 struct zclient *zclient = NULL;
 
 extern struct thread_master *master;
+struct in_addr router_id_zebra;
+
+/* Router-id update message from zebra. */
+int
+isis_router_id_update_zebra (int command, struct zclient *zclient,
+			     zebra_size_t length)
+{
+  struct prefix router_id;
+  char buf[BUFSIZ];
+
+  zebra_router_id_update_read (zclient->ibuf,&router_id);
+  router_id_zebra = router_id.u.prefix4;
+
+  /* FIXME: Do we react somehow? */
+  return 0;
+}
 
 int
 isis_zebra_if_add (int command, struct zclient *zclient, zebra_size_t length)
@@ -106,19 +122,6 @@
   return ifp;
 }
 
-void
-zebra_interface_if_set_value (struct stream *s, struct interface *ifp)
-{
-  /* Read interface's index. */
-  ifp->ifindex = stream_getl (s);
-
-  /* Read interface's value. */
-  ifp->flags = stream_getl (s);
-  ifp->metric = stream_getl (s);
-  ifp->mtu = stream_getl (s);
-  ifp->bandwidth = stream_getl (s);
-}
-
 int
 isis_zebra_if_state_up (int command, struct zclient *zclient,
 			zebra_size_t length)
@@ -591,6 +594,7 @@
 {
   zclient = zclient_new ();
   zclient_init (zclient, ZEBRA_ROUTE_ISIS);
+  zclient->router_id_update = isis_router_id_update_zebra;
   zclient->interface_add = isis_zebra_if_add;
   zclient->interface_delete = isis_zebra_if_del;
   zclient->interface_up = isis_zebra_if_state_up;