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
This commit is contained in:
paul 2004-07-23 15:26:14 +00:00
parent 1470bafb7a
commit 5b73a671aa
8 changed files with 61 additions and 12 deletions

View File

@ -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> 2004-07-23 Paul Jakma <paul@dishone.st>
* irdp_main.c: use setsockopt_pktinfo_ipv4 * irdp_main.c: use setsockopt_pktinfo_ipv4

View File

@ -137,11 +137,22 @@ calculate_lifc_len: /* must hold privileges to enter here */
for (n = 0; n < lifconf.lifc_len; n += sizeof (struct lifreq)) for (n = 0; n < lifconf.lifc_len; n += sizeof (struct lifreq))
{ {
ifp = if_get_by_name (lifreq->lifr_name); ifp = if_get_by_name (lifreq->lifr_name);
if (lifreq->lifr_addr.ss_family == AF_INET) if (lifreq->lifr_addr.ss_family == AF_INET)
ifp->flags |= IFF_IPV4; ifp->flags |= IFF_IPV4;
if (lifreq->lifr_addr.ss_family == AF_INET6) if (lifreq->lifr_addr.ss_family == AF_INET6)
{
#ifdef HAVE_IPV6
ifp->flags |= IFF_IPV6; ifp->flags |= IFF_IPV6;
#else
lifreq++;
continue;
#endif /* HAVE_IPV6 */
}
if_add_update (ifp); if_add_update (ifp);
interface_info_ioctl (ifp); interface_info_ioctl (ifp);
if_get_addr (ifp, (struct sockaddr *) &lifreq->lifr_addr); if_get_addr (ifp, (struct sockaddr *) &lifreq->lifr_addr);
lifreq++; lifreq++;
@ -265,7 +276,8 @@ if_get_addr (struct interface *ifp, struct sockaddr *addr)
dest_pnt = (char *) &SIN (&dest)->sin_addr; dest_pnt = (char *) &SIN (&dest)->sin_addr;
} }
} }
else #ifdef HAVE_IPV6
else if (af == AF_INET6)
{ {
if (ifp->flags & IFF_POINTOPOINT) 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. */ /* Set address to the interface. */
if (af == AF_INET) if (af == AF_INET)
connected_add_ipv4 (ifp, 0, &SIN (addr)->sin_addr, prefixlen, connected_add_ipv4 (ifp, 0, &SIN (addr)->sin_addr, prefixlen,
(struct in_addr *) dest_pnt, NULL); (struct in_addr *) dest_pnt, NULL);
else #ifdef HAVE_IPV6
else if (af == AF_INET6)
connected_add_ipv6 (ifp, &SIN6 (addr)->sin6_addr, prefixlen, connected_add_ipv6 (ifp, &SIN6 (addr)->sin6_addr, prefixlen,
(struct in6_addr *) dest_pnt); (struct in6_addr *) dest_pnt);
#endif /* HAVE_IPV6 */
return 0; return 0;
} }
@ -319,6 +333,7 @@ interface_list ()
struct connected * struct connected *
if_lookup_linklocal (struct interface *ifp) if_lookup_linklocal (struct interface *ifp)
{ {
#ifdef HAVE_IPV6
listnode node; listnode node;
struct connected *ifc; struct connected *ifc;
@ -333,5 +348,7 @@ if_lookup_linklocal (struct interface *ifp)
(IN6_IS_ADDR_LINKLOCAL (&ifc->address->u.prefix6))) (IN6_IS_ADDR_LINKLOCAL (&ifc->address->u.prefix6)))
return ifc; return ifc;
} }
#endif /* HAVE_IPV6 */
return NULL; return NULL;
} }

View File

@ -543,7 +543,7 @@ if_dump_vty (struct vty *vty, struct interface *ifp)
u_char *ptr; u_char *ptr;
vty_out (vty, " HWaddr: "); vty_out (vty, " HWaddr: ");
for (i = 0, ptr = LLADDR (sdl); i < sdl->sdl_alen; i++, 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%02x", i == 0 ? "" : ":", *ptr);
vty_out (vty, "%s", VTY_NEWLINE); vty_out (vty, "%s", VTY_NEWLINE);
} }

View File

@ -19,6 +19,11 @@
* 02111-1307, USA. * 02111-1307, USA.
*/ */
#ifndef _ZEBRA_INTERFACE_H
#define _ZEBRA_INTERFACE_H
#include "redistribute.h"
#ifdef HAVE_IRDP #ifdef HAVE_IRDP
#include "zebra/irdp.h" #include "zebra/irdp.h"
#endif #endif
@ -169,8 +174,6 @@ void if_add_update (struct interface *ifp);
void if_up (struct interface *); void if_up (struct interface *);
void if_down (struct interface *); void if_down (struct interface *);
void if_refresh (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 #ifdef HAVE_PROC_NET_DEV
int ifstat_update_proc (); int ifstat_update_proc ();
@ -189,3 +192,5 @@ int ifaddr_proc_ipv6 ();
#ifdef BSDI #ifdef BSDI
int if_kvm_get_mtu (struct interface *); int if_kvm_get_mtu (struct interface *);
#endif /* BSDI */ #endif /* BSDI */
#endif /* _ZEBRA_INTERFACE_H */

View File

@ -49,6 +49,10 @@ struct connected *if_lookup_linklocal( struct interface *);
#define AF_IOCTL(af, request, buffer) \ #define AF_IOCTL(af, request, buffer) \
((af) == AF_INET? if_ioctl(request, buffer) : \ ((af) == AF_INET? if_ioctl(request, buffer) : \
if_ioctl_ipv6(request, buffer)) if_ioctl_ipv6(request, buffer))
#else /* SOLARIS_IPV6 */
#define AF_IOCTL(af, request, buffer) if_ioctl(request, buffer)
#endif /* SOLARIS_IPV6 */ #endif /* SOLARIS_IPV6 */
#endif /* _ZEBRA_IOCTL_H */ #endif /* _ZEBRA_IOCTL_H */

View File

@ -80,10 +80,11 @@ if_ioctl (u_long request, caddr_t buffer)
return 0; return 0;
} }
#ifdef HAVE_IPV6
int int
if_ioctl_ipv6 (u_long request, caddr_t buffer) if_ioctl_ipv6 (u_long request, caddr_t buffer)
{ {
#ifdef HAVE_IPV6
int sock; int sock;
int ret = 0; int ret = 0;
int err = 0; int err = 0;
@ -116,9 +117,10 @@ if_ioctl_ipv6 (u_long request, caddr_t buffer)
errno = err; errno = err;
return ret; return ret;
} }
#endif /* HAVE_IPV6 */
return 0; return 0;
} }
#endif /* HAVE_IPV6 */
/* /*
* get interface metric * get interface metric
@ -134,8 +136,10 @@ if_get_metric (struct interface *ifp)
if (ifp->flags & IFF_IPV4) if (ifp->flags & IFF_IPV4)
ret = AF_IOCTL (AF_INET, SIOCGLIFMETRIC, (caddr_t) & lifreq); ret = AF_IOCTL (AF_INET, SIOCGLIFMETRIC, (caddr_t) & lifreq);
#ifdef SOLARIS_IPV6
else if (ifp->flags & IFF_IPV6) else if (ifp->flags & IFF_IPV6)
ret = AF_IOCTL (AF_INET6, SIOCGLIFMETRIC, (caddr_t) & lifreq); ret = AF_IOCTL (AF_INET6, SIOCGLIFMETRIC, (caddr_t) & lifreq);
#endif /* SOLARIS_IPV6 */
else else
ret = -1; ret = -1;
@ -171,10 +175,13 @@ if_get_mtu (struct interface *ifp)
} }
} }
#ifdef HAVE_IPV6
if ((ifp->flags & IFF_IPV6) == 0) if ((ifp->flags & IFF_IPV6) == 0)
return;
memset(&lifreq, 0, sizeof(lifreq));
lifreq_set_name (&lifreq, ifp); lifreq_set_name (&lifreq, ifp);
ret = AF_IOCTL (AF_INET6, SIOCGLIFMTU, (caddr_t) & lifreq); ret = AF_IOCTL (AF_INET6, SIOCGLIFMTU, (caddr_t) & lifreq);
if (ret < 0) if (ret < 0)
{ {
@ -185,6 +192,7 @@ if_get_mtu (struct interface *ifp)
{ {
ifp->mtu6 = lifreq.lifr_metric; ifp->mtu6 = lifreq.lifr_metric;
} }
#endif /* HAVE_IPV6 */
} }
/* Set up interface's address, netmask (and broadcast? ). /* Set up interface's address, netmask (and broadcast? ).

View File

@ -24,6 +24,7 @@
#define _ZEBRA_REDISTRIBUTE_H #define _ZEBRA_REDISTRIBUTE_H
#include "table.h" #include "table.h"
#include "zserv.h"
void zebra_redistribute_add (int, struct zserv *, int); void zebra_redistribute_add (int, struct zserv *, int);
void zebra_redistribute_delete (int, struct zserv *, int); void zebra_redistribute_delete (int, struct zserv *, int);

View File

@ -22,6 +22,8 @@
#ifndef _ZEBRA_ZSERV_H #ifndef _ZEBRA_ZSERV_H
#define _ZEBRA_ZSERV_H #define _ZEBRA_ZSERV_H
#include "rib.h"
/* Default port information. */ /* Default port information. */
#define ZEBRA_PORT 2600 #define ZEBRA_PORT 2600
#define ZEBRA_VTY_PORT 2601 #define ZEBRA_VTY_PORT 2601