2004-07-23 Sowmini Varadhan <Sowmini.Varadhan@Sun.COM>

        * if_ioctl_solaris.c: HAVE_IPV6 ifdef fixups
        * zserv.c: ditto
        * ioctl_solaris.c: ditto.
        * interface.c: cast for LLADDR
        * interface.h: Add guards, include redistribute.h and remove
          extraneous definitions of zebra_interface_{up,down}_update
        * ioctl.h: Add AF_IOCTL define for non SOLARIS_IPV6
        * redistribute.h: include dependent header, zserv.h
        * zserv.h: include dependent header, rib.h
diff --git a/zebra/ChangeLog b/zebra/ChangeLog
index b121b44..718de62 100644
--- a/zebra/ChangeLog
+++ b/zebra/ChangeLog
@@ -1,3 +1,15 @@
+2004-07-23 Sowmini Varadhan <Sowmini.Varadhan@Sun.COM>
+
+        * if_ioctl_solaris.c: HAVE_IPV6 ifdef fixups
+        * zserv.c: ditto
+        * ioctl_solaris.c: ditto.
+        * interface.c: cast for LLADDR
+        * interface.h: Add guards, include redistribute.h and remove
+          extraneous definitions of zebra_interface_{up,down}_update
+        * ioctl.h: Add AF_IOCTL define for non SOLARIS_IPV6
+        * redistribute.h: include dependent header, zserv.h
+        * zserv.h: include dependent header, rib.h
+
 2004-07-23 Paul Jakma <paul@dishone.st>
 
 	* irdp_main.c: use setsockopt_pktinfo_ipv4
diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c
index 9441abe..c05883c 100644
--- a/zebra/if_ioctl_solaris.c
+++ b/zebra/if_ioctl_solaris.c
@@ -137,11 +137,22 @@
   for (n = 0; n < lifconf.lifc_len; n += sizeof (struct lifreq))
     {
       ifp = if_get_by_name (lifreq->lifr_name);
+
       if (lifreq->lifr_addr.ss_family == AF_INET)
         ifp->flags |= IFF_IPV4;
+
       if (lifreq->lifr_addr.ss_family == AF_INET6)
-        ifp->flags |= IFF_IPV6;
+        {
+#ifdef HAVE_IPV6
+          ifp->flags |= IFF_IPV6;
+#else
+          lifreq++;
+          continue;
+#endif /* HAVE_IPV6 */
+        }
+        
       if_add_update (ifp);
+
       interface_info_ioctl (ifp);
       if_get_addr (ifp, (struct sockaddr *) &lifreq->lifr_addr);
       lifreq++;
@@ -265,7 +276,8 @@
           dest_pnt = (char *) &SIN (&dest)->sin_addr;
         }
     }
-  else
+#ifdef HAVE_IPV6
+  else if (af == AF_INET6)
     {
       if (ifp->flags & IFF_POINTOPOINT)
         {
@@ -285,15 +297,17 @@
             }
         }
     }
-
+#endif /* HAVE_IPV6 */
 
   /* Set address to the interface. */
   if (af == AF_INET)
     connected_add_ipv4 (ifp, 0, &SIN (addr)->sin_addr, prefixlen,
                         (struct in_addr *) dest_pnt, NULL);
-  else
+#ifdef HAVE_IPV6
+  else if (af == AF_INET6)
     connected_add_ipv6 (ifp, &SIN6 (addr)->sin6_addr, prefixlen,
                         (struct in6_addr *) dest_pnt);
+#endif /* HAVE_IPV6 */
 
   return 0;
 }
@@ -319,6 +333,7 @@
 struct connected *
 if_lookup_linklocal (struct interface *ifp)
 {
+#ifdef HAVE_IPV6
   listnode node;
   struct connected *ifc;
 
@@ -333,5 +348,7 @@
           (IN6_IS_ADDR_LINKLOCAL (&ifc->address->u.prefix6)))
         return ifc;
     }
+#endif /* HAVE_IPV6 */
+
   return NULL;
 }
diff --git a/zebra/interface.c b/zebra/interface.c
index 3a7a591..bf84a69 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -543,8 +543,8 @@
       u_char *ptr;
 
       vty_out (vty, "  HWaddr: ");
-      for (i = 0, ptr = LLADDR (sdl); i < sdl->sdl_alen; i++, ptr++)
-	vty_out (vty, "%s%02x", i == 0 ? "" : ":", *ptr);
+      for (i = 0, ptr = (u_char *)LLADDR (sdl); i < sdl->sdl_alen; i++, ptr++)
+        vty_out (vty, "%s%02x", i == 0 ? "" : ":", *ptr);
       vty_out (vty, "%s", VTY_NEWLINE);
     }
 #else
diff --git a/zebra/interface.h b/zebra/interface.h
index c1f9f71..88049b4 100644
--- a/zebra/interface.h
+++ b/zebra/interface.h
@@ -19,6 +19,11 @@
  * 02111-1307, USA.  
  */
 
+#ifndef _ZEBRA_INTERFACE_H
+#define _ZEBRA_INTERFACE_H
+
+#include "redistribute.h"
+
 #ifdef HAVE_IRDP
 #include "zebra/irdp.h"
 #endif
@@ -169,8 +174,6 @@
 void if_up (struct interface *);
 void if_down (struct interface *);
 void if_refresh (struct interface *);
-void zebra_interface_up_update (struct interface *ifp);
-void zebra_interface_down_update (struct interface *ifp);
 
 #ifdef HAVE_PROC_NET_DEV
 int ifstat_update_proc ();
@@ -189,3 +192,5 @@
 #ifdef BSDI
 int if_kvm_get_mtu (struct interface *);
 #endif /* BSDI */
+
+#endif /* _ZEBRA_INTERFACE_H */
diff --git a/zebra/ioctl.h b/zebra/ioctl.h
index eadc69a..a82c312 100644
--- a/zebra/ioctl.h
+++ b/zebra/ioctl.h
@@ -49,6 +49,10 @@
 #define AF_IOCTL(af, request, buffer) \
         ((af) == AF_INET? if_ioctl(request, buffer) : \
                           if_ioctl_ipv6(request, buffer))
+#else /* SOLARIS_IPV6 */
+
+#define AF_IOCTL(af, request, buffer)  if_ioctl(request, buffer)
+
 #endif /* SOLARIS_IPV6 */
 
 #endif /* _ZEBRA_IOCTL_H */
diff --git a/zebra/ioctl_solaris.c b/zebra/ioctl_solaris.c
index 805a9ca..7b4dde3 100644
--- a/zebra/ioctl_solaris.c
+++ b/zebra/ioctl_solaris.c
@@ -80,10 +80,11 @@
   return 0;
 }
 
-#ifdef HAVE_IPV6
+
 int
 if_ioctl_ipv6 (u_long request, caddr_t buffer)
 {
+#ifdef HAVE_IPV6
   int sock;
   int ret = 0;
   int err = 0;
@@ -116,9 +117,10 @@
       errno = err;
       return ret;
     }
+#endif /* HAVE_IPV6 */
+
   return 0;
 }
-#endif /* HAVE_IPV6 */
 
 /*
  * get interface metric
@@ -134,8 +136,10 @@
 
   if (ifp->flags & IFF_IPV4)
     ret = AF_IOCTL (AF_INET, SIOCGLIFMETRIC, (caddr_t) & lifreq);
+#ifdef SOLARIS_IPV6
   else if (ifp->flags & IFF_IPV6)
     ret = AF_IOCTL (AF_INET6, SIOCGLIFMETRIC, (caddr_t) & lifreq);
+#endif /* SOLARIS_IPV6 */
   else
     ret = -1;
     
@@ -171,10 +175,13 @@
         }
     }
 
-
+#ifdef HAVE_IPV6
   if ((ifp->flags & IFF_IPV6) == 0)
-
+    return;
+    
+  memset(&lifreq, 0, sizeof(lifreq));
   lifreq_set_name (&lifreq, ifp);
+
   ret = AF_IOCTL (AF_INET6, SIOCGLIFMTU, (caddr_t) & lifreq);
   if (ret < 0)
     {
@@ -185,6 +192,7 @@
     {
       ifp->mtu6 = lifreq.lifr_metric;
     }
+#endif /* HAVE_IPV6 */
 }
 
 /* Set up interface's address, netmask (and broadcast? ).
diff --git a/zebra/redistribute.h b/zebra/redistribute.h
index 8b45cf3..14b92b0 100644
--- a/zebra/redistribute.h
+++ b/zebra/redistribute.h
@@ -24,6 +24,7 @@
 #define _ZEBRA_REDISTRIBUTE_H
 
 #include "table.h"
+#include "zserv.h"
 
 void zebra_redistribute_add (int, struct zserv *, int);
 void zebra_redistribute_delete (int, struct zserv *, int);
diff --git a/zebra/zserv.h b/zebra/zserv.h
index f043099..90e85f6 100644
--- a/zebra/zserv.h
+++ b/zebra/zserv.h
@@ -22,6 +22,8 @@
 #ifndef _ZEBRA_ZSERV_H
 #define _ZEBRA_ZSERV_H
 
+#include "rib.h"
+
 /* Default port information. */
 #define ZEBRA_PORT                    2600
 #define ZEBRA_VTY_PORT                2601