Merge 'patch-tracking/4/proposed/netdef-solaris' into accepted
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index d413e5b..ef19bc4 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -1817,7 +1817,7 @@
/* same goes for as4_aggregator */
struct aspath *as4_path = NULL;
as_t as4_aggregator = 0;
- struct in_addr as4_aggregator_addr = { 0 };
+ struct in_addr as4_aggregator_addr = { .s_addr = 0 };
/* Initialize bitmap. */
memset (seen, 0, BGP_ATTR_BITMAP_SIZE);
diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c
index 0f4aeec..6a57834 100644
--- a/bgpd/bgp_snmp.c
+++ b/bgpd/bgp_snmp.c
@@ -121,7 +121,7 @@
oid bgp_trap_oid [] = { BGP4MIB, 0 };
/* IP address 0.0.0.0. */
-static struct in_addr bgp_empty_addr = {0};
+static struct in_addr bgp_empty_addr = { .s_addr = 0 };
/* Hook functions. */
static u_char *bgpVersion (struct variable *, oid [], size_t *, int,
diff --git a/configure.ac b/configure.ac
index 747a0c6..3003e62 100755
--- a/configure.ac
+++ b/configure.ac
@@ -792,7 +792,7 @@
strtol strtoul strlcat strlcpy \
daemon snprintf vsnprintf \
if_nametoindex if_indextoname getifaddrs \
- uname fcntl])
+ uname fcntl getgrouplist])
AC_CHECK_FUNCS(setproctitle, ,
[AC_CHECK_LIB(util, setproctitle,
diff --git a/isisd/isis_dlpi.c b/isisd/isis_dlpi.c
index 0a82718..b583d10 100644
--- a/isisd/isis_dlpi.c
+++ b/isisd/isis_dlpi.c
@@ -174,7 +174,7 @@
dl_ok_ack_t *doa = (dl_ok_ack_t *)dlpi_ctl;
retv = dlpirctl (fd);
- if (retv < DL_OK_ACK_SIZE || doa->dl_primitive != DL_OK_ACK ||
+ if (retv < (ssize_t)DL_OK_ACK_SIZE || doa->dl_primitive != DL_OK_ACK ||
doa->dl_correct_primitive != oprim)
{
return -1;
@@ -196,7 +196,7 @@
/* Info_req uses M_PCPROTO. */
dlpisend (fd, &dir, sizeof (dir), NULL, 0, RS_HIPRI);
retv = dlpirctl (fd);
- if (retv < DL_INFO_ACK_SIZE || dlpi_ctl[0] != DL_INFO_ACK)
+ if (retv < (ssize_t)DL_INFO_ACK_SIZE || dlpi_ctl[0] != DL_INFO_ACK)
return -1;
else
return retv;
@@ -251,7 +251,7 @@
dlpisend (fd, &dbr, sizeof (dbr), NULL, 0, 0);
retv = dlpirctl (fd);
- if (retv < DL_BIND_ACK_SIZE || dba->dl_primitive != DL_BIND_ACK)
+ if (retv < (ssize_t)DL_BIND_ACK_SIZE || dba->dl_primitive != DL_BIND_ACK)
return -1;
else
return 0;
@@ -287,12 +287,13 @@
dlpisend (fd, &dpar, sizeof (dpar), NULL, 0, 0);
retv = dlpirctl (fd);
- if (retv < DL_PHYS_ADDR_ACK_SIZE || dpaa->dl_primitive != DL_PHYS_ADDR_ACK)
+ if (retv < (ssize_t)DL_PHYS_ADDR_ACK_SIZE
+ || dpaa->dl_primitive != DL_PHYS_ADDR_ACK)
return -1;
if (dpaa->dl_addr_offset < DL_PHYS_ADDR_ACK_SIZE ||
dpaa->dl_addr_length != ETHERADDRL ||
- dpaa->dl_addr_offset + dpaa->dl_addr_length > retv)
+ dpaa->dl_addr_offset + dpaa->dl_addr_length > (size_t)retv)
return -1;
bcopy((char *)dpaa + dpaa->dl_addr_offset, addr, ETHERADDRL);
@@ -302,7 +303,7 @@
static int
open_dlpi_dev (struct isis_circuit *circuit)
{
- int fd, unit, retval;
+ int fd = -1, unit, retval;
char devpath[MAXPATHLEN];
dl_info_ack_t *dia = (dl_info_ack_t *)dlpi_ctl;
ssize_t acklen;
@@ -403,8 +404,8 @@
case DL_100BT:
break;
default:
- zlog_warn ("%s: unexpected mac type on %s: %d", __func__,
- circuit->interface->name, dia->dl_mac_type);
+ zlog_warn ("%s: unexpected mac type on %s: %lld", __func__,
+ circuit->interface->name, (long long)dia->dl_mac_type);
close (fd);
return ISIS_WARNING;
}
@@ -556,13 +557,13 @@
return ISIS_WARNING;
}
- if (ctlbuf.len < DL_UNITDATA_IND_SIZE ||
+ if (ctlbuf.len < (ssize_t)DL_UNITDATA_IND_SIZE ||
dui->dl_primitive != DL_UNITDATA_IND)
return ISIS_WARNING;
if (dui->dl_src_addr_length != ETHERADDRL + 2 ||
dui->dl_src_addr_offset < DL_UNITDATA_IND_SIZE ||
- dui->dl_src_addr_offset + dui->dl_src_addr_length > ctlbuf.len)
+ dui->dl_src_addr_offset + dui->dl_src_addr_length > (size_t)ctlbuf.len)
return ISIS_WARNING;
memcpy (ssnpa, (char *)dui + dui->dl_src_addr_offset +
@@ -588,9 +589,9 @@
int buflen;
buflen = stream_get_endp (circuit->snd_stream) + LLC_LEN;
- if (buflen > sizeof (sock_buff))
+ if ((size_t)buflen > sizeof (sock_buff))
{
- zlog_warn ("isis_send_pdu_bcast: sock_buff size %lu is less than "
+ zlog_warn ("isis_send_pdu_bcast: sock_buff size %zu is less than "
"output pdu size %d on circuit %s",
sizeof (sock_buff), buflen, circuit->interface->name);
return ISIS_WARNING;
diff --git a/isisd/topology/random.c b/isisd/topology/random.c
index c49c082..2c457c5 100644
--- a/isisd/topology/random.c
+++ b/isisd/topology/random.c
@@ -7,6 +7,7 @@
/* */
/*********************************************************************/
+#include <zebra.h>
#include <sys/types.h>
#include <sys/times.h>
diff --git a/isisd/topology/spacyc.c b/isisd/topology/spacyc.c
index 8531447..91a4799 100644
--- a/isisd/topology/spacyc.c
+++ b/isisd/topology/spacyc.c
@@ -1,3 +1,4 @@
+#include <zebra.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/isisd/topology/spgrid.c b/isisd/topology/spgrid.c
index 40147fb..22cfa7b 100644
--- a/isisd/topology/spgrid.c
+++ b/isisd/topology/spgrid.c
@@ -1,11 +1,11 @@
+#include <zebra.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "random.c"
-#include <zebra.h>
-
#include "thread.h"
#include "vty.h"
#include "log.h"
diff --git a/isisd/topology/sprand.c b/isisd/topology/sprand.c
index 28b58b3..1c1eb19 100644
--- a/isisd/topology/sprand.c
+++ b/isisd/topology/sprand.c
@@ -1,3 +1,5 @@
+#include <zebra.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/lib/getopt.c b/lib/getopt.c
index 064909d..7a58a8a 100644
--- a/lib/getopt.c
+++ b/lib/getopt.c
@@ -30,10 +30,6 @@
# define _NO_PROTO
#endif
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
#include <zebra.h>
#if !defined __STDC__ || !__STDC__
diff --git a/lib/getopt1.c b/lib/getopt1.c
index fa76674..bd3099e 100644
--- a/lib/getopt1.c
+++ b/lib/getopt1.c
@@ -20,10 +20,6 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include <zebra.h>
#include "getopt.h"
diff --git a/lib/privs.c b/lib/privs.c
index ff0be2f..0ca8783 100644
--- a/lib/privs.c
+++ b/lib/privs.c
@@ -622,6 +622,41 @@
return zprivs_null_state;
}
+#ifndef HAVE_GETGROUPLIST
+/* Solaris 11 has no getgrouplist() */
+static int
+getgrouplist(const char *user, gid_t group, gid_t *groups, int *ngroups)
+{
+ struct group *grp;
+ size_t usridx;
+ int pos = 0, ret;
+
+ if (pos < *ngroups)
+ groups[pos] = group;
+ pos++;
+
+ setgrent();
+ while ((grp = getgrent()))
+ {
+ if (grp->gr_gid == group)
+ continue;
+ for (usridx = 0; grp->gr_mem[usridx] != NULL; usridx++)
+ if (!strcmp (grp->gr_mem[usridx], user))
+ {
+ if (pos < *ngroups)
+ groups[pos] = grp->gr_gid;
+ pos++;
+ break;
+ }
+ }
+ endgrent();
+
+ ret = (pos <= *ngroups) ? pos : -1;
+ *ngroups = pos;
+ return ret;
+}
+#endif /* HAVE_GETGROUPLIST */
+
void
zprivs_init(struct zebra_privs_t *zprivs)
{
diff --git a/lib/stream.c b/lib/stream.c
index 9c26fea..ca1a40f 100644
--- a/lib/stream.c
+++ b/lib/stream.c
@@ -20,8 +20,8 @@
* 02111-1307, USA.
*/
-#include <stddef.h>
#include <zebra.h>
+#include <stddef.h>
#include "stream.h"
#include "memory.h"
diff --git a/lib/workqueue.c b/lib/workqueue.c
index 9fc8931..b1a5d5b 100644
--- a/lib/workqueue.c
+++ b/lib/workqueue.c
@@ -21,7 +21,7 @@
* 02111-1307, USA.
*/
-#include <lib/zebra.h>
+#include <zebra.h>
#include "thread.h"
#include "memory.h"
#include "workqueue.h"
diff --git a/lib/zebra.h b/lib/zebra.h
index 1ee5107..fe34be7 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -27,7 +27,6 @@
#ifdef SUNOS_5
#define _XPG4_2
-#define __EXTENSIONS__
typedef unsigned int u_int32_t;
typedef unsigned short u_int16_t;
typedef unsigned char u_int8_t;
diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c
index ef44e4c..307d420 100644
--- a/ospf6d/ospf6_snmp.c
+++ b/ospf6d/ospf6_snmp.c
@@ -628,7 +628,7 @@
int len;
oid *offset;
int offsetlen;
- struct ospf6_area *oa;
+ struct ospf6_area *oa = NULL;
struct listnode *node;
struct interface *iif;
struct ospf6_interface *oi = NULL;
diff --git a/ospfclient/Makefile.am b/ospfclient/Makefile.am
index 8a3ad21..1fca431 100644
--- a/ospfclient/Makefile.am
+++ b/ospfclient/Makefile.am
@@ -5,6 +5,7 @@
lib_LTLIBRARIES = libospfapiclient.la
libospfapiclient_la_LDFLAGS = -version-info 0:0:0
+libospfapiclient_la_LIBADD = ../ospfd/libospf.la ../lib/libzebra.la
sbin_PROGRAMS = ospfclient
diff --git a/ospfd/Makefile.am b/ospfd/Makefile.am
index 40f2cfe..f21f507 100644
--- a/ospfd/Makefile.am
+++ b/ospfd/Makefile.am
@@ -7,6 +7,7 @@
lib_LTLIBRARIES = libospf.la
libospf_la_LDFLAGS = -version-info 0:0:0
+libospf_la_LIBADD = ../lib/libzebra.la
sbin_PROGRAMS = ospfd
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index 73111e8..9a8f1d6 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -644,8 +644,8 @@
struct listnode *node;
#ifdef WANT_OSPF_WRITE_FRAGMENT
static u_int16_t ipid = 0;
-#endif /* WANT_OSPF_WRITE_FRAGMENT */
u_int16_t maxdatasize;
+#endif /* WANT_OSPF_WRITE_FRAGMENT */
#define OSPF_WRITE_IPHL_SHIFT 2
ospf->t_write = NULL;
@@ -659,7 +659,6 @@
/* seed ipid static with low order bits of time */
if (ipid == 0)
ipid = (time(NULL) & 0xffff);
-#endif /* WANT_OSPF_WRITE_FRAGMENT */
/* convenience - max OSPF data per packet,
* and reliability - not more data, than our
@@ -667,6 +666,7 @@
*/
maxdatasize = MIN (oi->ifp->mtu, ospf->maxsndbuflen) -
sizeof (struct ip);
+#endif /* WANT_OSPF_WRITE_FRAGMENT */
/* Get one packet from queue. */
op = ospf_fifo_head (oi->obuf);
diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c
index 604766d..1636153 100644
--- a/ospfd/ospf_snmp.c
+++ b/ospfd/ospf_snmp.c
@@ -213,7 +213,7 @@
oid ospf_trap_oid [] = { OSPF2MIB, 16, 2 }; /* Not reverse mappable! */
/* IP address 0.0.0.0. */
-static struct in_addr ospf_empty_addr = {0};
+static struct in_addr ospf_empty_addr = { .s_addr = 0 };
/* Hook functions. */
static u_char *ospfGeneralGroup (struct variable *, oid *, size_t *,
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 880edb9..69c04ec 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -20,10 +20,10 @@
$QuaggaId: $Format:%an, %ai, %h$ $
*/
-#include <sys/ioctl.h>
-
#include <zebra.h>
+#include <sys/ioctl.h>
+
#include "command.h"
#include "if.h"
#include "prefix.h"
diff --git a/pimd/pim_igmp_join.c b/pimd/pim_igmp_join.c
index 151b2af..62e32c6 100644
--- a/pimd/pim_igmp_join.c
+++ b/pimd/pim_igmp_join.c
@@ -20,6 +20,8 @@
$QuaggaId: $Format:%an, %ai, %h$ $
*/
+#include <zebra.h>
+
#include <sys/types.h>
#include <sys/socket.h>
#include <string.h>
diff --git a/pimd/pim_int.c b/pimd/pim_int.c
index 0bdd772..2080751 100644
--- a/pimd/pim_int.c
+++ b/pimd/pim_int.c
@@ -20,6 +20,8 @@
$QuaggaId: $Format:%an, %ai, %h$ $
*/
+#include <zebra.h>
+
#include <string.h>
#include <netinet/in.h>
#include <arpa/inet.h>
diff --git a/pimd/pim_signals.c b/pimd/pim_signals.c
index afd0259..3549331 100644
--- a/pimd/pim_signals.c
+++ b/pimd/pim_signals.c
@@ -20,9 +20,10 @@
$QuaggaId: $Format:%an, %ai, %h$ $
*/
+#include <zebra.h>
+
#include <signal.h>
-#include <zebra.h>
#include "sigevent.h"
#include "memory.h"
#include "log.h"
diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c
index 4816c56..2bb48f7 100644
--- a/pimd/pim_sock.c
+++ b/pimd/pim_sock.c
@@ -20,6 +20,7 @@
$QuaggaId: $Format:%an, %ai, %h$ $
*/
+#include <zebra.h>
#include "pim_mroute.h"
#include <sys/types.h>
@@ -31,7 +32,6 @@
#include <netdb.h>
#include <errno.h>
-#include <zebra.h>
#include "log.h"
#include "privs.h"
@@ -80,9 +80,9 @@
/* Needed to obtain destination address from recvmsg() */
{
#if defined(HAVE_IP_PKTINFO)
- /* Linux IP_PKTINFO */
+ /* Linux and Solaris IP_PKTINFO */
int opt = 1;
- if (setsockopt(fd, SOL_IP, IP_PKTINFO, &opt, sizeof(opt))) {
+ if (setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &opt, sizeof(opt))) {
zlog_warn("Could not set IP_PKTINFO on socket fd=%d: errno=%d: %s",
fd, errno, safe_strerror(errno));
}
@@ -306,7 +306,7 @@
cmsg = CMSG_NXTHDR(&msgh,cmsg)) {
#ifdef HAVE_IP_PKTINFO
- if ((cmsg->cmsg_level == SOL_IP) && (cmsg->cmsg_type == IP_PKTINFO)) {
+ if ((cmsg->cmsg_level == IPPROTO_IP) && (cmsg->cmsg_type == IP_PKTINFO)) {
struct in_pktinfo *i = (struct in_pktinfo *) CMSG_DATA(cmsg);
if (to)
((struct sockaddr_in *) to)->sin_addr = i->ipi_addr;
diff --git a/pimd/pim_ssmpingd.c b/pimd/pim_ssmpingd.c
index 82e0722..d564bf5 100644
--- a/pimd/pim_ssmpingd.c
+++ b/pimd/pim_ssmpingd.c
@@ -110,9 +110,9 @@
/* Needed to obtain destination address from recvmsg() */
{
#if defined(HAVE_IP_PKTINFO)
- /* Linux IP_PKTINFO */
+ /* Linux and Solaris IP_PKTINFO */
int opt = 1;
- if (setsockopt(fd, SOL_IP, IP_PKTINFO, &opt, sizeof(opt))) {
+ if (setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &opt, sizeof(opt))) {
zlog_warn("%s: could not set IP_PKTINFO on socket fd=%d: errno=%d: %s",
__PRETTY_FUNCTION__, fd, errno, safe_strerror(errno));
}
diff --git a/pimd/pim_static.c b/pimd/pim_static.c
index f2b8e85..e43c59a 100644
--- a/pimd/pim_static.c
+++ b/pimd/pim_static.c
@@ -20,6 +20,8 @@
$QuaggaId: $Format:%an, %ai, %h$ $
*/
+#include <zebra.h>
+
#include "pim_static.h"
#include "pim_time.h"
#include "pim_str.h"
@@ -40,7 +42,7 @@
s_route = XCALLOC(MTYPE_PIM_STATIC_ROUTE, sizeof(*s_route));
if (!s_route) {
- zlog_err("PIM XCALLOC(%lu) failure", sizeof(*s_route));
+ zlog_err("PIM XCALLOC(%u) failure", sizeof(*s_route));
return 0;
}
return s_route;
diff --git a/pimd/pim_str.c b/pimd/pim_str.c
index af5a184..3a8353c 100644
--- a/pimd/pim_str.c
+++ b/pimd/pim_str.c
@@ -20,12 +20,12 @@
$QuaggaId: $Format:%an, %ai, %h$ $
*/
+#include <zebra.h>
+
#include <stdio.h>
#include <errno.h>
#include <string.h>
-#include <zebra.h>
-
#include "log.h"
#include "pim_str.h"
diff --git a/pimd/pim_time.c b/pimd/pim_time.c
index 097b470..4e5832c 100644
--- a/pimd/pim_time.c
+++ b/pimd/pim_time.c
@@ -20,11 +20,12 @@
$QuaggaId: $Format:%an, %ai, %h$ $
*/
+#include <zebra.h>
+
#include <string.h>
#include <sys/time.h>
#include <time.h>
-#include <zebra.h>
#include "log.h"
#include "thread.h"
diff --git a/pimd/pim_version.c b/pimd/pim_version.c
index fe7e563..f3a5ee3 100644
--- a/pimd/pim_version.c
+++ b/pimd/pim_version.c
@@ -20,6 +20,8 @@
$QuaggaId: $Format:%an, %ai, %h$ $
*/
+#include <zebra.h>
+
#include "pim_version.h"
const char * const PIMD_VERSION = PIMD_VERSION_STR;
diff --git a/tests/prng.c b/tests/prng.c
index 8d78ea5..bdcfb07 100644
--- a/tests/prng.c
+++ b/tests/prng.c
@@ -23,6 +23,8 @@
* 02111-1307, USA.
*/
+#include <zebra.h>
+
#include <assert.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tests/test-cli.c b/tests/test-cli.c
index 3db44ee..6fab6d5 100644
--- a/tests/test-cli.c
+++ b/tests/test-cli.c
@@ -20,6 +20,8 @@
* 02111-1307, USA.
*/
+#include <zebra.h>
+
#include "common-cli.h"
DUMMY_DEFUN(cmd0, "arg ipv4 A.B.C.D");
diff --git a/tests/test-timer-correctness.c b/tests/test-timer-correctness.c
index 47c0b73..e523929 100644
--- a/tests/test-timer-correctness.c
+++ b/tests/test-timer-correctness.c
@@ -23,11 +23,11 @@
* 02111-1307, USA.
*/
+#include <zebra.h>
+
#include <stdio.h>
#include <unistd.h>
-#include <zebra.h>
-
#include "memory.h"
#include "pqueue.h"
#include "prng.h"
diff --git a/tests/test-timer-performance.c b/tests/test-timer-performance.c
index a529a5c..ee45ede 100644
--- a/tests/test-timer-performance.c
+++ b/tests/test-timer-performance.c
@@ -22,11 +22,12 @@
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
-#include <stdio.h>
-#include <unistd.h>
#include <zebra.h>
+#include <stdio.h>
+#include <unistd.h>
+
#include "thread.h"
#include "pqueue.h"
#include "prng.h"
diff --git a/zebra/Makefile.am b/zebra/Makefile.am
index 01779c9..96dc6f0 100644
--- a/zebra/Makefile.am
+++ b/zebra/Makefile.am
@@ -39,7 +39,8 @@
noinst_HEADERS = \
connected.h ioctl.h rib.h rt.h zserv.h redistribute.h debug.h rtadv.h \
interface.h ipforward.h irdp.h router-id.h kernel_socket.h \
- rt_netlink.h zebra_fpm.h zebra_fpm_private.h
+ rt_netlink.h zebra_fpm.h zebra_fpm_private.h \
+ ioctl_solaris.h
zebra_LDADD = $(otherobj) ../lib/libzebra.la $(LIBCAP)
diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c
index 3f33f74..50b4aca 100644
--- a/zebra/if_ioctl_solaris.c
+++ b/zebra/if_ioctl_solaris.c
@@ -33,15 +33,14 @@
#include "vrf.h"
#include "zebra/interface.h"
+#include "zebra/ioctl_solaris.h"
#include "zebra/rib.h"
-void lifreq_set_name (struct lifreq *, const char *);
-int if_get_flags_direct (const char *, uint64_t *, unsigned int af);
static int if_get_addr (struct interface *, struct sockaddr *, const char *);
static void interface_info_ioctl (struct interface *);
extern struct zebra_privs_t zserv_privs;
-int
+static int
interface_list_ioctl (int af)
{
int ret;
@@ -210,7 +209,7 @@
}
/* Get interface's index by ioctl. */
-int
+static int
if_get_index (struct interface *ifp)
{
int ret;
diff --git a/zebra/ioctl_solaris.c b/zebra/ioctl_solaris.c
index 16934f0..12737cb 100644
--- a/zebra/ioctl_solaris.c
+++ b/zebra/ioctl_solaris.c
@@ -32,6 +32,7 @@
#include "zebra/rib.h"
#include "zebra/rt.h"
#include "zebra/interface.h"
+#include "zebra/ioctl_solaris.h"
extern struct zebra_privs_t zserv_privs;
@@ -309,7 +310,7 @@
void
if_get_flags (struct interface *ifp)
{
- int ret4, ret6;
+ int ret4 = 0, ret6 = 0;
uint64_t newflags = 0;
uint64_t tmpflags;
@@ -410,7 +411,7 @@
char addrbuf[PREFIX_STRLEN];
zlog_warn ("Can't set %s on interface %s",
- prefix2str(ifc->address->prefix, addrbuf, sizeof(addrbuf)),
+ prefix2str(ifc->address, addrbuf, sizeof(addrbuf)),
ifp->name);
return 0;
@@ -423,7 +424,7 @@
char addrbuf[PREFIX_STRLEN];
zlog_warn ("Can't delete %s on interface %s",
- prefix2str(ifc->address->prefix, addrbuf, sizeof(addrbuf)),
+ prefix2str(ifc->address, addrbuf, sizeof(addrbuf)),
ifp->name);
return 0;
diff --git a/zebra/ioctl_solaris.h b/zebra/ioctl_solaris.h
new file mode 100644
index 0000000..188986b
--- /dev/null
+++ b/zebra/ioctl_solaris.h
@@ -0,0 +1,29 @@
+/*
+ * Interface looking up by ioctl () on Solaris.
+ * Copyright (C) 1999 Kunihiro Ishiguro
+ *
+ * This file is part of Quagga.
+ *
+ * Quagga is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * Quagga is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Quagga; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef _ZEBRA_IF_IOCTL_SOLARIS_H
+#define _ZEBRA_IF_IOCTL_SOLARIS_H
+
+void lifreq_set_name (struct lifreq *, const char *);
+int if_get_flags_direct (const char *, uint64_t *, unsigned int af);
+
+#endif /* _ZEBRA_IF_IOCTL_SOLARIS_H */
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index fd0d8fd..eded2bb 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -70,6 +70,12 @@
#define ROUNDUP(a) RT_ROUNDUP(a)
#endif /* defined(RT_ROUNDUP) */
+#if defined(SUNOS_5)
+/* Solaris has struct sockaddr_in[6] definitions at 16 / 32 bytes size,
+ * so the whole concept doesn't really apply. */
+#define ROUNDUP(a) (a)
+#endif
+
/*
* If ROUNDUP has not yet been defined in terms of platform-provided
* defines, attempt to cope with heuristics.
@@ -134,6 +140,8 @@
static inline void
rta_copy (union sockunion *dest, caddr_t src) {
int len;
+ if (!dest)
+ return;
#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
len = (((struct sockaddr *)src)->sa_len > sizeof (*dest)) ?
sizeof (*dest) : ((struct sockaddr *)src)->sa_len ;
@@ -148,8 +156,7 @@
if ((RTMADDRS) & (RTA)) \
{ \
int len = SAROUNDUP ((PNT)); \
- if ( ((DEST) != NULL) && \
- af_check (((struct sockaddr *)(PNT))->sa_family)) \
+ if (af_check (((struct sockaddr *)(PNT))->sa_family)) \
rta_copy((DEST), (PNT)); \
(PNT) += len; \
}
@@ -157,8 +164,7 @@
if ((RTMADDRS) & (RTA)) \
{ \
int len = SAROUNDUP ((PNT)); \
- if ((DEST) != NULL) \
- rta_copy((DEST), (PNT)); \
+ rta_copy((DEST), (PNT)); \
(PNT) += len; \
}
@@ -732,7 +738,9 @@
/* Unset interface index from link-local address when IPv6 stack
is KAME. */
if (IN6_IS_ADDR_LINKLOCAL (&addr.sin6.sin6_addr))
- SET_IN6_LINKLOCAL_IFINDEX (addr.sin6.sin6_addr, 0);
+ {
+ SET_IN6_LINKLOCAL_IFINDEX (addr.sin6.sin6_addr, 0);
+ }
if (ifam->ifam_type == RTM_NEWADDR)
connected_add_ipv6 (ifp, flags, &addr.sin6.sin6_addr,
@@ -1152,7 +1160,8 @@
zlog_debug ("Kernel: Len: %d Type: %s", rtm->rtm_msglen, lookup (rtm_type_str, rtm->rtm_type));
rtm_flag_dump (rtm->rtm_flags);
zlog_debug ("Kernel: message seq %d", rtm->rtm_seq);
- zlog_debug ("Kernel: pid %d, rtm_addrs 0x%x", rtm->rtm_pid, rtm->rtm_addrs);
+ zlog_debug ("Kernel: pid %lld, rtm_addrs 0x%x",
+ (long long)rtm->rtm_pid, rtm->rtm_addrs);
}
/* This is pretty gross, better suggestions welcome -- mhandler */
diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c
index bf21ca9..a7ef457 100644
--- a/zebra/rt_socket.c
+++ b/zebra/rt_socket.c
@@ -41,6 +41,7 @@
union sockunion *mask, union sockunion *gate,
unsigned int index, int zebra_flags, int metric);
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
/* Adjust netmask socket length. Return value is a adjusted sin_len
value. */
static int
@@ -63,6 +64,7 @@
len--;
return len;
}
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
/* Interface between zebra message and rtm message. */
static int
@@ -244,6 +246,7 @@
#ifdef HAVE_IPV6
+#ifdef SIN6_LEN
/* Calculate sin6_len value for netmask socket value. */
static int
sin6_masklen (struct in6_addr mask)
@@ -266,6 +269,7 @@
return len;
}
+#endif /* SIN6_LEN */
/* Interface between zebra message and rtm message. */
static int
@@ -368,6 +372,8 @@
zlog_info ("kernel_rtm_ipv6_multipath(): nexthop %d add error=%d.",
nexthop_num, error);
}
+#else
+ (void)error;
#endif
nexthop_num++;
diff --git a/zebra/rtread_getmsg.c b/zebra/rtread_getmsg.c
index 7fb916f..5057358 100644
--- a/zebra/rtread_getmsg.c
+++ b/zebra/rtread_getmsg.c
@@ -156,13 +156,13 @@
/* This is normal loop termination */
if (retval == 0 &&
- msgdata.len >= sizeof (struct T_optmgmt_ack) &&
+ (size_t)msgdata.len >= sizeof (struct T_optmgmt_ack) &&
TLIack->PRIM_type == T_OPTMGMT_ACK &&
TLIack->MGMT_flags == T_SUCCESS &&
MIB2hdr->len == 0)
break;
- if (msgdata.len >= sizeof (struct T_error_ack) &&
+ if ((size_t)msgdata.len >= sizeof (struct T_error_ack) &&
TLIerr->PRIM_type == T_ERROR_ACK) {
zlog_warn ("getmsg(ctl) returned T_ERROR_ACK: %s",
safe_strerror ((TLIerr->TLI_error == TSYSERR)
@@ -174,7 +174,7 @@
like what GateD does in this instance, but not
critical yet. */
if (retval != MOREDATA ||
- msgdata.len < sizeof (struct T_optmgmt_ack) ||
+ (size_t)msgdata.len < sizeof (struct T_optmgmt_ack) ||
TLIack->PRIM_type != T_OPTMGMT_ACK ||
TLIack->MGMT_flags != T_SUCCESS) {
errno = ENOMSG;