diff options
41 files changed, 126 insertions, 59 deletions
diff --git a/bfdd/bfd_packet.c b/bfdd/bfd_packet.c index 5d8bf47fc..f2596dfc3 100644 --- a/bfdd/bfd_packet.c +++ b/bfdd/bfd_packet.c @@ -13,6 +13,10 @@ #include <zebra.h> +#ifdef GNU_LINUX +#include <linux/filter.h> +#endif + #ifdef BFD_LINUX #include <linux/if_packet.h> #endif /* BFD_LINUX */ diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index b627487e7..4ced565d5 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -28,6 +28,8 @@ #include "lib/json.h" #include "lib_errors.h" #include "zclient.h" +#include "frrdistance.h" + #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" #include "bgpd/bgp_route.h" diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 36e216cb1..c9d21b674 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -5,6 +5,10 @@ #include <zebra.h> +#ifdef GNU_LINUX +#include <linux/rtnetlink.h> //RT_TABLE_XXX +#endif + #include "command.h" #include "lib/json.h" #include "lib/sockopt.h" diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 381acd803..65ac92ef0 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -24,6 +24,7 @@ #include "mpls.h" #include "vxlan.h" #include "pbr.h" +#include "frrdistance.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_route.h" diff --git a/configure.ac b/configure.ac index 9985cdcbf..12cb4b9bb 100644 --- a/configure.ac +++ b/configure.ac @@ -1180,9 +1180,6 @@ m4_define([FRR_INCLUDES], /* Required for MAXSIG */ #include <signal.h> #include <sys/socket.h> -#ifdef __APPLE__ -# define __APPLE_USE_RFC_3542 -#endif #include <netinet/in.h> #include <sys/time.h> #include <time.h> diff --git a/lib/event.c b/lib/event.c index d3bc0205a..4121c0a44 100644 --- a/lib/event.c +++ b/lib/event.c @@ -55,11 +55,6 @@ static int event_timer_cmp(const struct event *a, const struct event *b) DECLARE_HEAP(event_timer_list, struct event, timeritem, event_timer_cmp); -#if defined(__APPLE__) -#include <mach/mach.h> -#include <mach/mach_time.h> -#endif - #define AWAKEN(m) \ do { \ const unsigned char wakebyte = 0x01; \ diff --git a/lib/frrdistance.h b/lib/frrdistance.h new file mode 100644 index 000000000..d2fa76e61 --- /dev/null +++ b/lib/frrdistance.h @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Zebra distance header + * Copyright (C) 2023 NVIDIA Corporation + * Donald Sharp + * + * Distance related defines. FRR needs a common set + * of values for distance. + */ +#ifndef __FRRDISTANCE_H__ +#define __FRRDISTANCE_H__ + +/* Default Administrative Distance of each protocol. */ +#define ZEBRA_KERNEL_DISTANCE_DEFAULT 0 +#define ZEBRA_CONNECT_DISTANCE_DEFAULT 0 +#define ZEBRA_STATIC_DISTANCE_DEFAULT 1 +#define ZEBRA_RIP_DISTANCE_DEFAULT 120 +#define ZEBRA_RIPNG_DISTANCE_DEFAULT 120 +#define ZEBRA_OSPF_DISTANCE_DEFAULT 110 +#define ZEBRA_OSPF6_DISTANCE_DEFAULT 110 +#define ZEBRA_ISIS_DISTANCE_DEFAULT 115 +#define ZEBRA_IBGP_DISTANCE_DEFAULT 200 +#define ZEBRA_EBGP_DISTANCE_DEFAULT 20 +#define ZEBRA_TABLE_DISTANCE_DEFAULT 15 +#define ZEBRA_TABLEDIRECT_DISTANCE_DEFAULT 14 +#define ZEBRA_EIGRP_DISTANCE_DEFAULT 90 +#define ZEBRA_NHRP_DISTANCE_DEFAULT 10 +#define ZEBRA_LDP_DISTANCE_DEFAULT 150 +#define ZEBRA_BABEL_DISTANCE_DEFAULT 100 +#define ZEBRA_SHARP_DISTANCE_DEFAULT 150 +#define ZEBRA_PBR_DISTANCE_DEFAULT 200 +#define ZEBRA_OPENFABRIC_DISTANCE_DEFAULT 115 +#define ZEBRA_MAX_DISTANCE_DEFAULT 255 + +#endif diff --git a/lib/ntop.c b/lib/ntop.c index 49e1b152c..89b4d5ecd 100644 --- a/lib/ntop.c +++ b/lib/ntop.c @@ -158,7 +158,7 @@ inet4: return dst; } -#if !defined(INET_NTOP_NO_OVERRIDE) && !defined(__APPLE__) +#if !defined(INET_NTOP_NO_OVERRIDE) /* we want to override libc inet_ntop, but make sure it shows up in backtraces * as frr_inet_ntop (to avoid confusion while debugging) */ diff --git a/lib/sockopt.c b/lib/sockopt.c index 0c4adb0b7..ed681710e 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -10,13 +10,12 @@ #include "sockunion.h" #include "lib_errors.h" -#if (defined(__FreeBSD__) \ - && ((__FreeBSD_version >= 500022 && __FreeBSD_version < 700000) \ - || (__FreeBSD_version < 500000 && __FreeBSD_version >= 440000))) \ - || (defined(__NetBSD__) && defined(__NetBSD_Version__) \ - && __NetBSD_Version__ >= 106010000) \ - || defined(__OpenBSD__) || defined(__APPLE__) \ - || defined(__DragonFly__) || defined(__sun) +#if (defined(__FreeBSD__) && \ + ((__FreeBSD_version >= 500022 && __FreeBSD_version < 700000) || \ + (__FreeBSD_version < 500000 && __FreeBSD_version >= 440000))) || \ + (defined(__NetBSD__) && defined(__NetBSD_Version__) && \ + __NetBSD_Version__ >= 106010000) || \ + defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun) #define HAVE_BSD_STRUCT_IP_MREQ_HACK #endif diff --git a/lib/subdir.am b/lib/subdir.am index d7b28ffbd..0c718d12a 100644 --- a/lib/subdir.am +++ b/lib/subdir.am @@ -219,6 +219,7 @@ pkginclude_HEADERS += \ lib/filter.h \ lib/flex_algo.h \ lib/freebsd-queue.h \ + lib/frrdistance.h \ lib/frrlua.h \ lib/frrscript.h \ lib/frr_pthread.h \ diff --git a/lib/zebra.h b/lib/zebra.h index b742e7184..e5021df22 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -76,10 +76,6 @@ #include <sys/sockio.h> #endif /* HAVE_SYS_SOCKIO_H */ -#ifdef __APPLE__ -#define __APPLE_USE_RFC_3542 -#endif - #ifndef HAVE_LIBCRYPT #ifdef HAVE_LIBCRYPTO #include <openssl/des.h> @@ -115,11 +111,7 @@ #include <net/route.h> -#ifdef HAVE_NETLINK -#include <linux/netlink.h> -#include <linux/rtnetlink.h> -#include <linux/filter.h> -#else +#ifndef HAVE_NETLINK #define RT_TABLE_MAIN 0 #define RT_TABLE_LOCAL RT_TABLE_MAIN #endif /* HAVE_NETLINK */ @@ -284,10 +276,9 @@ struct in_pktinfo { * OpenBSD: network byte order, apart from older versions which are as per * *BSD */ -#if defined(__NetBSD__) \ - || (defined(__FreeBSD__) && (__FreeBSD_version < 1100030)) \ - || (defined(__OpenBSD__) && (OpenBSD < 200311)) \ - || (defined(__APPLE__)) +#if defined(__NetBSD__) || \ + (defined(__FreeBSD__) && (__FreeBSD_version < 1100030)) || \ + (defined(__OpenBSD__) && (OpenBSD < 200311)) #define HAVE_IP_HDRINCL_BSD_ORDER #endif @@ -359,28 +350,6 @@ typedef enum { for (afi = AFI_IP; afi < AFI_MAX; afi++) \ for (safi = SAFI_UNICAST; safi <= SAFI_MPLS_VPN; safi++) -/* Default Administrative Distance of each protocol. */ -#define ZEBRA_KERNEL_DISTANCE_DEFAULT 0 -#define ZEBRA_CONNECT_DISTANCE_DEFAULT 0 -#define ZEBRA_STATIC_DISTANCE_DEFAULT 1 -#define ZEBRA_RIP_DISTANCE_DEFAULT 120 -#define ZEBRA_RIPNG_DISTANCE_DEFAULT 120 -#define ZEBRA_OSPF_DISTANCE_DEFAULT 110 -#define ZEBRA_OSPF6_DISTANCE_DEFAULT 110 -#define ZEBRA_ISIS_DISTANCE_DEFAULT 115 -#define ZEBRA_IBGP_DISTANCE_DEFAULT 200 -#define ZEBRA_EBGP_DISTANCE_DEFAULT 20 -#define ZEBRA_TABLE_DISTANCE_DEFAULT 15 -#define ZEBRA_TABLEDIRECT_DISTANCE_DEFAULT 14 -#define ZEBRA_EIGRP_DISTANCE_DEFAULT 90 -#define ZEBRA_NHRP_DISTANCE_DEFAULT 10 -#define ZEBRA_LDP_DISTANCE_DEFAULT 150 -#define ZEBRA_BABEL_DISTANCE_DEFAULT 100 -#define ZEBRA_SHARP_DISTANCE_DEFAULT 150 -#define ZEBRA_PBR_DISTANCE_DEFAULT 200 -#define ZEBRA_OPENFABRIC_DISTANCE_DEFAULT 115 -#define ZEBRA_MAX_DISTANCE_DEFAULT 255 - /* Flag manipulation macros. */ #define CHECK_FLAG(V,F) ((V) & (F)) #define SET_FLAG(V,F) (V) |= (F) diff --git a/lib/zlog.c b/lib/zlog.c index 309a955fa..2a6189573 100644 --- a/lib/zlog.c +++ b/lib/zlog.c @@ -32,9 +32,6 @@ #ifdef __DragonFly__ #include <sys/lwp.h> #endif -#ifdef __APPLE__ -#include <mach/mach_traps.h> -#endif #ifdef HAVE_LIBUNWIND #define UNW_LOCAL_ONLY diff --git a/nhrpd/netlink_arp.c b/nhrpd/netlink_arp.c index 2e22f8e24..bcecf9fc0 100644 --- a/nhrpd/netlink_arp.c +++ b/nhrpd/netlink_arp.c @@ -7,6 +7,10 @@ #include "config.h" #endif +#ifdef GNU_LINUX +#include <linux/rtnetlink.h> +#endif + #include <fcntl.h> #include <net/if.h> #include <netinet/if_ether.h> diff --git a/nhrpd/nhrp_multicast.c b/nhrpd/nhrp_multicast.c index fdc1a31f2..aead98284 100644 --- a/nhrpd/nhrp_multicast.c +++ b/nhrpd/nhrp_multicast.c @@ -7,6 +7,10 @@ #include "config.h" #endif +#ifdef GNU_LINUX +#include <linux/rtnetlink.h> +#endif + #include <fcntl.h> #include <net/if.h> #include <net/ethernet.h> diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 216837d8a..aa0625814 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -16,6 +16,7 @@ #include "defaults.h" #include "lib/json.h" #include "lib_errors.h" +#include "frrdistance.h" #include "ospf6_proto.h" #include "ospf6_message.h" diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index ab412e360..f6ea5c6ef 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -22,6 +22,7 @@ #include "defaults.h" #include "lib/printfrr.h" #include "keychain.h" +#include "frrdistance.h" #include "ospfd/ospfd.h" #include "ospfd/ospf_asbr.h" diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index e36bd82ac..335c8a454 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -17,6 +17,7 @@ #include "jhash.h" #include "wheel.h" #include "network.h" +#include "frrdistance.h" #include "pimd.h" #include "pim_pim.h" diff --git a/ripd/rip_peer.c b/ripd/rip_peer.c index 3e8ddeccf..7e848bee4 100644 --- a/ripd/rip_peer.c +++ b/ripd/rip_peer.c @@ -12,6 +12,7 @@ #include "frrevent.h" #include "memory.h" #include "table.h" +#include "frrdistance.h" #include "ripd/ripd.h" #include "ripd/rip_bfd.h" diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c index 36b58cb20..ce94e8e75 100644 --- a/ripd/rip_zebra.c +++ b/ripd/rip_zebra.c @@ -14,6 +14,8 @@ #include "log.h" #include "vrf.h" #include "bfd.h" +#include "frrdistance.h" + #include "ripd/ripd.h" #include "ripd/rip_debug.h" #include "ripd/rip_interface.h" diff --git a/ripd/ripd.c b/ripd/ripd.c index 7bfcaadc7..f197e389b 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -31,6 +31,7 @@ #include "northbound_cli.h" #include "network.h" #include "lib/printfrr.h" +#include "frrdistance.h" #include "ripd/ripd.h" #include "ripd/rip_nb.h" diff --git a/ripngd/ripng_peer.c b/ripngd/ripng_peer.c index 901b548a4..247bac469 100644 --- a/ripngd/ripng_peer.c +++ b/ripngd/ripng_peer.c @@ -15,6 +15,7 @@ #include "linklist.h" #include "frrevent.h" #include "memory.h" +#include "frrdistance.h" #include "ripngd/ripngd.h" #include "ripngd/ripng_nexthop.h" diff --git a/staticd/static_vty.c b/staticd/static_vty.c index 0582df88a..4ca3c2e92 100644 --- a/staticd/static_vty.c +++ b/staticd/static_vty.c @@ -19,6 +19,7 @@ #include "libfrr.h" #include "routing_nb.h" #include "northbound_cli.h" +#include "frrdistance.h" #include "static_vrf.h" #include "static_vty.h" diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c index 70bcfe449..c98655fdb 100644 --- a/zebra/dplane_fpm_nl.c +++ b/zebra/dplane_fpm_nl.c @@ -19,6 +19,9 @@ #include <string.h> #include "lib/zebra.h" + +#include <linux/rtnetlink.h> + #include "lib/json.h" #include "lib/libfrr.h" #include "lib/frratomic.h" diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index ed2e0a224..6dad69396 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -17,6 +17,8 @@ #define _LINUX_IF_H #define _LINUX_IP_H +#include <linux/netlink.h> +#include <linux/rtnetlink.h> #include <netinet/if_ether.h> #include <linux/if_bridge.h> #include <linux/if_link.h> diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index 3f4a03192..8b59ecd87 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -6,6 +6,9 @@ #include <zebra.h> #ifdef HAVE_NETLINK +#include <linux/netlink.h> +#include <linux/rtnetlink.h> +#include <linux/filter.h> #include "linklist.h" #include "if.h" diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index d897f4a1d..62adbc0c3 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -48,11 +48,7 @@ extern struct zebra_privs_t zserv_privs; * 0). We follow this practice without questioning it, but it is a * bug if frr calls ROUNDUP with 0. */ -#ifdef __APPLE__ -#define ROUNDUP_TYPE int -#else -#define ROUNDUP_TYPE long -#endif +#define ROUNDUP_TYPE long /* * Because of these varying conventions, the only sane approach is for diff --git a/zebra/main.c b/zebra/main.c index 158d1b8c4..aea30daa3 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -5,6 +5,10 @@ #include <zebra.h> +#ifdef GNU_LINUX +#include <linux/rtnetlink.h> +#endif + #include <lib/version.h> #include "getopt.h" #include "command.h" diff --git a/zebra/netconf_netlink.c b/zebra/netconf_netlink.c index 7352dfb2e..9a0b3c5d0 100644 --- a/zebra/netconf_netlink.c +++ b/zebra/netconf_netlink.c @@ -11,6 +11,8 @@ #include <ns.h> +#include <linux/netlink.h> +#include <linux/rtnetlink.h> #include "linux/netconf.h" #include "lib/lib_errors.h" diff --git a/zebra/redistribute.c b/zebra/redistribute.c index 1cfed6df4..1ee983916 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -16,6 +16,7 @@ #include "log.h" #include "vrf.h" #include "srcdest_table.h" +#include "frrdistance.h" #include "zebra/rib.h" #include "zebra/zebra_router.h" diff --git a/zebra/rule_netlink.c b/zebra/rule_netlink.c index f00aef52c..05282793d 100644 --- a/zebra/rule_netlink.c +++ b/zebra/rule_netlink.c @@ -9,6 +9,9 @@ #ifdef HAVE_NETLINK +#include <linux/netlink.h> +#include <linux/rtnetlink.h> + #include "if.h" #include "prefix.h" #include "vrf.h" diff --git a/zebra/tc_netlink.c b/zebra/tc_netlink.c index d633c0777..19667e66a 100644 --- a/zebra/tc_netlink.c +++ b/zebra/tc_netlink.c @@ -9,6 +9,7 @@ #ifdef HAVE_NETLINK +#include <linux/rtnetlink.h> #include <linux/pkt_cls.h> #include <linux/pkt_sched.h> #include <netinet/if_ether.h> diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 856c906bd..34977a914 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -24,6 +24,7 @@ #include "lib/vrf.h" #include "lib/libfrr.h" #include "lib/lib_errors.h" +#include "lib/frrdistance.h" #include "zebra/zebra_router.h" #include "zebra/rib.h" diff --git a/zebra/zebra_evpn_neigh.c b/zebra/zebra_evpn_neigh.c index a00d8c969..81705d4e8 100644 --- a/zebra/zebra_evpn_neigh.c +++ b/zebra/zebra_evpn_neigh.c @@ -6,6 +6,10 @@ #include <zebra.h> +#ifdef GNU_LINUX +#include <linux/neighbour.h> +#endif + #include "hash.h" #include "interface.h" #include "jhash.h" diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c index 699f3ed11..92dc591d4 100644 --- a/zebra/zebra_fpm.c +++ b/zebra/zebra_fpm.c @@ -8,6 +8,10 @@ #include <zebra.h> +#ifdef GNU_LINUX +#include <linux/rtnetlink.h> +#endif + #include "log.h" #include "libfrr.h" #include "stream.h" diff --git a/zebra/zebra_fpm_dt.c b/zebra/zebra_fpm_dt.c index 94308a961..ce5eb6fe1 100644 --- a/zebra/zebra_fpm_dt.c +++ b/zebra/zebra_fpm_dt.c @@ -22,6 +22,10 @@ */ #include <zebra.h> + +#ifdef GNU_LINUX +#include <linux/rtnetlink.h> +#endif #include "log.h" #include "vrf.h" diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c index 127976223..1dd96347f 100644 --- a/zebra/zebra_fpm_netlink.c +++ b/zebra/zebra_fpm_netlink.c @@ -11,6 +11,9 @@ #ifdef HAVE_NETLINK +#include <linux/rtnetlink.h> +#include <linux/neighbour.h> + #include "log.h" #include "rib.h" #include "vty.h" diff --git a/zebra/zebra_mpls_netlink.c b/zebra/zebra_mpls_netlink.c index 4bc676f39..b76640743 100644 --- a/zebra/zebra_mpls_netlink.c +++ b/zebra/zebra_mpls_netlink.c @@ -7,6 +7,9 @@ #ifdef HAVE_NETLINK +#include <linux/netlink.h> +#include <linux/rtnetlink.h> + #include "zebra/debug.h" #include "zebra/rt.h" #include "zebra/rt_netlink.h" diff --git a/zebra/zebra_netns_id.c b/zebra/zebra_netns_id.c index 0531ab959..ae8f9d9a8 100644 --- a/zebra/zebra_netns_id.c +++ b/zebra/zebra_netns_id.c @@ -6,6 +6,10 @@ #include <zebra.h> +#ifdef GNU_LINUX +#include <linux/if_link.h> +#endif + #include "ns.h" #include "vrf.h" #include "log.h" diff --git a/zebra/zebra_ns.h b/zebra/zebra_ns.h index edf261197..cda8bada0 100644 --- a/zebra/zebra_ns.h +++ b/zebra/zebra_ns.h @@ -18,6 +18,8 @@ extern "C" { #endif #ifdef HAVE_NETLINK +#include <linux/netlink.h> + /* Socket interface to kernel */ struct nlsock { int sock; diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 37c042c04..05ac3f3d8 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -5,6 +5,10 @@ #include <zebra.h> +#ifdef GNU_LINUX +#include <linux/rtnetlink.h> +#endif + #include "command.h" #include "if.h" #include "linklist.h" @@ -25,6 +29,7 @@ #include "frr_pthread.h" #include "printfrr.h" #include "frrscript.h" +#include "frrdistance.h" #include "zebra/zebra_router.h" #include "zebra/connected.h" diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 8c9724873..a584cf638 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -20,6 +20,7 @@ #include "vxlan.h" #include "termtable.h" #include "affinitymap.h" +#include "frrdistance.h" #include "zebra/zebra_router.h" #include "zebra/zserv.h" |