Browse Source

[autoconf] bugs 162,303,178: Fix 'present but can not be compiled' warnings

2007-05-09 Paul Jakma <paul.jakma@sun.com>

	* configure.ac: sys/conf.h depends on sys/param.h, at least on
	  FBSD 6.2.
	  (bug #363) Should check for in_pktinfo for IRDP

2006-05-27 Paul Jakma <paul.jakma@sun.com>

	* configure.ac: General cleanup of header and type checks, introducing
	  an internal define, QUAGGA_INCLUDES, to build up a list of
	  stuff to include so as to avoid 'present but cant be compiled'
	  warnings.
	  Misc additional checks of things missing according to autoscan.
	  Add LIBM, for bgpd's use of libm, so as to avoid burdening
	  LIBS, and all the binaries, with libm linkage.
	  Remove the bad practice of using m4 changequote(), just
	  quote the []'s in the case statements properly.
	  This should fix bugs 162, 303 and 178.
	* */*.{c,h}: Update all HAVE_* to the standard autoconf namespaced
	  HAVE_* defines. I.e. HAVE_SA_LEN -> HAVE_STRUCT_SOCKADDR_SA_LEN,
	* bgpd/Makefile.am: Add LIBM to bgpd's LDADD, for pow().
Paul Jakma 13 years ago
parent
commit
6f0e3f6e17
24 changed files with 360 additions and 326 deletions
  1. 22 0
      ChangeLog
  2. 1 1
      bgpd/Makefile.am
  3. 4 4
      bgpd/bgp_network.c
  4. 231 219
      configure.ac
  5. 3 3
      isisd/isis_circuit.c
  6. 2 2
      lib/if.h
  7. 2 2
      lib/smux.c
  8. 8 8
      lib/sockunion.c
  9. 2 2
      lib/vty.c
  10. 6 6
      lib/zclient.c
  11. 1 1
      lib/zebra.h
  12. 6 6
      ospfclient/ospf_apiclient.c
  13. 2 2
      ospfd/ospf_packet.c
  14. 6 6
      ripd/ripd.c
  15. 2 2
      vtysh/vtysh.c
  16. 3 3
      watchquagga/watchquagga.c
  17. 4 4
      zebra/interface.c
  18. 14 14
      zebra/ioctl.c
  19. 4 4
      zebra/kernel_socket.c
  20. 16 16
      zebra/rt_ioctl.c
  21. 8 8
      zebra/rt_socket.c
  22. 4 4
      zebra/rtadv.c
  23. 3 3
      zebra/rtadv.h
  24. 6 6
      zebra/zserv.c

+ 22 - 0
ChangeLog

@@ -1,3 +1,25 @@
+2007-05-09 Paul Jakma <paul.jakma@sun.com>
+
+	* configure.ac: sys/conf.h depends on sys/param.h, at least on
+	  FBSD 6.2.
+	  (bug #363) Should check for in_pktinfo for IRDP
+
+2006-05-27 Paul Jakma <paul.jakma@sun.com>
+
+	* configure.ac: General cleanup of header and type checks, introducing
+	  an internal define, QUAGGA_INCLUDES, to build up a list of
+	  stuff to include so as to avoid 'present but cant be compiled'
+	  warnings.
+	  Misc additional checks of things missing according to autoscan.
+	  Add LIBM, for bgpd's use of libm, so as to avoid burdening
+	  LIBS, and all the binaries, with libm linkage.
+	  Remove the bad practice of using m4 changequote(), just
+	  quote the []'s in the case statements properly.
+	  This should fix bugs 162, 303 and 178.
+	* */*.{c,h}: Update all HAVE_* to the standard autoconf namespaced
+	  HAVE_* defines. I.e. HAVE_SA_LEN -> HAVE_STRUCT_SOCKADDR_SA_LEN,
+	* bgpd/Makefile.am: Add LIBM to bgpd's LDADD, for pow().
+
 2007-04-30 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
 
 	* configure.ac: Change gcc CFLAGS from '-std=c99' to '-std=gnu99'

+ 1 - 1
bgpd/Makefile.am

@@ -22,7 +22,7 @@ noinst_HEADERS = \
 	bgp_advertise.h bgp_snmp.h bgp_vty.h
 
 bgpd_SOURCES = bgp_main.c
-bgpd_LDADD = libbgp.a ../lib/libzebra.la @LIBCAP@
+bgpd_LDADD = libbgp.a ../lib/libzebra.la @LIBCAP@ @LIBM@
 
 examplesdir = $(exampledir)
 dist_examples_DATA = bgpd.conf.sample bgpd.conf.sample2

+ 4 - 4
bgpd/bgp_network.c

@@ -159,9 +159,9 @@ bgp_bind_address (int sock, struct in_addr *addr)
 
   memset (&local, 0, sizeof (struct sockaddr_in));
   local.sin_family = AF_INET;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   local.sin_len = sizeof(struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
   memcpy (&local.sin_addr, addr, sizeof (struct in_addr));
 
   if ( bgpd_privs.change (ZPRIVS_RAISE) )
@@ -379,9 +379,9 @@ bgp_socket (struct bgp *bgp, unsigned short port)
   sin.sin_family = AF_INET;
   sin.sin_port = htons (port);
   socklen = sizeof (struct sockaddr_in);
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   sin.sin_len = socklen;
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
 
   if ( bgpd_privs.change (ZPRIVS_RAISE) )
     zlog_err ("bgp_socket: could not raise privs");

+ 231 - 219
configure.ac

@@ -143,9 +143,9 @@ dnl --------------
 dnl Check programs
 dnl --------------
 AC_PROG_INSTALL
+AC_PROG_LN_S
 AC_PROG_MAKE_SET
 AC_CHECK_TOOL(AR, ar)
-AC_CHECK_TOOL(RANLIB, ranlib, :)
 
 dnl ---------------------------
 dnl We, perhaps unfortunately,
@@ -268,8 +268,7 @@ fi
 if test "${enable_broken_aliases}" = "yes"; then
   if test "${enable_netlink}" = "yes"
   then
-    echo "Sorry, you can't use netlink with broken aliases"
-    exit 1
+    AC_MSG_FAILURE([Sorry you can not use netlink with broken aliases])
   fi
   AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
   enable_netlink=no
@@ -342,46 +341,130 @@ AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config f
 enable_logfile_mask=${enable_logfile_mask:-0600}
 AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
 
-changequote(, )dnl
-
 MULTIPATH_NUM=1
 
 case "${enable_multipath}" in
-  [0-9]|[1-9][0-9])
+  [[0-9]|[1-9][0-9]])
     MULTIPATH_NUM="${enable_multipath}"
     ;;
   "")
     ;;
   *)           
-    echo "Please specify digit to --enable-multipath ARG."
-    exit 1
+    AC_MSG_FAILURE([Please specify digit to enable multipath ARG])
     ;;
 esac
 
-changequote([, ])dnl
-
 AC_SUBST(MULTIPATH_NUM)
 
-dnl -------------------
-dnl Check header files.
-dnl -------------------
+dnl ------------------------------------
+dnl Check C keywords and standard  types
+dnl ------------------------------------
+AC_C_CONST
+AC_C_INLINE
+AC_C_RESTRICT
+AC_C_VOLATILE
 AC_HEADER_STDC
-AC_CHECK_HEADERS([string.h stropts.h sys/conf.h sys/ksym.h sys/time.h \
-                 sys/times.h sys/select.h sys/sysctl.h sys/sockio.h \
-                 sys/types.h linux/version.h kvm.h netdb.h asm/types.h \
-                 sys/param.h libutil.h limits.h stdint.h])
+AC_HEADER_TIME
+AC_HEADER_SYS_WAIT
+dnl AC_TYPE_PID_T
+AC_TYPE_UID_T
+AC_TYPE_MODE_T
+AC_TYPE_SIZE_T
+AC_TYPE_SIGNAL
+AC_STRUCT_TM
 
-AC_CHECK_HEADERS([sys/socket.h netinet/in_systm.h netinet/in.h \
-		 net/if_dl.h net/netopt.h inet/nd.h net/route.h \
-		 net/if.h net/if_var.h netinet/in_var.h])
+dnl -------------------------
+dnl Check other header files.
+dnl -------------------------
+AC_CHECK_HEADERS([stropts.h sys/ksym.h sys/times.h sys/select.h \
+	sys/types.h linux/version.h netdb.h asm/types.h \
+	sys/param.h limits.h signal.h libutil.h \
+	sys/socket.h netinet/in.h])
+
+dnl Utility macro to avoid retyping includes all the time
+m4_define([QUAGGA_INCLUDES],
+[#ifdef SUNOS_5
+#define _XPG4_2
+#define __EXTENSIONS__
+#endif
+#include <stdio.h>
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+/* sys/conf.h depends on param.h on FBSD at least */
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+/* Required for MAXSIG */
+#if HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+#if HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+])dnl
+
+AC_CHECK_HEADERS([sys/un.h net/if.h netinet/in_systm.h netinet/in_var.h \
+	net/if_dl.h net/if_var.h net/netopt.h net/route.h \
+	inet/nd.h arpa/inet.h \
+	fcntl.h stddef.h sys/ioctl.h syslog.h wchar.h wctype.h \
+	sys/sysctl.h sys/sockio.h kvm.h sys/conf.h],
+	[], [], QUAGGA_INCLUDES)
+
+AC_CHECK_HEADERS([ucontext.h], [], [],
+[#ifndef __USE_GNU
+#define __USE_GNU
+#endif /* __USE_GNU */
+QUAGGA_INCLUDES
+])
+
+m4_define([QUAGGA_INCLUDES],
+QUAGGA_INCLUDES
+[#if HAVE_NET_IF_H
+# include <net/if.h>
+#endif
+#if HAVE_SYS_UN_H
+# include <sys/un.h>
+#endif
+#if HAVE_NETINET_IN_SYSTM_H
+# include <netinet/in_systm.h>
+#endif
+#if HAVE_NETINET_IN_VAR_H
+# include <netinet/in_var.h>
+#endif
+#if HAVE_NET_IF_DL_H
+# include <net/if_dl.h>
+#endif
+#if HAVE_NET_IF_VAR_H
+# include <net/if_var.h>
+#endif
+#if HAVE_NET_NETOPT_H
+# include <net/netopt.h>
+#endif
+#if HAVE_NET_ROUTE_H
+# include <net/route.h>
+#endif
+#if HAVE_INET_ND_H
+# include <inet/nd.h>
+#endif
+#if HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+#endif
+])dnl
 
 dnl V6 headers are checked below, after we check for v6
 
-dnl check some types
-AC_C_CONST
-dnl AC_TYPE_PID_T
-AC_TYPE_SIGNAL
-
 dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
 case "$host" in
   [*-sunos5.[6-7]*] | [*-solaris2.[6-7]*])
@@ -446,7 +529,7 @@ case "${enable_vtysh}" in
          AC_DEFINE(VTYSH,,VTY shell)
 	 AC_PATH_PROG(PERL, perl)
 dnl	 Vtysh uses libreadline, which looks for termcap functions at
-dnl	 configure time.  We follow readline's search order.
+dnl	 configure time.  We follow readlines search order.
 dnl	 The required procedures are in libtermcap on NetBSD, in
 dnl	 [TODO] on Linux, and in [TODO] on Solaris.
 	 AC_CHECK_LIB(termcap, tputs, LIBREADLINE="$LIBREADLINE -ltermcap",
@@ -481,18 +564,18 @@ dnl ----------
 dnl PAM module
 dnl ----------
 if test "$with_libpam" = "yes"; then
-  AC_CHECK_HEADER(security/pam_misc.h)
-  if test "$ac_cv_header_security_pam_misc_h" = yes; then
-    AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
-    AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
-    pam_conv_func="misc_conv"
-  fi
-  AC_CHECK_HEADER(security/openpam.h)
-  if test "$ac_cv_header_security_openpam_h" = yes; then
-    AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
-    AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
-    pam_conv_func="openpam_ttyconv"
-  fi
+  AC_CHECK_HEADER([security/pam_misc.h],
+    [AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
+     AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
+     pam_conv_func="misc_conv"
+    ],
+    [], QUAGGA_INCLUDES)
+  AC_CHECK_HEADER([security/openpam.h],
+    [AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
+     AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
+     pam_conv_func="openpam_ttyconv"
+    ],
+    [], QUAGGA_INCLUDES)
   if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
     AC_MSG_WARN([*** pam support will not be built ***])
     with_libpam="no"
@@ -500,7 +583,7 @@ if test "$with_libpam" = "yes"; then
 fi
 
 if test "$with_libpam" = "yes"; then
-dnl took this test from proftpd's configure.in and suited to our needs
+dnl took this test from proftpds configure.in and suited to our needs
 dnl -------------------------------------------------------------------------
 dnl
 dnl This next check looks funky due to a linker problem with some versions
@@ -546,9 +629,51 @@ dnl AC_CHECK_SIZEOF(long)
 dnl ----------------------------
 dnl check existance of functions
 dnl ----------------------------
-AC_CHECK_FUNCS(memset memcpy strerror inet_aton daemon snprintf vsnprintf \
-               strlcat strlcpy if_nametoindex if_indextoname getifaddrs \
-	       fcntl strnlen strndup)
+AC_FUNC_CHOWN
+AC_FUNC_FNMATCH
+AC_FUNC_FORK
+AC_FUNC_MALLOC
+AC_FUNC_MEMCMP
+AC_FUNC_MKTIME
+AC_FUNC_STRFTIME
+AC_FUNC_REALLOC
+AC_FUNC_STAT
+AC_FUNC_SELECT_ARGTYPES
+AC_FUNC_STRFTIME
+AC_FUNC_STRNLEN
+AC_FUNC_VPRINTF
+
+dnl -------------------------------
+dnl bgpd needs pow() and hence libm
+dnl -------------------------------
+TMPLIBS="$LIBS"
+AC_CHECK_HEADER([math.h],
+  [AC_CHECK_LIB([m], [pow],
+    [LIBM="-lm"
+     LIBS="$LIBS $LIBM"
+     AC_DEFINE(HAVE_LIBM,, Have libm)
+     AC_CHECK_FUNCS(pow,[],[LIBM=""])
+    ])
+])
+if test x"$LIBM" = x ; then
+  AC_MSG_WARN([Unable to find working pow function - bgpd may not link])
+fi
+LIBS="$TMPLIBS"
+AC_SUBST(LIBM)
+
+dnl ---------------
+dnl other functions
+dnl ---------------
+AC_CHECK_FUNCS([dup2 ftruncate getcwd gethostbyname getpagesize gettimeofday \
+	inet_ntoa \
+	memchr memmove memset select socket \
+	strcasecmp strchr strcspn strdup strerror \
+	strncasecmp strndup strrchr strspn strstr \
+	strtol strtoul strlcat strlcpy \
+	daemon snprintf vsnprintf \
+	if_nametoindex if_indextoname getifaddrs \
+	uname fcntl])
+
 AC_CHECK_FUNCS(setproctitle, ,
   [AC_CHECK_LIB(util, setproctitle, 
      [LIBS="$LIBS -lutil"
@@ -626,9 +751,15 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #define _XPG4_2
 #define __EXTENSIONS__
 #endif
-#include <stdlib.h>
+#ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
+#endif
 
 main()
 {
@@ -707,12 +838,7 @@ AC_SUBST(IOCTL_METHOD)
 dnl ---------------------------------------------------------------
 dnl figure out how to specify an interface in multicast sockets API
 dnl ---------------------------------------------------------------
-AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex],,,[#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif])
+AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [], [], QUAGGA_INCLUDES)
 
 AC_MSG_CHECKING([for BSD struct ip_mreq hack])
 AC_TRY_COMPILE([#ifdef HAVE_SYS_PARAM_H
@@ -911,9 +1037,29 @@ dnl IPv6 header checks
 dnl ------------------
 if test "x${zebra_cv_ipv6}" = "xyes"; then
 AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
-		 netinet6/in6_var.h netinet6/nd6.h])
+	netinet6/in6_var.h netinet6/nd6.h], [], [],
+	QUAGGA_INCLUDES)
 fi
 
+m4_define([QUAGGA_INCLUDES],dnl
+QUAGGA_INCLUDES
+[#if HAVE_NETINET6_IN6_H
+#include <netinet6/in6.h>
+#endif
+#if HAVE_NETINET_IN6_VAR_H
+#include <netinet/in6_var.h>
+#endif
+#if HAVE_NETINET_ICMP6_H
+# include <netinet/icmp6.h>
+#endif
+#if HAVE_NETINET6_IN6_VAR_H
+# include <netinet6/in6_var.h>
+#endif
+#if HAVE_NETINET6_ND6_H
+# include <netinet6/nd.h>
+#endif
+])dnl
+
 dnl --------------------
 dnl Daemon disable check
 dnl --------------------
@@ -998,7 +1144,6 @@ AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
 AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
 AC_CHECK_LIB(crypt, crypt)
 AC_CHECK_LIB(resolv, res_init)
-AC_CHECK_LIB(m, main)
 
 dnl ---------------------------------------------------
 dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
@@ -1047,154 +1192,35 @@ if test "${enable_snmp}" = "yes"; then
     AC_SUBST(SNMP_INCLUDES)
 fi
 
-dnl ----------------------------
-dnl check sa_len of sockaddr
-dnl ----------------------------
-AC_MSG_CHECKING(whether struct sockaddr has a sa_len field)
-AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/socket.h>
-],[static struct sockaddr ac_i;int ac_j = sizeof (ac_i.sa_len);],
-[AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SA_LEN,,sa_len)],
- AC_MSG_RESULT(no))
-
-dnl ----------------------------
-dnl check sin_len of sockaddr_in
-dnl ----------------------------
-AC_MSG_CHECKING(whether struct sockaddr_in has a sin_len field)
-AC_TRY_COMPILE([#include <sys/types.h>
-#include <netinet/in.h>
-],[static struct sockaddr_in ac_i;int ac_j = sizeof (ac_i.sin_len);],
-[AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
- AC_MSG_RESULT(no))
-
-dnl ----------------------------
-dnl check sun_len of sockaddr_un
-dnl ----------------------------
-AC_MSG_CHECKING(whether struct sockaddr_un has a sun_len field)
-AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/un.h>
-],[static struct sockaddr_un ac_i;int ac_j = sizeof (ac_i.sun_len);],
-[AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SUN_LEN,,sun_len)],
- AC_MSG_RESULT(no))
-
-dnl -----------------------------------
-dnl check sin6_scope_id of sockaddr_in6
-dnl -----------------------------------
-if test "$zebra_cv_ipv6" = yes; then
-  AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
-  AC_TRY_COMPILE([#include <sys/types.h>
-#include <netinet/in.h>
-],[static struct sockaddr_in6 ac_i;int ac_j = sizeof (ac_i.sin6_scope_id);],
-[AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SIN6_SCOPE_ID,,scope id)],
- AC_MSG_RESULT(no))
-fi
-
-dnl ----------------------------
-dnl check socklen_t exist or not
-dnl ----------------------------
-AC_MSG_CHECKING(whther socklen_t is defined)
-AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-],[socklen_t ac_x;],
-[AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SOCKLEN_T,,socklen_t)],
- AC_MSG_RESULT(no))
-
-dnl ------------------------
-dnl check struct sockaddr_dl
-dnl ------------------------
-AC_MSG_CHECKING(whether struct sockaddr_dl exist)
-AC_EGREP_HEADER(sockaddr_dl,
-net/if_dl.h,
-[AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SOCKADDR_DL,,sockaddr_dl)],
- AC_MSG_RESULT(no))
-
-dnl --------------------------
-dnl check structure ifaliasreq
-dnl --------------------------
-AC_MSG_CHECKING(whether struct ifaliasreq exist)
-AC_EGREP_HEADER(ifaliasreq,
-net/if.h,
-[AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_IFALIASREQ,,ifaliasreq)],
- AC_MSG_RESULT(no))
-
-dnl ----------------------------
-dnl check structure in6_aliasreq
-dnl ----------------------------
-AC_MSG_CHECKING(whether struct in6_aliasreq exist)
-AC_EGREP_HEADER(in6_aliasreq,
-netinet6/in6_var.h,
-[AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_IN6_ALIASREQ,,in6_aliasreq)],
- AC_MSG_RESULT(no))
-
-dnl -----------------------------------
-dnl check ifra_lifetime of in6_aliasreq
-dnl -----------------------------------
-AC_MSG_CHECKING(whether in6_aliasreq.ifra_lifetime exist)
-AC_TRY_COMPILE([#include <sys/types.h>
-#include <netinet6/in6_var.h>
-],[static struct if6_aliasreq ac_i;int ac_j = sizeof (ac_i.ifra_lifetime);],
-[AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_IFRA_LIFETIME,,Have in6_aliasreq.ifra_lifetime)],
- AC_MSG_RESULT(no))
-
 dnl ---------------------------
-dnl check structure rt_addrinfo
+dnl sockaddr and netinet checks
 dnl ---------------------------
-AC_MSG_CHECKING(whether struct rt_addrinfo exist)
-AC_EGREP_HEADER(rt_addrinfo,
-net/route.h,
-[AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_RT_ADDRINFO,,rt_addrinfo)],
- AC_MSG_RESULT(no))
-
-dnl --------------------------
-dnl check structure in_pktinfo
-dnl --------------------------
-AC_MSG_CHECKING(whether struct in_pktinfo exist)
-AC_TRY_COMPILE([#include <netinet/in.h>
-],[struct in_pktinfo ac_x;],
-[AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_INPKTINFO,,in_pktinfo)],
- AC_MSG_RESULT(no))
-
-dnl ----------------------------------
-dnl check struct nd_opt_homeagent_info
-dnl ----------------------------------
-AC_MSG_CHECKING(whether struct nd_opt_homeagent_info exist)
-AC_EGREP_HEADER(nd_opt_homeagent_info,
-netinet/icmp6.h,
-[AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_ND_OPT_HOMEAGENT_INFO,,nd_opt_homeagent_info)],
- AC_MSG_RESULT(no))
+AC_CHECK_TYPES([struct sockaddr, struct sockaddr_in,
+	struct sockaddr_in6, struct sockaddr_un, struct sockaddr_dl,
+	socklen_t,
+	struct ifaliasreq, struct if6_aliasreq, struct in6_aliasreq,
+	struct nd_opt_adv_interval, struct rt_addrinfo,
+	struct nd_opt_homeagent_info, struct nd_opt_adv_interval,
+	struct in_pktinfo],
+	[], [], QUAGGA_INCLUDES)
+
+AC_CHECK_MEMBERS([struct sockaddr.sa_len,
+	struct sockaddr_in.sin_len, struct sockaddr_un.sun_len,
+	struct sockaddr_in6.sin6_scope_id,
+	struct if6_aliasreq.ifra_lifetime,
+	struct nd_opt_adv_interval.nd_opt_ai_type],
+	[], [], QUAGGA_INCLUDES)
 
-dnl --------------------------------
-dnl check struct nd_opt_adv_interval
-dnl --------------------------------
-AC_MSG_CHECKING(whether struct nd_opt_adv_interval exist)
-AC_EGREP_HEADER(nd_opt_adv_interval,
-netinet/icmp6.h,
-[AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_ND_OPT_ADV_INTERVAL,,nd_opt_adv_interval)],
- AC_MSG_RESULT(no))
-
-dnl ------------------------------------
-dnl check fields in  nd_opt_adv_interval
-dnl ------------------------------------
-AC_MSG_CHECKING(whether nd_opt_ai_type field exist)
-AC_EGREP_HEADER(nd_opt_ai_type,
-netinet/icmp6.h,
-[AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_ND_OPT_ADV_INTERVAL_AI_FIELDS,,nd_opt_ai_type)],
- AC_MSG_RESULT(no))
+dnl ---------------------------
+dnl pktinfo checks
+dnl ---------------------------
+AC_CHECK_TYPES([struct in_pktinfo], 
+ [if test "${enable_irdp}" != "no"; then
+    AC_DEFINE(HAVE_IRDP,, IRDP)
+  fi],
+ [if test "${enable_irdp}" = "yes"; then
+    AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
+  fi], [QUAGGA_INCLUDES])
 
 dnl --------------------------------------
 dnl checking for getrusage struct and call
@@ -1245,11 +1271,6 @@ if test "${enable_capabilities}" != "no"; then
 fi
 AC_SUBST(LIBCAP)
 
-dnl -------------------
-dnl test for ucontext.h
-dnl -------------------
-AC_CHECK_HEADERS(ucontext.h)
-
 dnl ---------------------------
 dnl check for glibc 'backtrace'
 dnl --------------------------- 
@@ -1269,7 +1290,7 @@ dnl order to check no alternative allocator
 dnl has been specified, which might not provide
 dnl mallinfo, e.g. such as Umem on Solaris.
 dnl -----------------------------------------
-AC_CHECK_HEADERS(malloc.h,
+AC_CHECK_HEADER([malloc.h],
  [AC_MSG_CHECKING(whether mallinfo is available)
   AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],
                         [[struct mallinfo ac_x; ac_x = mallinfo ();]])],
@@ -1277,8 +1298,7 @@ AC_CHECK_HEADERS(malloc.h,
        AC_DEFINE(HAVE_MALLINFO,,mallinfo)],
        AC_MSG_RESULT(no)
   )
- ]
-)
+ ], [], QUAGGA_INCLUDES)
 
 dnl ----------
 dnl configure date
@@ -1347,19 +1367,11 @@ dnl ---------------------------
 dnl Check htonl works correctly
 dnl ---------------------------
 AC_MSG_CHECKING(for working htonl)
-AC_CACHE_VAL(ac_cv_htonl_works, [
-AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif],
-[htonl (0);],
-ac_cv_htonl_works=yes,
-ac_cv_htonl_works=no)])
+AC_CACHE_VAL(ac_cv_htonl_works,
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([QUAGGA_INCLUDES],[htonl (0);])],
+ 		[ac_cv_htonl_works=yes], [ac_cv_htonl_works=no])
+ ]
+)
 AC_MSG_RESULT($ac_cv_htonl_works)
 
 AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile 
@@ -1378,7 +1390,6 @@ AC_CONFIG_FILES([solaris/Makefile])
 AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
 ## Hack, but working solution to avoid rebuilding of quagga.info.
 ## It's already in CVS until texinfo 4.7 is more common.
-AC_CONFIG_COMMANDS([info-time],[touch doc/quagga.info])
 AC_OUTPUT
 
 echo "
@@ -1389,8 +1400,9 @@ host operationg system  : ${host_os}
 source code location    : ${srcdir}
 compiler                : ${CC}
 compiler flags          : ${CFLAGS}
+make                    : ${MAKE-make}
 includes                : ${INCLUDES} ${SNMP_INCLUDES}
-linker flags            : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE}
+linker flags            : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM}
 state file directory    : ${quagga_statedir}
 config file directory   : `eval echo \`echo ${sysconfdir}\``
 example directory       : `eval echo \`echo ${exampledir}\``

+ 3 - 3
isisd/isis_circuit.c

@@ -380,7 +380,7 @@ isis_circuit_if_add (struct isis_circuit *circuit, struct interface *ifp)
       /*
        * Get the Hardware Address
        */
-#ifdef HAVE_SOCKADDR_DL
+#ifdef HAVE_STRUCT_SOCKADDR_DL
       if (circuit->interface->sdl.sdl_alen != ETHER_ADDR_LEN)
 	zlog_warn ("unsupported link layer");
       else
@@ -401,7 +401,7 @@ isis_circuit_if_add (struct isis_circuit *circuit, struct interface *ifp)
 		 snpa_print (circuit->u.bc.snpa));
 
 #endif /* EXTREME_DEBUG */
-#endif /* HAVE_SOCKADDR_DL */
+#endif /* HAVE_STRUCT_SOCKADDR_DL */
     }
   else if (if_is_pointopoint (ifp))
     {
@@ -446,7 +446,7 @@ isis_circuit_update_params (struct isis_circuit *circuit,
   /*
    * Get the Hardware Address
    */
-#ifdef HAVE_SOCKADDR_DL
+#ifdef HAVE_STRUCT_SOCKADDR_DL
   if (circuit->interface->sdl.sdl_alen != ETHER_ADDR_LEN)
     zlog_warn ("unsupported link layer");
   else

+ 2 - 2
lib/if.h

@@ -102,13 +102,13 @@ struct interface
   unsigned int mtu6;   /* IPv6 MTU - probably, but not neccessarily same as mtu */
 
   /* Hardware address. */
-#ifdef HAVE_SOCKADDR_DL
+#ifdef HAVE_STRUCT_SOCKADDR_DL
   struct sockaddr_dl sdl;
 #else
   unsigned short hw_type;
   u_char hw_addr[INTERFACE_HWADDR_MAX];
   int hw_addr_len;
-#endif /* HAVE_SOCKADDR_DL */
+#endif /* HAVE_STRUCT_SOCKADDR_DL */
 
   /* interface bandwidth, kbits */
   unsigned int bandwidth;

+ 2 - 2
lib/smux.c

@@ -237,9 +237,9 @@ smux_socket ()
 
   memset (&serv, 0, sizeof (struct sockaddr_in));
   serv.sin_family = AF_INET;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   serv.sin_len = sizeof (struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
 
   sp = getservbyname ("smux", "tcp");
   if (sp != NULL) 

+ 8 - 8
lib/sockunion.c

@@ -143,9 +143,9 @@ str2sockunion (const char *str, union sockunion *su)
   if (ret > 0)			/* Valid IPv4 address format. */
     {
       su->sin.sin_family = AF_INET;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
       su->sin.sin_len = sizeof(struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
       return 0;
     }
 #ifdef HAVE_IPV6
@@ -187,9 +187,9 @@ sockunion_str2su (const char *str)
   if (ret > 0)			/* Valid IPv4 address format. */
     {
       su->sin.sin_family = AF_INET;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
       su->sin.sin_len = sizeof(struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
       return su;
     }
 #ifdef HAVE_IPV6
@@ -342,12 +342,12 @@ sockunion_connect (int fd, union sockunion *peersu, unsigned short port,
 #ifdef KAME
       if (IN6_IS_ADDR_LINKLOCAL(&su.sin6.sin6_addr) && ifindex)
 	{
-#ifdef HAVE_SIN6_SCOPE_ID
+#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
 	  /* su.sin6.sin6_scope_id = ifindex; */
 #ifdef MUSICA
 	  su.sin6.sin6_scope_id = ifindex; 
 #endif
-#endif /* HAVE_SIN6_SCOPE_ID */
+#endif /* HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID */
 #ifndef MUSICA
 	  SET_IN6_LINKLOCAL_IFINDEX (su.sin6.sin6_addr, ifindex);
 #endif
@@ -416,9 +416,9 @@ sockunion_bind (int sock, union sockunion *su, unsigned short port,
     {
       size = sizeof (struct sockaddr_in);
       su->sin.sin_port = htons (port);
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
       su->sin.sin_len = size;
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
       if (su_addr == NULL)
 	su->sin.sin_addr.s_addr = htonl (INADDR_ANY);
     }

+ 2 - 2
lib/vty.c

@@ -1924,11 +1924,11 @@ vty_serv_un (const char *path)
   memset (&serv, 0, sizeof (struct sockaddr_un));
   serv.sun_family = AF_UNIX;
   strncpy (serv.sun_path, path, strlen (path));
-#ifdef HAVE_SUN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
   len = serv.sun_len = SUN_LEN(&serv);
 #else
   len = sizeof (serv.sun_family) + strlen (serv.sun_path);
-#endif /* HAVE_SUN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_UN_SUN_LEN */
 
   ret = bind (sock, (struct sockaddr *) &serv, len);
   if (ret < 0)

+ 6 - 6
lib/zclient.c

@@ -164,9 +164,9 @@ zclient_socket(void)
   memset (&serv, 0, sizeof (struct sockaddr_in));
   serv.sin_family = AF_INET;
   serv.sin_port = htons (ZEBRA_PORT);
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   serv.sin_len = sizeof (struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
   serv.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
 
   /* Connect to zebra. */
@@ -197,11 +197,11 @@ zclient_socket_un (const char *path)
   memset (&addr, 0, sizeof (struct sockaddr_un));
   addr.sun_family = AF_UNIX;
   strncpy (addr.sun_path, path, strlen (path));
-#ifdef HAVE_SUN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
   len = addr.sun_len = SUN_LEN(&addr);
 #else
   len = sizeof (addr.sun_family) + strlen (addr.sun_path);
-#endif /* HAVE_SUN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_UN_SUN_LEN */
 
   ret = connect (sock, (struct sockaddr *) &addr, len);
   if (ret < 0)
@@ -625,13 +625,13 @@ zebra_interface_add_read (struct stream *s)
   ifp->mtu = stream_getl (s);
   ifp->mtu6 = stream_getl (s);
   ifp->bandwidth = stream_getl (s);
-#ifdef HAVE_SOCKADDR_DL
+#ifdef HAVE_STRUCT_SOCKADDR_DL
   stream_get (&ifp->sdl, s, sizeof (ifp->sdl));
 #else
   ifp->hw_addr_len = stream_getl (s);
   if (ifp->hw_addr_len)
     stream_get (ifp->hw_addr, s, ifp->hw_addr_len);
-#endif /* HAVE_SOCKADDR_DL */
+#endif /* HAVE_STRUCT_SOCKADDR_DL */
   
   return ifp;
 }

+ 1 - 1
lib/zebra.h

@@ -312,7 +312,7 @@ typedef int socklen_t;
 
 /*  The definition of struct in_pktinfo is missing in old version of
     GLIBC 2.1 (Redhat 6.1).  */
-#if defined (GNU_LINUX) && ! defined (HAVE_INPKTINFO)
+#if defined (GNU_LINUX) && ! defined (HAVE_STRUCT_IN_PKTINFO)
 struct in_pktinfo
 {
   int ipi_ifindex;

+ 6 - 6
ospfclient/ospf_apiclient.c

@@ -118,9 +118,9 @@ ospf_apiclient_connect (char *host, int syncport)
   myaddr_async.sin_addr.s_addr = htonl (INADDR_ANY);
   myaddr_async.sin_port = htons (syncport+1);
   size = sizeof (struct sockaddr_in);
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   myaddr_async.sin_len = size;
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
 
   /* This is a server socket, reuse addr and port */
   ret = setsockopt (async_server_sock, SOL_SOCKET,
@@ -209,9 +209,9 @@ ospf_apiclient_connect (char *host, int syncport)
   memset (&myaddr_sync, 0, sizeof (struct sockaddr_in));
   myaddr_sync.sin_family = AF_INET;
   myaddr_sync.sin_port = htons (syncport);
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   myaddr_sync.sin_len = sizeof (struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
 
   ret = bind (fd1, (struct sockaddr *) &myaddr_sync, size);
   if (ret < 0)
@@ -225,9 +225,9 @@ ospf_apiclient_connect (char *host, int syncport)
   memcpy (&myaddr_sync.sin_addr, hp->h_addr, hp->h_length);
   myaddr_sync.sin_family = AF_INET;
   myaddr_sync.sin_port = htons(ospf_apiclient_getport ());
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   myaddr_sync.sin_len = sizeof (struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
 
   /* Now establish synchronous channel with OSPF daemon */
   ret = connect (fd1, (struct sockaddr *) &myaddr_sync,

+ 2 - 2
ospfd/ospf_packet.c

@@ -628,9 +628,9 @@ ospf_write (struct thread *thread)
   memset (&sa_dst, 0, sizeof (sa_dst));
   
   sa_dst.sin_family = AF_INET;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   sa_dst.sin_len = sizeof(sa_dst);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
   sa_dst.sin_addr = op->dst;
   sa_dst.sin_port = htons (0);
 

+ 6 - 6
ripd/ripd.c

@@ -1352,9 +1352,9 @@ rip_create_socket (struct sockaddr_in *from)
     {
       addr.sin_family = AF_INET;
       addr.sin_addr.s_addr = INADDR_ANY;
-#ifdef HAVE_SINLEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
       addr.sin_len = sizeof (struct sockaddr_in);
-#endif /* HAVE_SINLEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
     } else {
       memcpy(&addr, from, sizeof(addr));
     }
@@ -1457,9 +1457,9 @@ rip_send_packet (u_char * buf, int size, struct sockaddr_in *to,
   /* Make destination address. */
   memset (&sin, 0, sizeof (struct sockaddr_in));
   sin.sin_family = AF_INET;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   sin.sin_len = sizeof (struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
 
   /* When destination is specified, use it's port and address. */
   if (to)
@@ -1479,9 +1479,9 @@ rip_send_packet (u_char * buf, int size, struct sockaddr_in *to,
       from.sin_family = AF_INET;
       from.sin_port = htons (RIP_PORT_DEFAULT);
       from.sin_addr = ifc->address->u.prefix4;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
       from.sin_len = sizeof (struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
       
       /*
        * we have to open a new socket for each packet because this

+ 2 - 2
vtysh/vtysh.c

@@ -2122,11 +2122,11 @@ vtysh_connect (struct vtysh_client *vclient)
   memset (&addr, 0, sizeof (struct sockaddr_un));
   addr.sun_family = AF_UNIX;
   strncpy (addr.sun_path, vclient->path, strlen (vclient->path));
-#ifdef HAVE_SUN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
   len = addr.sun_len = SUN_LEN(&addr);
 #else
   len = sizeof (addr.sun_family) + strlen (addr.sun_path);
-#endif /* HAVE_SUN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_UN_SUN_LEN */
 
   ret = connect (sock, (struct sockaddr *) &addr, len);
   if (ret < 0)

+ 3 - 3
watchquagga/watchquagga.c

@@ -1,5 +1,5 @@
 /*
-    $Id: watchquagga.c,v 1.11 2005/02/17 20:11:58 ajs Exp $
+    $Id$
 
     Monitor status of quagga daemons and restart if necessary.
 
@@ -743,11 +743,11 @@ try_connect(struct daemon *dmn)
   addr.sun_family = AF_UNIX;
   snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/%s.vty",
 	   gs.vtydir,dmn->name);
-#ifdef HAVE_SUN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
   len = addr.sun_len = SUN_LEN(&addr);
 #else
   len = sizeof (addr.sun_family) + strlen (addr.sun_path);
-#endif /* HAVE_SUN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_UN_SUN_LEN */
 
   /* Quick check to see if we might succeed before we go to the trouble
      of creating a socket. */

+ 4 - 4
zebra/interface.c

@@ -644,9 +644,9 @@ nd_dump_vty (struct vty *vty, struct interface *ifp)
 static void
 if_dump_vty (struct vty *vty, struct interface *ifp)
 {
-#ifdef HAVE_SOCKADDR_DL
+#ifdef HAVE_STRUCT_SOCKADDR_DL
   struct sockaddr_dl *sdl;
-#endif /* HAVE_SOCKADDR_DL */
+#endif /* HAVE_STRUCT_SOCKADDR_DL */
   struct connected *connected;
   struct listnode *node;
   struct route_node *rn;
@@ -696,7 +696,7 @@ if_dump_vty (struct vty *vty, struct interface *ifp)
            if_flag_dump (ifp->flags), VTY_NEWLINE);
   
   /* Hardware address. */
-#ifdef HAVE_SOCKADDR_DL
+#ifdef HAVE_STRUCT_SOCKADDR_DL
   sdl = &ifp->sdl;
   if (sdl != NULL && sdl->sdl_alen != 0)
     {
@@ -718,7 +718,7 @@ if_dump_vty (struct vty *vty, struct interface *ifp)
 	vty_out (vty, "%s%02x", i == 0 ? "" : ":", ifp->hw_addr[i]);
       vty_out (vty, "%s", VTY_NEWLINE);
     }
-#endif /* HAVE_SOCKADDR_DL */
+#endif /* HAVE_STRUCT_SOCKADDR_DL */
   
   /* Bandwidth in kbps */
   if (ifp->bandwidth != 0)

+ 14 - 14
zebra/ioctl.c

@@ -179,7 +179,7 @@ if_unset_prefix (struct interface *ifp, struct connected *ifc)
   return kernel_address_delete_ipv4 (ifp, ifc);
 }
 #else /* ! HAVE_NETLINK */
-#ifdef HAVE_IFALIASREQ
+#ifdef HAVE_STRUCT_IFALIASREQ
 /* Set up interface's IP address, netmask (and broadcas? ).  *BSD may
    has ifaliasreq structure.  */
 int
@@ -199,7 +199,7 @@ if_set_prefix (struct interface *ifp, struct connected *ifc)
   memset (&addr, 0, sizeof (struct sockaddr_in));
   addr.sin_addr = p->prefix;
   addr.sin_family = p->family;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   addr.sin_len = sizeof (struct sockaddr_in);
 #endif
   memcpy (&addreq.ifra_addr, &addr, sizeof (struct sockaddr_in));
@@ -207,7 +207,7 @@ if_set_prefix (struct interface *ifp, struct connected *ifc)
   memset (&mask, 0, sizeof (struct sockaddr_in));
   masklen2ip (p->prefixlen, &mask.sin_addr);
   mask.sin_family = p->family;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   mask.sin_len = sizeof (struct sockaddr_in);
 #endif
   memcpy (&addreq.ifra_mask, &mask, sizeof (struct sockaddr_in));
@@ -237,7 +237,7 @@ if_unset_prefix (struct interface *ifp, struct connected *ifc)
   memset (&addr, 0, sizeof (struct sockaddr_in));
   addr.sin_addr = p->prefix;
   addr.sin_family = p->family;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   addr.sin_len = sizeof (struct sockaddr_in);
 #endif
   memcpy (&addreq.ifra_addr, &addr, sizeof (struct sockaddr_in));
@@ -245,7 +245,7 @@ if_unset_prefix (struct interface *ifp, struct connected *ifc)
   memset (&mask, 0, sizeof (struct sockaddr_in));
   masklen2ip (p->prefixlen, &mask.sin_addr);
   mask.sin_family = p->family;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   mask.sin_len = sizeof (struct sockaddr_in);
 #endif
   memcpy (&addreq.ifra_mask, &mask, sizeof (struct sockaddr_in));
@@ -335,7 +335,7 @@ if_unset_prefix (struct interface *ifp, struct connected *ifc)
 
   return 0;
 }
-#endif /* HAVE_IFALIASREQ */
+#endif /* HAVE_STRUCT_IFALIASREQ */
 #endif /* HAVE_NETLINK */
 
 /* get interface flags */
@@ -457,7 +457,7 @@ if_prefix_delete_ipv6 (struct interface *ifp, struct connected *ifc)
   return ret;
 }
 #else /* LINUX_IPV6 */
-#ifdef HAVE_IN6_ALIASREQ
+#ifdef HAVE_STRUCT_IN6_ALIASREQ
 #ifndef ND6_INFINITE_LIFETIME
 #define ND6_INFINITE_LIFETIME 0xffffffffL
 #endif /* ND6_INFINITE_LIFETIME */
@@ -478,7 +478,7 @@ if_prefix_add_ipv6 (struct interface *ifp, struct connected *ifc)
   memset (&addr, 0, sizeof (struct sockaddr_in6));
   addr.sin6_addr = p->prefix;
   addr.sin6_family = p->family;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   addr.sin6_len = sizeof (struct sockaddr_in6);
 #endif
   memcpy (&addreq.ifra_addr, &addr, sizeof (struct sockaddr_in6));
@@ -486,7 +486,7 @@ if_prefix_add_ipv6 (struct interface *ifp, struct connected *ifc)
   memset (&mask, 0, sizeof (struct sockaddr_in6));
   masklen2ip6 (p->prefixlen, &mask.sin6_addr);
   mask.sin6_family = p->family;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   mask.sin6_len = sizeof (struct sockaddr_in6);
 #endif
   memcpy (&addreq.ifra_prefixmask, &mask, sizeof (struct sockaddr_in6));
@@ -494,7 +494,7 @@ if_prefix_add_ipv6 (struct interface *ifp, struct connected *ifc)
   addreq.ifra_lifetime.ia6t_vltime = 0xffffffff;
   addreq.ifra_lifetime.ia6t_pltime = 0xffffffff;
   
-#ifdef HAVE_IFRA_LIFETIME 
+#ifdef HAVE_STRUCT_IF6_ALIASREQ_IFRA_LIFETIME 
   addreq.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME; 
   addreq.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME; 
 #endif
@@ -522,7 +522,7 @@ if_prefix_delete_ipv6 (struct interface *ifp, struct connected *ifc)
   memset (&addr, 0, sizeof (struct sockaddr_in6));
   addr.sin6_addr = p->prefix;
   addr.sin6_family = p->family;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   addr.sin6_len = sizeof (struct sockaddr_in6);
 #endif
   memcpy (&addreq.ifra_addr, &addr, sizeof (struct sockaddr_in6));
@@ -530,12 +530,12 @@ if_prefix_delete_ipv6 (struct interface *ifp, struct connected *ifc)
   memset (&mask, 0, sizeof (struct sockaddr_in6));
   masklen2ip6 (p->prefixlen, &mask.sin6_addr);
   mask.sin6_family = p->family;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   mask.sin6_len = sizeof (struct sockaddr_in6);
 #endif
   memcpy (&addreq.ifra_prefixmask, &mask, sizeof (struct sockaddr_in6));
 
-#ifdef HAVE_IFRA_LIFETIME
+#ifdef HAVE_STRUCT_IF6_ALIASREQ_IFRA_LIFETIME
   addreq.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME; 
   addreq.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME; 
 #endif
@@ -557,7 +557,7 @@ if_prefix_delete_ipv6 (struct interface *ifp, struct connected *ifc)
 {
   return 0;
 }
-#endif /* HAVE_IN6_ALIASREQ */
+#endif /* HAVE_STRUCT_IN6_ALIASREQ */
 
 #endif /* LINUX_IPV6 */
 

+ 4 - 4
zebra/kernel_socket.c

@@ -56,7 +56,7 @@ extern struct zebra_t zebrad;
  * Given a pointer (sockaddr or void *), return the number of bytes
  * taken up by the sockaddr and any padding needed for alignment.
  */
-#if defined(HAVE_SA_LEN)
+#if defined(HAVE_STRUCT_SOCKADDR_SA_LEN)
 #define SAROUNDUP(X)   ROUNDUP(((struct sockaddr *)(X))->sa_len)
 #elif defined(HAVE_IPV6)
 /*
@@ -76,7 +76,7 @@ extern struct zebra_t zebrad;
         ROUNDUP(sizeof(struct sockaddr_in)):\
          (((struct sockaddr *)(X))->sa_family == AF_LINK ? \
            ROUNDUP(sizeof(struct sockaddr_dl)) : sizeof(struct sockaddr)))
-#endif /* HAVE_SA_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */
 
 /* We use an additional pointer in following, pdest, rather than (DEST)
  * directly, because gcc will warn if the macro is expanded and DEST is NULL,
@@ -902,7 +902,7 @@ rtm_write (int message,
     msg.rtm.rtm_flags |= RTF_REJECT;
 
 
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
 #define SOCKADDRSET(X,R) \
   if (msg.rtm.rtm_addrs & (R)) \
     { \
@@ -918,7 +918,7 @@ rtm_write (int message,
       memcpy (pnt, (caddr_t)(X), len); \
       pnt += len; \
     }
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
 
   pnt = (caddr_t) msg.buf;
 

+ 16 - 16
zebra/rt_ioctl.c

@@ -50,9 +50,9 @@ kernel_read (int sock)
 /* Initialization prototype of struct sockaddr_in. */
 static struct sockaddr_in sin_proto =
 {
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   sizeof (struct sockaddr_in), 
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
   AF_INET, 0, {0}, {0}
 };
 #endif /* 0 */
@@ -77,9 +77,9 @@ kernel_add_route (struct prefix_ipv4 *dest, struct in_addr *gate,
   /* Make destination. */
   memset (&sin_dest, 0, sizeof (struct sockaddr_in));
   sin_dest.sin_family = AF_INET;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   sin_dest.sin_len = sizeof (struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
   sin_dest.sin_addr = dest->prefix;
 
   /* Make gateway. */
@@ -87,17 +87,17 @@ kernel_add_route (struct prefix_ipv4 *dest, struct in_addr *gate,
     {
       memset (&sin_gate, 0, sizeof (struct sockaddr_in));
       sin_gate.sin_family = AF_INET;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
       sin_gate.sin_len = sizeof (struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
       sin_gate.sin_addr = *gate;
     }
 
   memset (&sin_mask, 0, sizeof (struct sockaddr_in));
   sin_mask.sin_family = AF_INET;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
       sin_gate.sin_len = sizeof (struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
   masklen2ip (dest->prefixlen, &sin_mask.sin_addr);
 
   /* Set destination address, mask and gateway.*/
@@ -178,9 +178,9 @@ kernel_ioctl_ipv4 (u_long cmd, struct prefix *p, struct rib *rib, int family)
   /* Make destination. */
   memset (&sin_dest, 0, sizeof (struct sockaddr_in));
   sin_dest.sin_family = AF_INET;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   sin_dest.sin_len = sizeof (struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
   sin_dest.sin_addr = p->u.prefix4;
 
   if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
@@ -210,9 +210,9 @@ kernel_ioctl_ipv4 (u_long cmd, struct prefix *p, struct rib *rib, int family)
 		  nexthop->rtype == NEXTHOP_TYPE_IPV4_IFINDEX)
 		{
 		  sin_gate.sin_family = AF_INET;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
 		  sin_gate.sin_len = sizeof (struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
 		  sin_gate.sin_addr = nexthop->rgate.ipv4;
 		  rtentry.rt_flags |= RTF_GATEWAY;
 		}
@@ -232,9 +232,9 @@ kernel_ioctl_ipv4 (u_long cmd, struct prefix *p, struct rib *rib, int family)
 		  nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX)
 		{
 		  sin_gate.sin_family = AF_INET;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
 		  sin_gate.sin_len = sizeof (struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
 		  sin_gate.sin_addr = nexthop->gate.ipv4;
 		  rtentry.rt_flags |= RTF_GATEWAY;
 		}
@@ -269,9 +269,9 @@ kernel_ioctl_ipv4 (u_long cmd, struct prefix *p, struct rib *rib, int family)
 
   memset (&sin_mask, 0, sizeof (struct sockaddr_in));
   sin_mask.sin_family = AF_INET;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   sin_mask.sin_len = sizeof (struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
   masklen2ip (p->prefixlen, &sin_mask.sin_addr);
 
   /* Set destination address, mask and gateway.*/

+ 8 - 8
zebra/rt_socket.c

@@ -78,18 +78,18 @@ kernel_rtm_ipv4 (int cmd, struct prefix *p, struct rib *rib, int family)
 
   memset (&sin_dest, 0, sizeof (struct sockaddr_in));
   sin_dest.sin_family = AF_INET;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   sin_dest.sin_len = sizeof (struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
   sin_dest.sin_addr = p->u.prefix4;
 
   memset (&sin_mask, 0, sizeof (struct sockaddr_in));
 
   memset (&sin_gate, 0, sizeof (struct sockaddr_in));
   sin_gate.sin_family = AF_INET;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   sin_gate.sin_len = sizeof (struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
 
   /* Make gateway. */
   for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
@@ -147,9 +147,9 @@ kernel_rtm_ipv4 (int cmd, struct prefix *p, struct rib *rib, int family)
 	    {
 	      masklen2ip (p->prefixlen, &sin_mask.sin_addr);
 	      sin_mask.sin_family = AF_INET;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
 	      sin_mask.sin_len = sin_masklen (sin_mask.sin_addr);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
 	      mask = &sin_mask;
 	    }
 	}
@@ -327,9 +327,9 @@ kernel_rtm_ipv6_multipath (int cmd, struct prefix *p, struct rib *rib,
 
   memset (&sin_gate, 0, sizeof (struct sockaddr_in6));
   sin_gate.sin6_family = AF_INET6;
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   sin_gate.sin6_len = sizeof (struct sockaddr_in6);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
 
   /* Make gateway. */
   for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)

+ 4 - 4
zebra/rtadv.c

@@ -157,9 +157,9 @@ rtadv_send_packet (int sock, struct interface *ifp)
   struct cmsghdr  *cmsgptr;
   struct in6_pktinfo *pkt;
   struct sockaddr_in6 addr;
-#ifdef HAVE_SOCKADDR_DL
+#ifdef HAVE_STRUCT_SOCKADDR_DL
   struct sockaddr_dl *sdl;
-#endif /* HAVE_SOCKADDR_DL */
+#endif /* HAVE_STRUCT_SOCKADDR_DL */
   static void *adata = NULL;
   unsigned char buf[RTADV_MSG_SIZE];
   struct nd_router_advert *rtadv;
@@ -285,7 +285,7 @@ rtadv_send_packet (int sock, struct interface *ifp)
     }
 
   /* Hardware address. */
-#ifdef HAVE_SOCKADDR_DL
+#ifdef HAVE_STRUCT_SOCKADDR_DL
   sdl = &ifp->sdl;
   if (sdl != NULL && sdl->sdl_alen != 0)
     {
@@ -304,7 +304,7 @@ rtadv_send_packet (int sock, struct interface *ifp)
       memcpy (buf + len, ifp->hw_addr, ifp->hw_addr_len);
       len += ifp->hw_addr_len;
     }
-#endif /* HAVE_SOCKADDR_DL */
+#endif /* HAVE_STRUCT_SOCKADDR_DL */
 
   msg.msg_name = (void *) &addr;
   msg.msg_namelen = sizeof (struct sockaddr_in6);

+ 3 - 3
zebra/rtadv.h

@@ -66,7 +66,7 @@ extern void rtadv_init (void);
 #define ND_OPT_HA_INFORMATION	8   /* HA Information Option */
 #endif
 
-#ifndef HAVE_ND_OPT_ADV_INTERVAL
+#ifndef HAVE_STRUCT_ND_OPT_ADV_INTERVAL
 struct nd_opt_adv_interval {   /* Advertisement interval option */
         uint8_t        nd_opt_ai_type;
         uint8_t        nd_opt_ai_len;
@@ -74,7 +74,7 @@ struct nd_opt_adv_interval {   /* Advertisement interval option */
         uint32_t       nd_opt_ai_interval;
 } __attribute__((__packed__));
 #else
-#ifndef HAVE_ND_OPT_ADV_INTERVAL_AI_FIELDS
+#ifndef HAVE_STRUCT_ND_OPT_ADV_INTERVAL_ND_OPT_AI_TYPE
 /* fields may have to be renamed */
 #define nd_opt_ai_type		nd_opt_adv_interval_type
 #define nd_opt_ai_len		nd_opt_adv_interval_len
@@ -83,7 +83,7 @@ struct nd_opt_adv_interval {   /* Advertisement interval option */
 #endif
 #endif
 
-#ifndef HAVE_ND_OPT_HOMEAGENT_INFO
+#ifndef HAVE_STRUCT_ND_OPT_HOMEAGENT_INFO
 struct nd_opt_homeagent_info {  /* Home Agent info */
         u_int8_t        nd_opt_hai_type;
         u_int8_t        nd_opt_hai_len;

+ 6 - 6
zebra/zserv.c

@@ -166,13 +166,13 @@ zsend_interface_add (struct zserv *client, struct interface *ifp)
   stream_putl (s, ifp->mtu);
   stream_putl (s, ifp->mtu6);
   stream_putl (s, ifp->bandwidth);
-#ifdef HAVE_SOCKADDR_DL
+#ifdef HAVE_STRUCT_SOCKADDR_DL
   stream_put (s, &ifp->sdl, sizeof (ifp->sdl));
 #else
   stream_putl (s, ifp->hw_addr_len);
   if (ifp->hw_addr_len)
     stream_put (s, ifp->hw_addr, ifp->hw_addr_len);
-#endif /* HAVE_SOCKADDR_DL */
+#endif /* HAVE_STRUCT_SOCKADDR_DL */
 
   /* Write packet size. */
   stream_putw_at (s, 0, stream_get_endp (s));
@@ -1355,9 +1355,9 @@ zebra_serv ()
   memset (&addr, 0, sizeof (struct sockaddr_in));
   addr.sin_family = AF_INET;
   addr.sin_port = htons (ZEBRA_PORT);
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   addr.sin_len = sizeof (struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
   addr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
 
   sockopt_reuseaddr (accept_sock);
@@ -1426,11 +1426,11 @@ zebra_serv_un (const char *path)
   memset (&serv, 0, sizeof (struct sockaddr_un));
   serv.sun_family = AF_UNIX;
   strncpy (serv.sun_path, path, strlen (path));
-#ifdef HAVE_SUN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
   len = serv.sun_len = SUN_LEN(&serv);
 #else
   len = sizeof (serv.sun_family) + strlen (serv.sun_path);
-#endif /* HAVE_SUN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_UN_SUN_LEN */
 
   ret = bind (sock, (struct sockaddr *) &serv, len);
   if (ret < 0)