Browse Source

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
paul 17 years ago
parent
commit
5b73a671aa
8 changed files with 61 additions and 12 deletions
  1. 12 0
      zebra/ChangeLog
  2. 21 4
      zebra/if_ioctl_solaris.c
  3. 2 2
      zebra/interface.c
  4. 7 2
      zebra/interface.h
  5. 4 0
      zebra/ioctl.h
  6. 12 4
      zebra/ioctl_solaris.c
  7. 1 0
      zebra/redistribute.h
  8. 2 0
      zebra/zserv.h

+ 12 - 0
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

+ 21 - 4
zebra/if_ioctl_solaris.c

@@ -137,11 +137,22 @@ calculate_lifc_len:     /* must hold privileges to enter here */
   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 @@ if_get_addr (struct interface *ifp, struct sockaddr *addr)
           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 @@ if_get_addr (struct interface *ifp, struct sockaddr *addr)
             }
         }
     }
-
+#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 @@ interface_list ()
 struct connected *
 if_lookup_linklocal (struct interface *ifp)
 {
+#ifdef HAVE_IPV6
   listnode node;
   struct connected *ifc;
 
@@ -333,5 +348,7 @@ if_lookup_linklocal (struct interface *ifp)
           (IN6_IS_ADDR_LINKLOCAL (&ifc->address->u.prefix6)))
         return ifc;
     }
+#endif /* HAVE_IPV6 */
+
   return NULL;
 }

+ 2 - 2
zebra/interface.c

@@ -543,8 +543,8 @@ if_dump_vty (struct vty *vty, struct interface *ifp)
       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

+ 7 - 2
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_add_update (struct interface *ifp);
 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 @@ int ifaddr_proc_ipv6 ();
 #ifdef BSDI
 int if_kvm_get_mtu (struct interface *);
 #endif /* BSDI */
+
+#endif /* _ZEBRA_INTERFACE_H */

+ 4 - 0
zebra/ioctl.h

@@ -49,6 +49,10 @@ struct connected *if_lookup_linklocal( struct interface *);
 #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 */

+ 12 - 4
zebra/ioctl_solaris.c

@@ -80,10 +80,11 @@ if_ioctl (u_long request, caddr_t buffer)
   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 @@ if_ioctl_ipv6 (u_long request, caddr_t buffer)
       errno = err;
       return ret;
     }
+#endif /* HAVE_IPV6 */
+
   return 0;
 }
-#endif /* HAVE_IPV6 */
 
 /*
  * get interface metric
@@ -134,8 +136,10 @@ if_get_metric (struct interface *ifp)
 
   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 @@ if_get_mtu (struct interface *ifp)
         }
     }
 
-
+#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 @@ if_get_mtu (struct interface *ifp)
     {
       ifp->mtu6 = lifreq.lifr_metric;
     }
+#endif /* HAVE_IPV6 */
 }
 
 /* Set up interface's address, netmask (and broadcast? ).

+ 1 - 0
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);

+ 2 - 0
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