summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2017-07-26 19:49:15 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2017-07-31 23:03:30 +0200
commitddfeb48652f8318acc8b18c2c377515de2bf1b31 (patch)
treee4825eefb3fee2b1c5f0d7b5c6817bac77a1c313
parentbuild: convert zebra/ to non-recursive build (diff)
downloadfrr-ddfeb48652f8318acc8b18c2c377515de2bf1b31.tar.xz
frr-ddfeb48652f8318acc8b18c2c377515de2bf1b31.zip
build: zebra: remove *_method Makefile hacks
replace with preprocessor checks in source files. Much simpler... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rwxr-xr-xconfigure.ac307
-rw-r--r--zebra/if_ioctl.c4
-rw-r--r--zebra/if_ioctl_solaris.c4
-rw-r--r--zebra/if_netlink.c4
-rw-r--r--zebra/if_sysctl.c4
-rw-r--r--zebra/ioctl.c4
-rw-r--r--zebra/ioctl_solaris.c4
-rw-r--r--zebra/ipforward_proc.c4
-rw-r--r--zebra/ipforward_solaris.c5
-rw-r--r--zebra/ipforward_sysctl.c5
-rw-r--r--zebra/kernel_netlink.c4
-rw-r--r--zebra/kernel_socket.c5
-rw-r--r--zebra/rt_netlink.c5
-rw-r--r--zebra/rt_socket.c5
-rw-r--r--zebra/rtread_getmsg.c4
-rw-r--r--zebra/rtread_netlink.c4
-rw-r--r--zebra/rtread_sysctl.c4
-rw-r--r--zebra/subdir.am62
-rw-r--r--zebra/zebra_fpm_netlink.c4
-rw-r--r--zebra/zebra_mpls_netlink.c5
-rw-r--r--zebra/zebra_mpls_null.c4
-rw-r--r--zebra/zebra_mpls_openbsd.c5
22 files changed, 189 insertions, 267 deletions
diff --git a/configure.ac b/configure.ac
index 0fa467ac0..b22361d40 100755
--- a/configure.ac
+++ b/configure.ac
@@ -415,26 +415,6 @@ if test "${enable_rr_semantics}" != "no" ; then
AC_DEFINE(HAVE_V6_RR_SEMANTICS,, Compile in v6 Route Replacement Semantics)
fi
-dnl ----------
-dnl MPLS check
-dnl ----------
-AC_MSG_CHECKING(whether this OS has MPLS stack)
-case "$host" in
- *-linux*)
- MPLS_METHOD="zebra_mpls_netlink.o"
- AC_MSG_RESULT(Linux MPLS)
- ;;
- *-openbsd*)
- MPLS_METHOD="zebra_mpls_openbsd.o"
- AC_MSG_RESULT(OpenBSD MPLS)
- ;;
- *)
- MPLS_METHOD="zebra_mpls_null.o"
- AC_MSG_RESULT(Unsupported kernel)
- ;;
-esac
-AC_SUBST(MPLS_METHOD)
-
if test "${enable_datacenter}" = "yes" ; then
AC_DEFINE(HAVE_DATACENTER,,Compile extensions for a DataCenter)
DFLT_NAME="datacenter"
@@ -850,50 +830,52 @@ FRR_INCLUDES
dnl V6 headers are checked below, after we check for v6
-dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
-case "$host" in
- [*-sunos5.[6-7]*] | [*-solaris2.[6-7]*])
- opsys=sol2-6
- AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.7)
- AC_DEFINE(SUNOS_5, 1, SunOS 5)
- AC_CHECK_LIB(xnet, main)
- CURSES=-lcurses
- SOLARIS="solaris"
- ;;
- [*-sunos5.[8-9]] \
- | [*-sunos5.1[0-9]] \
- | [*-sunos5.1[0-9].[0-9]] \
- | [*-solaris2.[8-9]] \
- | [*-solaris2.1[0-9]] \
- | [*-solaris2.1[0-9].[0-9]])
- opsys=sol8
- AC_DEFINE(SUNOS_59, 1, [SunOS 5.8 up])
- AC_DEFINE(SUNOS_5, 1, [SunOS 5])
- AC_CHECK_LIB(socket, main)
- AC_CHECK_LIB(nsl, main)
- AC_CHECK_LIB(umem, main)
- AC_CHECK_FUNCS([printstack],
- [AC_DEFINE([HAVE_PRINTSTACK],1,[Solaris printstack])
- AC_DEFINE([HAVE_STACK_TRACE],1,[Stack symbols decode functionality])
- ])
- CURSES=-lcurses
- SOLARIS="solaris"
- ;;
- *-sunos5* | *-solaris2*)
- AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
- AC_CHECK_LIB(socket, main)
- AC_CHECK_LIB(nsl, main)
- CURSES=-lcurses
- SOLARIS="solaris"
- ;;
- *-linux*)
- opsys=gnu-linux
- AC_DEFINE(GNU_LINUX,,GNU Linux)
- ;;
- *-openbsd*)
- opsys=openbsd
- AC_DEFINE(OPEN_BSD,,OpenBSD)
- ;;
+AC_MSG_CHECKING([which operating system interface to use])
+case "$host_os" in
+ sunos* | solaris2*)
+ AC_MSG_RESULT([Solaris])
+
+ AC_DEFINE(SUNOS_5, 1, [SunOS 5])
+ AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
+
+ AC_CHECK_LIB(socket, main)
+ AC_CHECK_LIB(nsl, main)
+ AC_CHECK_LIB(umem, main)
+ AC_CHECK_FUNCS([printstack], [
+ AC_DEFINE([HAVE_PRINTSTACK],1,[Solaris printstack])
+ AC_DEFINE([HAVE_STACK_TRACE],1,[Stack symbols decode functionality])
+ ])
+ CURSES=-lcurses
+ SOLARIS="solaris"
+ ;;
+ linux*)
+ AC_MSG_RESULT([Linux])
+
+ AC_DEFINE(GNU_LINUX,,GNU Linux)
+ AC_DEFINE(HAVE_NETLINK,,netlink)
+ AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
+
+ dnl Linux has a compilation problem with mixing
+ dnl netinet/in.h and linux/in6.h they are not
+ dnl compatible. There has been discussion on
+ dnl how to fix it but no real progress on implementation
+ dnl when they fix it, remove this
+ AC_DEFINE(IPV6_MINHOPCOUNT, 73, Linux ipv6 Min Hop Count)
+
+ AC_CHECK_DECLS([IFLA_INFO_SLAVE_KIND], [], [], [#include <linux/if_link.h>])
+ ;;
+ openbsd*)
+ AC_MSG_RESULT([OpenBSD])
+
+ AC_DEFINE(OPEN_BSD,,OpenBSD)
+ AC_DEFINE(KAME,1,KAME IPv6)
+ ;;
+ *)
+ AC_MSG_RESULT([BSD])
+
+ AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
+ AC_DEFINE(KAME,1,KAME IPv6)
+ ;;
esac
AC_SYS_LARGEFILE
@@ -1049,26 +1031,6 @@ AC_CHECK_HEADER([asm-generic/unistd.h],
AC_CHECK_FUNCS(setns)]
)
-dnl ------------------------------------
-dnl Determine routing get and set method
-dnl ------------------------------------
-AC_MSG_CHECKING(zebra between kernel interface method)
-if test x"$opsys" = x"gnu-linux"; then
- AC_MSG_RESULT(netlink)
- RT_METHOD=rt_netlink.o
- KERNEL_METHOD=kernel_netlink.o
- AC_DEFINE(HAVE_NETLINK,,netlink)
- netlink=yes
- AC_CHECK_DECLS([IFLA_INFO_SLAVE_KIND], [], [], [#include <linux/if_link.h>])
-else
- AC_MSG_RESULT(Route socket)
- KERNEL_METHOD="kernel_socket.o"
- RT_METHOD="rt_socket.o"
-fi
-AC_SUBST(RT_METHOD)
-AC_SUBST(KERNEL_METHOD)
-AM_CONDITIONAL([HAVE_NETLINK], [test "x$netlink" = "xyes"])
-
dnl --------------------------
dnl Determine IS-IS I/O method
dnl --------------------------
@@ -1078,27 +1040,32 @@ AC_DEFINE(ISIS_METHOD_BPF, 3, [ constant value for isis method bpf ])
AC_CHECK_HEADER(net/bpf.h)
AC_CHECK_HEADER(sys/dlpi.h)
AC_MSG_CHECKING(zebra IS-IS I/O method)
-if test x"$opsys" = x"gnu-linux"; then
- AC_MSG_RESULT(pfpacket)
- ISIS_METHOD_MACRO="ISIS_METHOD_PFPACKET"
-elif test x"$opsys" = x"sol2-6" -o x"$opsys" = x"sol8"; then
- AC_MSG_RESULT(DLPI)
- ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
-else
- if test $ac_cv_header_net_bpf_h = no; then
- if test $ac_cv_header_sys_dlpi_h = no; then
- AC_MSG_RESULT(none)
- AC_MSG_WARN([*** IS-IS support will not be built ***])
- ISISD=""
+
+case "$host_os" in
+ linux*)
+ AC_MSG_RESULT(pfpacket)
+ ISIS_METHOD_MACRO="ISIS_METHOD_PFPACKET"
+ ;;
+ solaris* | sunos*)
+ AC_MSG_RESULT(DLPI)
+ ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
+ ;;
+ *)
+ if test $ac_cv_header_net_bpf_h = no; then
+ if test $ac_cv_header_sys_dlpi_h = no; then
+ AC_MSG_RESULT(none)
+ AC_MSG_WARN([*** IS-IS support will not be built ***])
+ ISISD=""
+ else
+ AC_MSG_RESULT(DLPI)
+ fi
+ ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
else
- AC_MSG_RESULT(DLPI)
+ AC_MSG_RESULT(BPF)
+ ISIS_METHOD_MACRO="ISIS_METHOD_BPF"
fi
- ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
- else
- AC_MSG_RESULT(BPF)
- ISIS_METHOD_MACRO="ISIS_METHOD_BPF"
- fi
-fi
+ ;;
+esac
AC_DEFINE_UNQUOTED(ISIS_METHOD, $ISIS_METHOD_MACRO, [ selected method for isis, == one of the constants ])
dnl ------------------------------------
@@ -1128,59 +1095,6 @@ main()
}]])],[AC_MSG_RESULT(yes - using workaround) AC_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)],
[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
-dnl ------------------------------
-dnl check kernel route read method
-dnl ------------------------------
-AC_CACHE_CHECK([route read method], [frr_cv_rtread_method],
-[if test "x$netlink" = xyes; then
- frr_cv_rtread_method="netlink"
-else
-for frr_cv_rtread_method in /dev/ip /dev/null;
-do
- test x`ls $frr_cv_rtread_method 2>/dev/null` = x"$frr_cv_rtread_method" && break
-done
-case $frr_cv_rtread_method in
- "/dev/ip")
- case "$host" in
- *-freebsd*) frr_cv_rtread_method="sysctl";;
- *) frr_cv_rtread_method="getmsg";;
- esac;;
- *)
- frr_cv_rtread_method="sysctl";;
-esac
-fi])
-RTREAD_METHOD=rtread_${frr_cv_rtread_method}.o
-AC_SUBST(RTREAD_METHOD)
-
-dnl -----------------------------
-dnl check interface lookup method
-dnl -----------------------------
-IOCTL_METHOD=ioctl.o
-AC_MSG_CHECKING(interface looking up method)
-if test "$netlink" = yes; then
- AC_MSG_RESULT(netlink)
- IF_METHOD=if_netlink.o
-elif test "$opsys" = "sol2-6";then
- AC_MSG_RESULT(Solaris GIF)
- IF_METHOD=if_ioctl.o
-elif test "$opsys" = "sol8";then
- AC_MSG_RESULT(Solaris GLIF)
- IF_METHOD=if_ioctl_solaris.o
- IOCTL_METHOD=ioctl_solaris.o
-elif test "$opsys" = "openbsd";then
- AC_MSG_RESULT(openbsd)
- IF_METHOD=if_ioctl.o
-elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
- AC_MSG_RESULT(sysctl)
- IF_METHOD=if_sysctl.o
- AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
-else
- AC_MSG_RESULT(ioctl)
- IF_METHOD=if_ioctl.o
-fi
-AC_SUBST(IF_METHOD)
-AC_SUBST(IOCTL_METHOD)
-
dnl ---------------------------------------------------------------
dnl figure out how to specify an interface in multicast sockets API
dnl ---------------------------------------------------------------
@@ -1276,71 +1190,11 @@ if test $ac_cv_have_decl_TCP_MD5SIG = no; then
AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)])
fi
-dnl -----------------------------
-dnl check ipforward detect method
-dnl -----------------------------
-AC_CACHE_CHECK([ipforward method], [frr_cv_ipforward_method],
-[if test x$cross_compiling = xyes; then
- if test x"$opsys" = x"gnu-linux"; then
- frr_cv_ipforward_method=/proc/net/snmp
- else
- frr_cv_ipforward_method=/dev/ip
- fi
-else
- for frr_cv_ipforward_method in /proc/net/snmp /dev/ip /dev/null;
- do
- test x`ls $frr_cv_ipforward_method 2>/dev/null` = x"$frr_cv_ipforward_method" && break
- done
-fi
-case $frr_cv_ipforward_method in
- "/proc/net/snmp") frr_cv_ipforward_method="proc";;
- "/dev/ip")
- case "$host" in
- *-freebsd*) frr_cv_ipforward_method="sysctl";;
- *) frr_cv_ipforward_method="solaris";;
- esac;;
- *) frr_cv_ipforward_method="sysctl";;
-esac])
-IPFORWARD=ipforward_${frr_cv_ipforward_method}.o
-AC_SUBST(IPFORWARD)
-
dnl ----------------------------------------------------------------------------
dnl figure out if domainname is available in the utsname struct (GNU extension).
dnl ----------------------------------------------------------------------------
AC_CHECK_MEMBERS([struct utsname.domainname], [], [], [#include <sys/utsname.h>])
-dnl ----------
-dnl IPv6 check
-dnl ----------
-AC_MSG_CHECKING(whether does this OS have IPv6 stack)
-dnl ---------
-dnl KAME IPv6
-dnl ---------
- if grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
- AC_DEFINE(KAME,1,KAME IPv6)
- AC_MSG_RESULT(KAME)
-dnl ------------------------------------
-dnl Solaris 9, 10 and potentially higher
-dnl ------------------------------------
- elif test x"$opsys" = x"sol8"; then
- AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
- AC_MSG_RESULT(Solaris IPv6)
-dnl ----------
-dnl Linux IPv6
-dnl ----------
- elif test x"$opsys" = x"gnu-linux"; then
- AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
- dnl Linux has a compilation problem with mixing
- dnl netinet/in.h and linux/in6.h they are not
- dnl compatible. There has been discussion on
- dnl how to fix it but no real progress on implementation
- dnl when they fix it, remove this
- AC_DEFINE(IPV6_MINHOPCOUNT, 73, Linux ipv6 Min Hop Count)
- AC_MSG_RESULT(Linux IPv6)
- else
- AC_MSG_ERROR([Failed to detect IPv6 stack])
- fi
-
dnl ------------------
dnl IPv6 header checks
dnl ------------------
@@ -1407,15 +1261,18 @@ fi
AM_CONDITIONAL(LDPD, test "x$LDPD" = "xldpd")
NHRPD=""
-if test "$opsys" = "gnu-linux"; then
- if test "${enable_nhrpd}" != "no"; then
- NHRPD="nhrpd"
- fi
-else
- if test "${enable_nhrpd}" = "yes"; then
- AC_MSG_ERROR([nhrpd requires kernel APIs that are only present on Linux.])
- fi
-fi
+case "$host_os" in
+ linux*)
+ if test "${enable_nhrpd}" != "no"; then
+ NHRPD="nhrpd"
+ fi
+ ;;
+ *)
+ if test "${enable_nhrpd}" = "yes"; then
+ AC_MSG_ERROR([nhrpd requires kernel APIs that are only present on Linux.])
+ fi
+ ;;
+esac
AM_CONDITIONAL(NHRPD, test "x$NHRPD" = "xnhrpd")
if test "${enable_eigrpd}" = "no";then
diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c
index 2d5d604a8..a65fcb2b8 100644
--- a/zebra/if_ioctl.c
+++ b/zebra/if_ioctl.c
@@ -21,6 +21,8 @@
#include <zebra.h>
+#ifdef OPEN_BSD
+
#include "if.h"
#include "sockunion.h"
#include "prefix.h"
@@ -328,3 +330,5 @@ void interface_list(struct zebra_ns *zns)
ifaddr_proc_ipv6();
#endif /* HAVE_PROC_NET_IF_INET6 */
}
+
+#endif /* OPEN_BSD */
diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c
index fce36ebc1..3d5319459 100644
--- a/zebra/if_ioctl_solaris.c
+++ b/zebra/if_ioctl_solaris.c
@@ -21,6 +21,8 @@
#include <zebra.h>
+#ifdef SUNOS_5
+
#include "if.h"
#include "sockunion.h"
#include "prefix.h"
@@ -358,3 +360,5 @@ struct connected *if_lookup_linklocal(struct interface *ifp)
return NULL;
}
+
+#endif /* SUNOS_5 */
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index acec2db52..10db5067f 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -21,6 +21,8 @@
#include <zebra.h>
+#ifdef GNU_LINUX
+
/* The following definition is to workaround an issue in the Linux kernel
* header files with redefinition of 'struct in6_addr' in both
* netinet/in.h and linux/in6.h.
@@ -1218,3 +1220,5 @@ void interface_list(struct zebra_ns *zns)
{
interface_lookup_netlink(zns);
}
+
+#endif /* GNU_LINUX */
diff --git a/zebra/if_sysctl.c b/zebra/if_sysctl.c
index 99b0f9d94..39b7204e8 100644
--- a/zebra/if_sysctl.c
+++ b/zebra/if_sysctl.c
@@ -21,6 +21,8 @@
#include <zebra.h>
+#if !defined(GNU_LINUX) && !defined(OPEN_BSD) && !defined(SUNOS_5)
+
#include "if.h"
#include "sockunion.h"
#include "prefix.h"
@@ -134,3 +136,5 @@ void interface_list(struct zebra_ns *zns)
/* Free sysctl buffer. */
XFREE(MTYPE_TMP, ref);
}
+
+#endif /* !defined(GNU_LINUX) && !defined(OPEN_BSD) && !defined(SUNOS_5) */
diff --git a/zebra/ioctl.c b/zebra/ioctl.c
index 72d98943e..835f1f493 100644
--- a/zebra/ioctl.c
+++ b/zebra/ioctl.c
@@ -33,6 +33,8 @@
#include "zebra/rt.h"
#include "zebra/interface.h"
+#ifndef SUNOS_5
+
#ifdef HAVE_BSD_LINK_DETECT
#include <net/if_media.h>
#endif /* HAVE_BSD_LINK_DETECT*/
@@ -563,3 +565,5 @@ int if_prefix_delete_ipv6(struct interface *ifp, struct connected *ifc)
#endif /* HAVE_STRUCT_IN6_ALIASREQ */
#endif /* LINUX_IPV6 */
+
+#endif /* !SUNOS_5 */
diff --git a/zebra/ioctl_solaris.c b/zebra/ioctl_solaris.c
index df1554ae6..e8b65925f 100644
--- a/zebra/ioctl_solaris.c
+++ b/zebra/ioctl_solaris.c
@@ -21,6 +21,8 @@
#include <zebra.h>
+#ifdef SUNOS_5
+
#include "linklist.h"
#include "if.h"
#include "prefix.h"
@@ -398,3 +400,5 @@ int if_prefix_delete_ipv6(struct interface *ifp, struct connected *ifc)
return 0;
}
+
+#endif /* SUNOS_5 */
diff --git a/zebra/ipforward_proc.c b/zebra/ipforward_proc.c
index c3dcdda55..2834eeeb9 100644
--- a/zebra/ipforward_proc.c
+++ b/zebra/ipforward_proc.c
@@ -21,6 +21,8 @@
#include <zebra.h>
+#ifdef GNU_LINUX
+
#include "log.h"
#include "privs.h"
@@ -193,3 +195,5 @@ int ipforward_ipv6_off(void)
return ipforward_ipv6();
}
+
+#endif /* GNU_LINUX */
diff --git a/zebra/ipforward_solaris.c b/zebra/ipforward_solaris.c
index 0d6b7dac0..123cf1bd0 100644
--- a/zebra/ipforward_solaris.c
+++ b/zebra/ipforward_solaris.c
@@ -20,6 +20,9 @@
*/
#include <zebra.h>
+
+#ifdef SUNOS_5
+
#include "log.h"
#include "prefix.h"
@@ -153,3 +156,5 @@ int ipforward_ipv6_off(void)
(void)solaris_nd_set("ip6_forwarding", 0);
return ipforward_ipv6();
}
+
+#endif /* SUNOS_5 */
diff --git a/zebra/ipforward_sysctl.c b/zebra/ipforward_sysctl.c
index 00be92bb6..36212a013 100644
--- a/zebra/ipforward_sysctl.c
+++ b/zebra/ipforward_sysctl.c
@@ -19,6 +19,9 @@
*/
#include <zebra.h>
+
+#if !defined(GNU_LINUX) && !defined(SUNOS_5)
+
#include "privs.h"
#include "zebra/ipforward.h"
@@ -147,3 +150,5 @@ int ipforward_ipv6_off(void)
zlog_err("Can't lower privileges");
return ip6forwarding;
}
+
+#endif /* !defined(GNU_LINUX) && !defined(SUNOS_5) */
diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c
index 7fc2d6133..dfc3f6211 100644
--- a/zebra/kernel_netlink.c
+++ b/zebra/kernel_netlink.c
@@ -20,6 +20,8 @@
#include <zebra.h>
+#ifdef HAVE_NETLINK
+
#include "linklist.h"
#include "if.h"
#include "log.h"
@@ -826,3 +828,5 @@ void kernel_terminate(struct zebra_ns *zns)
zns->netlink_cmd.sock = -1;
}
}
+
+#endif /* HAVE_NETLINK */
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index 4b63a3eb0..5df57b253 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -19,6 +19,9 @@
*/
#include <zebra.h>
+
+#ifndef HAVE_NETLINK
+
#include <net/if_types.h>
#ifdef __OpenBSD__
#include <netmpls/mpls.h>
@@ -1376,3 +1379,5 @@ void kernel_terminate(struct zebra_ns *zns)
{
return;
}
+
+#endif /* !HAVE_NETLINK */
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index c02774ca6..75118713d 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -19,6 +19,9 @@
*/
#include <zebra.h>
+
+#ifdef HAVE_NETLINK
+
#include <net/if_arp.h>
/* Hack for GNU libc version 2. */
@@ -2442,3 +2445,5 @@ void clear_nhlfe_installed(zebra_lsp_t *lsp)
UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
}
}
+
+#endif /* HAVE_NETLINK */
diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c
index 827d39870..0eae3c4f2 100644
--- a/zebra/rt_socket.c
+++ b/zebra/rt_socket.c
@@ -20,6 +20,9 @@
*/
#include <zebra.h>
+
+#ifndef HAVE_NETLINK
+
#ifdef __OpenBSD__
#include <netmpls/mpls.h>
#endif
@@ -443,3 +446,5 @@ int kernel_del_neigh(struct interface *ifp, struct ipaddr *ip)
{
return 0;
}
+
+#endif /* !HAVE_NETLINK */
diff --git a/zebra/rtread_getmsg.c b/zebra/rtread_getmsg.c
index 5384231f8..1bba003a0 100644
--- a/zebra/rtread_getmsg.c
+++ b/zebra/rtread_getmsg.c
@@ -21,6 +21,8 @@
#include <zebra.h>
+#ifdef SUNOS_5
+
#include "prefix.h"
#include "log.h"
#include "if.h"
@@ -258,3 +260,5 @@ void neigh_read(struct zebra_ns *zns)
void neigh_read_for_vlan(struct zebra_ns *zns, struct interface *vlan_if)
{
}
+
+#endif /* SUNOS_5 */
diff --git a/zebra/rtread_netlink.c b/zebra/rtread_netlink.c
index 304f44136..f38cba65e 100644
--- a/zebra/rtread_netlink.c
+++ b/zebra/rtread_netlink.c
@@ -21,6 +21,8 @@
#include <zebra.h>
+#ifdef GNU_LINUX
+
#include "vty.h"
#include "zebra/zserv.h"
#include "zebra/rt_netlink.h"
@@ -50,3 +52,5 @@ void neigh_read_for_vlan(struct zebra_ns *zns, struct interface *vlan_if)
{
netlink_neigh_read_for_vlan(zns, vlan_if);
}
+
+#endif /* GNU_LINUX */
diff --git a/zebra/rtread_sysctl.c b/zebra/rtread_sysctl.c
index d3e2eb6fa..53ed0e790 100644
--- a/zebra/rtread_sysctl.c
+++ b/zebra/rtread_sysctl.c
@@ -21,6 +21,8 @@
#include <zebra.h>
+#if !defined(GNU_LINUX) && !defined(SUNOS_5)
+
#include "memory.h"
#include "zebra_memory.h"
#include "log.h"
@@ -90,3 +92,5 @@ void neigh_read(struct zebra_ns *zns)
void neigh_read_for_vlan(struct zebra_ns *zns, struct interface *vlan_if)
{
}
+
+#endif /* !defined(GNU_LINUX) && !defined(SUNOS_5) */
diff --git a/zebra/subdir.am b/zebra/subdir.am
index e69aa6334..546da3cf2 100644
--- a/zebra/subdir.am
+++ b/zebra/subdir.am
@@ -16,42 +16,41 @@ endif
## endif ZEBRA
endif
-ipforward = @IPFORWARD@
-if_method = @IF_METHOD@
-rt_method = @RT_METHOD@
-rtread_method = @RTREAD_METHOD@
-kernel_method = @KERNEL_METHOD@
-ioctl_method = @IOCTL_METHOD@
-mpls_method = @MPLS_METHOD@
-
-otherobj = \
- zebra/$(ioctl_method) \
- zebra/$(ipforward) \
- zebra/$(if_method) \
- zebra/$(rt_method) \
- zebra/$(rtread_method) \
- zebra/$(kernel_method) \
- zebra/$(mpls_method) \
- # end
-
-zebra_zebra_LDADD = $(otherobj) lib/libfrr.la $(LIBCAP)
-zebra_zebra_DEPENDENCIES = $(otherobj) lib/libfrr.la
-
+zebra_zebra_LDADD = lib/libfrr.la $(LIBCAP)
zebra_zebra_SOURCES = \
zebra/connected.c \
zebra/debug.c \
+ zebra/if_ioctl.c \
+ zebra/if_ioctl_solaris.c \
+ zebra/if_netlink.c \
+ zebra/if_sysctl.c \
zebra/interface.c \
+ zebra/ioctl.c \
+ zebra/ioctl_solaris.c \
+ zebra/ipforward_proc.c \
+ zebra/ipforward_solaris.c \
+ zebra/ipforward_sysctl.c \
zebra/irdp_interface.c \
zebra/irdp_main.c \
zebra/irdp_packet.c \
+ zebra/kernel_netlink.c \
+ zebra/kernel_socket.c \
zebra/label_manager.c \
zebra/main.c \
zebra/redistribute.c \
zebra/router-id.c \
+ zebra/rt_netlink.c \
+ zebra/rt_socket.c \
zebra/rtadv.c \
+ zebra/rtread_getmsg.c \
+ zebra/rtread_netlink.c \
+ zebra/rtread_sysctl.c \
zebra/zebra_l2.c \
zebra/zebra_memory.c \
zebra/zebra_mpls.c \
+ zebra/zebra_mpls_netlink.c \
+ zebra/zebra_mpls_openbsd.c \
+ zebra/zebra_mpls_null.c \
zebra/zebra_mpls_vty.c \
zebra/zebra_mroute.c \
zebra/zebra_ns.c \
@@ -112,9 +111,7 @@ zebra_zebra_snmp_la_LIBADD = lib/libfrrsnmp.la
zebra_zebra_fpm_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
zebra_zebra_fpm_la_LIBADD = $(Q_FPM_PB_CLIENT_LDOPTS)
zebra_zebra_fpm_la_SOURCES = zebra/zebra_fpm.c
-if HAVE_NETLINK
zebra_zebra_fpm_la_SOURCES += zebra/zebra_fpm_netlink.c
-endif
if HAVE_PROTOBUF
zebra_zebra_fpm_la_SOURCES += zebra/zebra_fpm_protobuf.c
if DEV_BUILD
@@ -125,25 +122,6 @@ endif
EXTRA_DIST += \
zebra/GNOME-SMI \
zebra/GNOME-PRODUCT-ZEBRA-MIB \
- zebra/if_ioctl.c \
- zebra/if_ioctl_solaris.c \
- zebra/if_netlink.c \
- zebra/if_sysctl.c \
- zebra/ioctl.c \
- zebra/ioctl_solaris.c \
- zebra/ipforward_proc.c \
- zebra/ipforward_solaris.c \
- zebra/ipforward_sysctl.c \
- zebra/kernel_netlink.c \
- zebra/kernel_socket.c \
- zebra/rt_netlink.c \
- zebra/rt_socket.c \
- zebra/rtread_getmsg.c \
- zebra/rtread_netlink.c \
- zebra/rtread_sysctl.c \
- zebra/zebra_mpls_netlink.c \
- zebra/zebra_mpls_null.c \
- zebra/zebra_mpls_openbsd.c \
# end
# -- unmaintained --
diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c
index 862049cb8..28f795663 100644
--- a/zebra/zebra_fpm_netlink.c
+++ b/zebra/zebra_fpm_netlink.c
@@ -24,6 +24,8 @@
#include <zebra.h>
+#ifdef HAVE_NETLINK
+
#include "log.h"
#include "rib.h"
#include "vty.h"
@@ -457,3 +459,5 @@ int zfpm_netlink_encode_route(int cmd, rib_dest_t *dest, struct route_entry *re,
return netlink_route_info_encode(ri, in_buf, in_buf_len);
}
+
+#endif /* HAVE_NETLINK */
diff --git a/zebra/zebra_mpls_netlink.c b/zebra/zebra_mpls_netlink.c
index c5053563b..8b30783a9 100644
--- a/zebra/zebra_mpls_netlink.c
+++ b/zebra/zebra_mpls_netlink.c
@@ -19,6 +19,9 @@
*/
#include <zebra.h>
+
+#ifdef HAVE_NETLINK
+
#include "zebra/rt.h"
#include "zebra/rt_netlink.h"
#include "zebra/zebra_mpls.h"
@@ -105,3 +108,5 @@ int mpls_kernel_init(void)
return 0;
};
+
+#endif /* HAVE_NETLINK */
diff --git a/zebra/zebra_mpls_null.c b/zebra/zebra_mpls_null.c
index a9da5c29c..e4dc570fd 100644
--- a/zebra/zebra_mpls_null.c
+++ b/zebra/zebra_mpls_null.c
@@ -22,6 +22,8 @@
#include "zebra/rt.h"
#include "zebra/zebra_mpls.h"
+#if !defined(HAVE_NETLINK) && !defined(OPEN_BSD)
+
int kernel_add_lsp(zebra_lsp_t *lsp)
{
return 0;
@@ -38,3 +40,5 @@ int mpls_kernel_init(void)
{
return -1;
};
+
+#endif /* !defined(HAVE_NETLINK) && !defined(OPEN_BSD) */
diff --git a/zebra/zebra_mpls_openbsd.c b/zebra/zebra_mpls_openbsd.c
index fc1df9227..c3d09aedb 100644
--- a/zebra/zebra_mpls_openbsd.c
+++ b/zebra/zebra_mpls_openbsd.c
@@ -19,6 +19,9 @@
*/
#include <zebra.h>
+
+#ifdef OPEN_BSD
+
#include <netmpls/mpls.h>
#include "zebra/rt.h"
#include "zebra/zebra_mpls.h"
@@ -358,3 +361,5 @@ int mpls_kernel_init(void)
return 0;
}
+
+#endif /* OPEN_BSD */