From 5b73a671aac22a75cc90657aa4a924d199f2284b Mon Sep 17 00:00:00 2001 From: paul Date: Fri, 23 Jul 2004 15:26:14 +0000 Subject: 2004-07-23 Sowmini Varadhan * 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 --- zebra/ChangeLog | 12 ++++++++++++ zebra/if_ioctl_solaris.c | 25 +++++++++++++++++++++---- zebra/interface.c | 4 ++-- zebra/interface.h | 9 +++++++-- zebra/ioctl.h | 4 ++++ zebra/ioctl_solaris.c | 16 ++++++++++++---- zebra/redistribute.h | 1 + zebra/zserv.h | 2 ++ 8 files changed, 61 insertions(+), 12 deletions(-) (limited to 'zebra') diff --git a/zebra/ChangeLog b/zebra/ChangeLog index b121b448..718de625 100644 --- a/zebra/ChangeLog +++ b/zebra/ChangeLog @@ -1,3 +1,15 @@ +2004-07-23 Sowmini Varadhan + + * 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 * irdp_main.c: use setsockopt_pktinfo_ipv4 diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c index 9441abed..c05883c6 100644 --- a/zebra/if_ioctl_solaris.c +++ b/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; } diff --git a/zebra/interface.c b/zebra/interface.c index 3a7a5919..bf84a698 100644 --- a/zebra/interface.c +++ b/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 diff --git a/zebra/interface.h b/zebra/interface.h index c1f9f71c..88049b40 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_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 */ diff --git a/zebra/ioctl.h b/zebra/ioctl.h index eadc69a0..a82c3125 100644 --- a/zebra/ioctl.h +++ b/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 */ diff --git a/zebra/ioctl_solaris.c b/zebra/ioctl_solaris.c index 805a9ca0..7b4dde36 100644 --- a/zebra/ioctl_solaris.c +++ b/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? ). diff --git a/zebra/redistribute.h b/zebra/redistribute.h index 8b45cf3b..14b92b0d 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 f043099b..90e85f68 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 -- cgit v1.2.1