diff options
92 files changed, 394 insertions, 290 deletions
diff --git a/Makefile.am b/Makefile.am index 0dff83e505..e4149b62ed 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,9 +1,10 @@ ## Process this file with automake to produce Makefile.in. AUTOMAKE_OPTIONS = subdir-objects 1.12 -ACLOCAL_AMFLAGS = -I m4 +ACLOCAL_AMFLAGS = -I m4 -Wall,no-override AM_CFLAGS = \ + $(AC_CFLAGS) \ $(LIBYANG_CFLAGS) \ $(SQLITE3_CFLAGS) \ $(UNWIND_CFLAGS) \ @@ -12,7 +13,7 @@ AM_CFLAGS = \ # end AM_CPPFLAGS = \ -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_srcdir)/lib \ - -I$(top_builddir) -I$(top_builddir)/include -I$(top_builddir)/lib \ + -I$(top_builddir) \ $(LUA_INCLUDE) \ # end AM_LDFLAGS = \ diff --git a/babeld/babel_main.c b/babeld/babel_main.c index 71ac356585..df1998c4fc 100644 --- a/babeld/babel_main.c +++ b/babeld/babel_main.c @@ -28,7 +28,7 @@ THE SOFTWARE. #include "thread.h" #include "privs.h" #include "sigevent.h" -#include "version.h" +#include "lib/version.h" #include "command.h" #include "vty.h" #include "memory.h" diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c index 0e5f506b3a..abe97571c5 100644 --- a/bgpd/bgp_bmp.c +++ b/bgpd/bgp_bmp.c @@ -34,7 +34,7 @@ #include "lib_errors.h" #include "stream.h" #include "libfrr.h" -#include "version.h" +#include "lib/version.h" #include "jhash.h" #include "termtable.h" diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index 7f6f61e141..923c9b0d7e 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -1294,15 +1294,19 @@ bool ecommunity_del_val(struct ecommunity *ecom, struct ecommunity_val *eval) /* Delete the selected value */ ecom->size--; - p = XMALLOC(MTYPE_ECOMMUNITY_VAL, ecom->size * ecom->unit_size); - if (c != 0) - memcpy(p, ecom->val, c * ecom->unit_size); - if ((ecom->size - c) != 0) - memcpy(p + (c)*ecom->unit_size, - ecom->val + (c + 1) * ecom->unit_size, - (ecom->size - c) * ecom->unit_size); - XFREE(MTYPE_ECOMMUNITY_VAL, ecom->val); - ecom->val = p; + if (ecom->size) { + p = XMALLOC(MTYPE_ECOMMUNITY_VAL, ecom->size * ecom->unit_size); + if (c != 0) + memcpy(p, ecom->val, c * ecom->unit_size); + if ((ecom->size - c) != 0) + memcpy(p + (c)*ecom->unit_size, + ecom->val + (c + 1) * ecom->unit_size, + (ecom->size - c) * ecom->unit_size); + XFREE(MTYPE_ECOMMUNITY_VAL, ecom->val); + ecom->val = p; + } else + ecom->val = NULL; + return true; } diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 45a856a459..88c44fc984 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -101,7 +101,7 @@ static int bgp_delayopen_timer(struct thread *); static int bgp_start(struct peer *); /* Register peer with NHT */ -static int bgp_peer_reg_with_nht(struct peer *peer) +int bgp_peer_reg_with_nht(struct peer *peer) { int connected = 0; @@ -340,6 +340,8 @@ static struct peer *peer_xfer_conn(struct peer *from_peer) * needed, even on a passive connection. */ bgp_peer_reg_with_nht(peer); + if (from_peer) + bgp_replace_nexthop_by_peer(from_peer, peer); bgp_reads_on(peer); bgp_writes_on(peer); diff --git a/bgpd/bgp_fsm.h b/bgpd/bgp_fsm.h index bcf697e153..12cbad3eb8 100644 --- a/bgpd/bgp_fsm.h +++ b/bgpd/bgp_fsm.h @@ -179,4 +179,5 @@ const char *print_peer_gr_mode(enum peer_mode pr_mode); const char *print_peer_gr_cmd(enum peer_gr_command pr_gr_cmd); const char *print_global_gr_mode(enum global_mode gl_mode); const char *print_global_gr_cmd(enum global_gr_command gl_gr_cmd); +int bgp_peer_reg_with_nht(struct peer *peer); #endif /* _QUAGGA_BGP_FSM_H */ diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 62fed931f9..eb68d84c06 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -540,6 +540,17 @@ leak_update(struct bgp *bgp, /* destination bgp instance */ if (bpi) { bool labelssame = labels_same(bpi, label, num_labels); + if (CHECK_FLAG(source_bpi->flags, BGP_PATH_REMOVED) + && CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) { + if (debug) { + zlog_debug( + "%s: ->%s(s_flags: 0x%x b_flags: 0x%x): %pFX: Found route, being removed, not leaking", + __func__, bgp->name_pretty, + source_bpi->flags, bpi->flags, p); + } + return NULL; + } + if (attrhash_cmp(bpi->attr, new_attr) && labelssame && !CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) { @@ -613,6 +624,16 @@ leak_update(struct bgp *bgp, /* destination bgp instance */ return bpi; } + if (CHECK_FLAG(source_bpi->flags, BGP_PATH_REMOVED)) { + if (debug) { + zlog_debug( + "%s: ->%s(s_flags: 0x%x): %pFX: New route, being removed, not leaking", + __func__, bgp->name_pretty, + source_bpi->flags, p); + } + return NULL; + } + new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_IMPORTED, 0, bgp->peer_self, new_attr, bn); @@ -1027,6 +1048,8 @@ void vpn_leak_from_vrf_withdraw_all(struct bgp *bgp_vpn, /* to */ if (debug) zlog_debug("%s: deleting it", __func__); + /* withdraw from leak-to vrfs as well */ + vpn_leak_to_vrf_withdraw(bgp_vpn, bpi); bgp_aggregate_decrement( bgp_vpn, bgp_dest_get_prefix(bn), bpi, @@ -1101,7 +1124,10 @@ vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */ if (!ecom_intersect( bgp_vrf->vpn_policy[afi].rtlist[BGP_VPN_POLICY_DIR_FROMVPN], path_vpn->attr->ecommunity)) { - + if (debug) + zlog_debug( + "from vpn to vrf %s, skipping after no intersection of route targets", + bgp_vrf->name_pretty); return; } @@ -1532,7 +1558,8 @@ void vpn_handle_router_id_update(struct bgp *bgp, bool withdraw, bool is_config) { afi_t afi; - int debug; + int debug = (BGP_DEBUG(vpn, VPN_LEAK_TO_VRF) + | BGP_DEBUG(vpn, VPN_LEAK_FROM_VRF)); char *vname; const char *export_name; char buf[RD_ADDRSTRLEN]; @@ -1541,14 +1568,23 @@ void vpn_handle_router_id_update(struct bgp *bgp, bool withdraw, struct ecommunity *ecom; vpn_policy_direction_t idir, edir; + /* + * Router-id change that is not explicitly configured + * (a change from zebra, frr restart for example) + * should not replace a configured vpn RD/RT. + */ + if (!is_config) { + if (debug) + zlog_debug("%s: skipping non explicit router-id change", + __func__); + return; + } + if (bgp->inst_type != BGP_INSTANCE_TYPE_DEFAULT && bgp->inst_type != BGP_INSTANCE_TYPE_VRF) return; export_name = bgp->name ? bgp->name : VRF_DEFAULT_NAME; - debug = (BGP_DEBUG(vpn, VPN_LEAK_TO_VRF) | - BGP_DEBUG(vpn, VPN_LEAK_FROM_VRF)); - idir = BGP_VPN_POLICY_DIR_FROMVPN; edir = BGP_VPN_POLICY_DIR_TOVPN; @@ -1574,26 +1610,12 @@ void vpn_handle_router_id_update(struct bgp *bgp, bool withdraw, if (!bgp_import) continue; - ecommunity_del_val(bgp_import->vpn_policy[afi]. - rtlist[idir], + ecommunity_del_val( + bgp_import->vpn_policy[afi] + .rtlist[idir], (struct ecommunity_val *)ecom->val); - } } else { - /* - * Router-id changes that are not explicit config - * changes should not replace configured RD/RT. - */ - if (!is_config) { - if (CHECK_FLAG(bgp->vpn_policy[afi].flags, - BGP_VPN_POLICY_TOVPN_RD_SET)) { - if (debug) - zlog_debug("%s: auto router-id change skipped", - __func__); - goto postchange; - } - } - /* New router-id derive auto RD and RT and export * to VPN */ @@ -1624,10 +1646,8 @@ void vpn_handle_router_id_update(struct bgp *bgp, bool withdraw, else bgp_import->vpn_policy[afi].rtlist[idir] = ecommunity_dup(ecom); - } -postchange: /* Update routes to VPN */ vpn_leak_postchange(BGP_VPN_POLICY_DIR_TOVPN, afi, bgp_get_default(), diff --git a/bgpd/bgp_mplsvpn_snmp.c b/bgpd/bgp_mplsvpn_snmp.c index 6f75856d54..7a2f618ce6 100644 --- a/bgpd/bgp_mplsvpn_snmp.c +++ b/bgpd/bgp_mplsvpn_snmp.c @@ -32,7 +32,7 @@ #include "filter.h" #include "hook.h" #include "libfrr.h" -#include "version.h" +#include "lib/version.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_route.h" diff --git a/bgpd/bgp_nb_config.c b/bgpd/bgp_nb_config.c index 5a88bd08d9..94ff362d1a 100644 --- a/bgpd/bgp_nb_config.c +++ b/bgpd/bgp_nb_config.c @@ -123,7 +123,12 @@ int bgp_router_create(struct nb_cb_create_args *args) if (is_new_bgp && inst_type == BGP_INSTANCE_TYPE_DEFAULT) vpn_leak_postchange_all(); - if (inst_type == BGP_INSTANCE_TYPE_VRF) + /* + * Check if we need to export to other VRF(s). + * Leak the routes to importing bgp vrf instances, + * only when new bgp vrf instance is configured. + */ + if (ret != BGP_INSTANCE_EXISTS) bgp_vpn_leak_export(bgp); UNSET_FLAG(bgp->vrf_flags, BGP_VRF_AUTO); diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index 4821ce8ddb..8d9024e07c 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -569,6 +569,7 @@ static int bgp_accept(struct thread *thread) peer1->doppelganger = peer; peer->fd = bgp_sock; vrf_bind(peer->bgp->vrf_id, bgp_sock, bgp_get_bound_name(peer)); + bgp_peer_reg_with_nht(peer); bgp_fsm_change_status(peer, Active); BGP_TIMER_OFF(peer->t_start); /* created in peer_create() */ diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 9c8d7878c5..7ccfae4ba4 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -98,6 +98,31 @@ void bgp_unlink_nexthop(struct bgp_path_info *path) bgp_unlink_nexthop_check(bnc); } +void bgp_replace_nexthop_by_peer(struct peer *from, struct peer *to) +{ + struct prefix pp; + struct prefix pt; + struct bgp_nexthop_cache *bncp, *bnct; + afi_t afi; + + if (!sockunion2hostprefix(&from->su, &pp)) + return; + + afi = family2afi(pp.family); + bncp = bnc_find(&from->bgp->nexthop_cache_table[afi], &pp, 0); + + if (!sockunion2hostprefix(&to->su, &pt)) + return; + + bnct = bnc_find(&to->bgp->nexthop_cache_table[afi], &pt, 0); + + if (bnct != bncp) + return; + + if (bnct) + bnct->nht_info = to; +} + void bgp_unlink_nexthop_by_peer(struct peer *peer) { struct prefix p; @@ -273,8 +298,16 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop, (bgp_path_info_extra_get(pi))->igpmetric = bnc->metric; else if (pi->extra) pi->extra->igpmetric = 0; - } else if (peer) - bnc->nht_info = (void *)peer; /* NHT peer reference */ + } else if (peer) { + /* + * Let's not accidently save the peer data for a peer + * we are going to throw away in a second or so. + * When we come back around we'll fix up this + * data properly in replace_nexthop_by_peer + */ + if (CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) + bnc->nht_info = (void *)peer; /* NHT peer reference */ + } /* * We are cheating here. Views have no associated underlying diff --git a/bgpd/bgp_nht.h b/bgpd/bgp_nht.h index a1683e1511..9268b225ca 100644 --- a/bgpd/bgp_nht.h +++ b/bgpd/bgp_nht.h @@ -51,7 +51,7 @@ extern int bgp_find_or_add_nexthop(struct bgp *bgp_route, */ extern void bgp_unlink_nexthop(struct bgp_path_info *p); void bgp_unlink_nexthop_by_peer(struct peer *peer); - +void bgp_replace_nexthop_by_peer(struct peer *from, struct peer *to); /** * bgp_delete_connected_nexthop() - Reset the 'peer' pointer for a connected * nexthop entry. If no paths reference the nexthop, it will be unregistered diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 321397c3af..49b94e6d7c 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -10260,7 +10260,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn, vty_out(vty, "\n"); /* Line 4 display Community */ - if (attr->community) { + if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES)) { if (json_paths) { if (!attr->community->json) community_str(attr->community, true); diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c index bb85ad393d..816ed88eec 100644 --- a/bgpd/bgp_rpki.c +++ b/bgpd/bgp_rpki.c @@ -57,7 +57,7 @@ #endif #include "hook.h" #include "libfrr.h" -#include "version.h" +#include "lib/version.h" #ifndef VTYSH_EXTRACT_PL #include "bgpd/bgp_rpki_clippy.c" diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c index 3afdbea908..61a6467ab6 100644 --- a/bgpd/bgp_snmp.c +++ b/bgpd/bgp_snmp.c @@ -32,7 +32,7 @@ #include "filter.h" #include "hook.h" #include "libfrr.h" -#include "version.h" +#include "lib/version.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index d1912db01f..ae0bf7fe92 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1700,9 +1700,6 @@ int bgp_redistribute_set(struct bgp *bgp, afi_t afi, int type, redist_add_instance(&zclient->mi_redist[afi][type], instance); } else { - if (vrf_bitmap_check(zclient->redist[afi][type], bgp->vrf_id)) - return CMD_WARNING; - #ifdef ENABLE_BGP_VNC if (EVPN_ENABLED(bgp) && type == ZEBRA_ROUTE_VNC_DIRECT) { vnc_export_bgp_enable( diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index d37b9fa48c..bad62f9946 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -3402,7 +3402,7 @@ int bgp_get(struct bgp **bgp_val, as_t *as, const char *name, return ret; case BGP_SUCCESS: if (*bgp_val) - return ret; + return BGP_INSTANCE_EXISTS; } bgp = bgp_create(as, name, inst_type); diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 51134dc8c5..f9aa62c682 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -1844,6 +1844,7 @@ enum bgp_clear_type { /* BGP error codes. */ #define BGP_SUCCESS 0 #define BGP_CREATED 1 +#define BGP_INSTANCE_EXISTS 2 #define BGP_ERR_INVALID_VALUE -1 #define BGP_ERR_INVALID_FLAG -2 #define BGP_ERR_INVALID_AS -3 diff --git a/bgpd/rfp-example/rfptest/subdir.am b/bgpd/rfp-example/rfptest/subdir.am index 9f6d33a855..1b5024a30b 100644 --- a/bgpd/rfp-example/rfptest/subdir.am +++ b/bgpd/rfp-example/rfptest/subdir.am @@ -6,7 +6,10 @@ if ENABLE_BGP_VNC noinst_PROGRAMS += bgpd/rfp-example/rfptest/rfptest endif -bgpd_rfp_example_rfptest_rfptest_CFLAGS = -I$(top_srcdir)/bgpd/rfapi +bgpd_rfp_example_rfptest_rfptest_CFLAGS = \ + $(AM_CFLAGS) \ + -I$(top_srcdir)/bgpd/rfapi \ + # end bgpd_rfp_example_rfptest_rfptest_SOURCES = \ bgpd/rfp-example/rfptest/rfptest.c \ # end diff --git a/bgpd/subdir.am b/bgpd/subdir.am index 07e71ba601..2c73f14594 100644 --- a/bgpd/subdir.am +++ b/bgpd/subdir.am @@ -211,20 +211,17 @@ noinst_HEADERS += \ bgpd_bgpd_SOURCES = bgpd/bgp_main.c bgpd_bgp_btoa_SOURCES = bgpd/bgp_btoa.c -bgpd_bgpd_CFLAGS = $(AM_CFLAGS) -bgpd_bgp_btoa_CFLAGS = $(AM_CFLAGS) - # RFPLDADD is set in bgpd/rfp-example/librfp/subdir.am bgpd_bgpd_LDADD = bgpd/libbgp.a $(RFPLDADD) lib/libfrr.la $(LIBCAP) $(LIBM) $(UST_LIBS) bgpd_bgp_btoa_LDADD = bgpd/libbgp.a $(RFPLDADD) lib/libfrr.la $(LIBCAP) $(LIBM) $(UST_LIBS) bgpd_bgpd_snmp_la_SOURCES = bgpd/bgp_snmp.c bgpd/bgp_mplsvpn_snmp.c -bgpd_bgpd_snmp_la_CFLAGS = $(WERROR) $(SNMP_CFLAGS) -std=gnu11 +bgpd_bgpd_snmp_la_CFLAGS = $(AM_CFLAGS) $(SNMP_CFLAGS) -std=gnu11 bgpd_bgpd_snmp_la_LDFLAGS = -avoid-version -module -shared -export-dynamic bgpd_bgpd_snmp_la_LIBADD = lib/libfrrsnmp.la bgpd_bgpd_rpki_la_SOURCES = bgpd/bgp_rpki.c -bgpd_bgpd_rpki_la_CFLAGS = $(WERROR) $(RTRLIB_CFLAGS) +bgpd_bgpd_rpki_la_CFLAGS = $(AM_CFLAGS) $(RTRLIB_CFLAGS) bgpd_bgpd_rpki_la_LDFLAGS = -avoid-version -module -shared -export-dynamic bgpd_bgpd_rpki_la_LIBADD = $(RTRLIB_LIBS) diff --git a/bootstrap.sh b/bootstrap.sh index c0b95d3dd0..212e7d1d45 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -4,4 +4,4 @@ # and so that those used to the presence of bootstrap.sh or autogen.sh # will have an eaiser time. -autoreconf -i +exec autoreconf -is -Wall,no-override diff --git a/configure.ac b/configure.ac index f9516e559f..a770a78105 100755..100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,7 @@ ## Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org> ## Portions Copyright (c) 2003 Paul Jakma <paul@dishone.st> ## -AC_PREREQ([2.60]) +AC_PREREQ([2.69]) AC_INIT([frr], [7.7-dev], [https://github.com/frrouting/frr/issues]) PACKAGE_URL="https://frrouting.org/" @@ -18,6 +18,7 @@ AC_SUBST([CONFIG_ARGS]) AC_CONFIG_SRCDIR([lib/zebra.h]) AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_AUX_DIR([m4/ac]) dnl ----------------------------------- dnl Get hostname and other information. @@ -205,6 +206,7 @@ AC_SUBST([SED]) dnl try and enable CFLAGS that are useful for FRR dnl - specifically, options to control warnings +AC_SUBST([AC_CFLAGS]) AC_USE_SYSTEM_EXTENSIONS AC_DEFUN([AC_C_FLAG], [{ m4_pushdef([cachename],[m4_translit([frr_cv_$1],[ =-+/{}$],[________])]) @@ -223,7 +225,7 @@ AC_DEFUN([AC_C_FLAG], [{ AC_LANG_POP([C]) ]) if test "$cachename" = "yes"; then - m4_if([$3], [], [CFLAGS="$CFLAGS $1"], [$3]) + m4_if([$3], [], [AC_CFLAGS="$AC_CFLAGS $1"], [$3]) else : $2 @@ -275,7 +277,7 @@ if test "$enable_gcov" = "yes"; then AC_C_FLAG([-O0]) fi - LDFLAGS="${LDFLAGS} -lgcov" + AC_LDFLAGS="${AC_LDFLAGS} -lgcov" fi if test "$enable_clang_coverage" = "yes"; then @@ -302,17 +304,19 @@ if test "$enable_scripting" = "yes"; then ]) fi +dnl the following flags go in CFLAGS rather than AC_CFLAGS since they make +dnl sense to be overridden by the user if test "$enable_dev_build" = "yes"; then AC_DEFINE([DEV_BUILD], [1], [Build for development]) if test "$orig_cflags" = ""; then - AC_C_FLAG([-g3]) - AC_C_FLAG([-O0]) - AC_C_FLAG([-ggdb3]) + AC_C_FLAG([-O0],,[CFLAGS="$CFLAGS -O0"]) + AC_C_FLAG([-g3],,[CFLAGS="$CFLAGS -g3"]) + AC_C_FLAG([-ggdb3],,[CFLAGS="$CFLAGS -ggdb3"]) fi else if test "$orig_cflags" = ""; then - AC_C_FLAG([-g]) - AC_C_FLAG([-O2]) + AC_C_FLAG([-g],,[CFLAGS="$CFLAGS -g"]) + AC_C_FLAG([-O2],,[CFLAGS="$CFLAGS -O2"]) fi fi @@ -449,7 +453,7 @@ dnl ---------- AX_PTHREAD([ CC="$PTHREAD_CC" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + AC_CFLAGS="$AC_CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" ], [ AC_MSG_FAILURE([This FRR version needs pthreads]) @@ -969,7 +973,7 @@ dnl ------------------------- dnl Check other header files. dnl ------------------------- AC_CHECK_HEADERS([stropts.h sys/ksym.h \ - linux/version.h asm/types.h]) + linux/version.h asm/types.h endian.h sys/endian.h]) ac_stdatomic_ok=false AC_DEFINE([FRR_AUTOCONF_ATOMIC], [1], [did autoconf checks for atomic funcs]) @@ -1262,11 +1266,6 @@ if test "$enable_realms" = "yes"; then esac fi -dnl ------------------------------- -dnl Endian-ness check -dnl ------------------------------- -AC_WORDS_BIGENDIAN - dnl --------------- dnl other functions dnl --------------- @@ -1521,24 +1520,22 @@ FRR_INCLUDES #endif ])dnl -AC_MSG_CHECKING([for BSD struct ip_mreq hack]) -AC_TRY_COMPILE([#include <sys/param.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) - return (0); -#else - #error No support for BSD struct ip_mreq hack detected -#endif],[AC_MSG_RESULT([yes]) -AC_DEFINE([HAVE_BSD_STRUCT_IP_MREQ_HACK], [1], [Can pass ifindex in struct ip_mreq])], -AC_MSG_RESULT([no])) - AC_MSG_CHECKING([for RFC3678 protocol-independed API]) -AC_TRY_COMPILE([ -#include <sys/types.h> -#include <netinet/in.h> -], [struct group_req gr; int sock; setsockopt(sock, IPPROTO_IP, MCAST_JOIN_GROUP, (void*)&gr, sizeof(gr)); -], [AC_MSG_RESULT([yes]) -AC_DEFINE([HAVE_RFC3678], [1], [Have RFC3678 protocol-independed API])], -AC_MSG_RESULT([no])) +AC_COMPILE_IFELSE( +[ AC_LANG_PROGRAM([[ + #include <sys/types.h> + #include <netinet/in.h> + ]], [[ + struct group_req gr; + int sock; + setsockopt(sock, IPPROTO_IP, MCAST_JOIN_GROUP, (void*)&gr, sizeof(gr)); + ]]) +],[ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_RFC3678], [1], [Have RFC3678 protocol-independed API]) +],[ + AC_MSG_RESULT(no) +]) dnl --------------------------------------------------------------- dnl figure out how to check link-state @@ -2135,12 +2132,16 @@ dnl ----------------------- dnl checking for IP_PKTINFO dnl ----------------------- AC_MSG_CHECKING([for IP_PKTINFO]) -AC_TRY_COMPILE([#include <netdb.h>], [ - int opt = IP_PKTINFO; -], [ +AC_COMPILE_IFELSE( +[ AC_LANG_PROGRAM([[ + #include <netdb.h> + ]], [[ + int opt = IP_PKTINFO; + ]]) +],[ AC_MSG_RESULT([yes]) AC_DEFINE([HAVE_IP_PKTINFO], [1], [Have IP_PKTINFO]) -], [ +],[ AC_MSG_RESULT([no]) ]) @@ -2148,12 +2149,16 @@ dnl --------------------------- dnl checking for IP_RECVDSTADDR dnl --------------------------- AC_MSG_CHECKING([for IP_RECVDSTADDR]) -AC_TRY_COMPILE([#include <netinet/in.h>], [ - int opt = IP_RECVDSTADDR; -], [ +AC_COMPILE_IFELSE( +[ AC_LANG_PROGRAM([[ + #include <netinet/in.h> + ]], [[ + int opt = IP_RECVDSTADDR; + ]]) +],[ AC_MSG_RESULT([yes]) AC_DEFINE([HAVE_IP_RECVDSTADDR], [1], [Have IP_RECVDSTADDR]) -], [ +],[ AC_MSG_RESULT([no]) ]) @@ -2161,12 +2166,16 @@ dnl ---------------------- dnl checking for IP_RECVIF dnl ---------------------- AC_MSG_CHECKING([for IP_RECVIF]) -AC_TRY_COMPILE([#include <netinet/in.h>], [ - int opt = IP_RECVIF; -], [ +AC_COMPILE_IFELSE( +[ AC_LANG_PROGRAM([[ + #include <netinet/in.h> + ]], [[ + int opt = IP_RECVIF; + ]]) +],[ AC_MSG_RESULT([yes]) AC_DEFINE([HAVE_IP_RECVIF], [1], [Have IP_RECVIF]) -], [ +],[ AC_MSG_RESULT([no]) ]) @@ -2174,12 +2183,16 @@ dnl ---------------------- dnl checking for SO_BINDANY dnl ---------------------- AC_MSG_CHECKING([for SO_BINDANY]) -AC_TRY_COMPILE([#include <sys/socket.h>], [ - int opt = SO_BINDANY; -], [ +AC_COMPILE_IFELSE( +[ AC_LANG_PROGRAM([[ + #include <sys/socket.h> + ]], [[ + int opt = SO_BINDANY; + ]]) +],[ AC_MSG_RESULT([yes]) AC_DEFINE([HAVE_SO_BINDANY], [1], [Have SO_BINDANY]) -], [ +],[ AC_MSG_RESULT([no]) ]) @@ -2187,20 +2200,30 @@ dnl ---------------------- dnl checking for IP_FREEBIND dnl ---------------------- AC_MSG_CHECKING([for IP_FREEBIND]) -AC_TRY_COMPILE([#include <netinet/in.h>], [ - int opt = IP_FREEBIND; -], [ +AC_COMPILE_IFELSE( +[ AC_LANG_PROGRAM([[ + #include <netinet/in.h> + ]], [[ + int opt = IP_FREEBIND; + ]]) +],[ AC_MSG_RESULT([yes]) AC_DEFINE([HAVE_IP_FREEBIND], [1], [Have IP_FREEBIND]) -], [ +],[ AC_MSG_RESULT([no]) ]) dnl -------------------------------------- dnl checking for be32dec existence or not dnl -------------------------------------- -AC_CHECK_DECLS([be32enc, be32dec], [], [], - [#include <sys/endian.h>]) +AC_CHECK_DECLS([be32enc, be32dec], [], [], [ + #ifdef HAVE_SYS_ENDIAN_H + #include <sys/endian.h> + #endif + #ifdef HAVE_ENDIAN_H + #include <endian.h> + #endif +]) dnl -------------------------------------- dnl checking for clock_time monotonic struct and call @@ -2288,12 +2311,17 @@ dnl capabilities checks dnl ------------------- if test "$enable_capabilities" != "no"; then AC_MSG_CHECKING([whether prctl PR_SET_KEEPCAPS is available]) - AC_TRY_COMPILE([#include <sys/prctl.h>], [prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);], - [AC_MSG_RESULT([yes]) + AC_COMPILE_IFELSE( + [ AC_LANG_PROGRAM([[ + #include <sys/prctl.h> + ]], [[ + prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0); + ]]) + ],[AC_MSG_RESULT([yes]) AC_DEFINE([HAVE_PR_SET_KEEPCAPS], [1], [prctl]) - frr_ac_keepcaps="yes"], - AC_MSG_RESULT([no]) - ) + frr_ac_keepcaps="yes" + ],[AC_MSG_RESULT(no) + ]) if test "$frr_ac_keepcaps" = "yes"; then AC_CHECK_HEADERS([sys/capability.h]) fi @@ -2652,7 +2680,7 @@ FRR version : ${PACKAGE_VERSION} host operating system : ${host_os} source code location : ${srcdir} compiler : ${CC} -compiler flags : ${CFLAGS} ${SAN_FLAGS} +compiler flags : ${CFLAGS} ${AC_CFLAGS} ${SAN_FLAGS} make : ${MAKE-make} linker flags : ${LDFLAGS} ${SAN_FLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM} state file directory : ${frr_statedir} diff --git a/doc/user/ospfd.rst b/doc/user/ospfd.rst index 7d1e91dc41..ba9917f72f 100644 --- a/doc/user/ospfd.rst +++ b/doc/user/ospfd.rst @@ -299,15 +299,11 @@ To start OSPF process you have to specify the OSPF router. command can be used when the neighbor state get stuck at some state and this can be used to recover it from that state. -.. index:: maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM) -.. clicmd:: maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM) +.. clicmd:: maximum-paths (1-64) -.. index:: maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM) -.. clicmd:: no maximum-paths - - CLI to control maximum number of equal cost paths to reach a specific - destination.(ECMP) - Reset CLI, resets the maximum supported multi path to the default value. + Use this command to control the maximum number of equal cost paths to reach + a specific destination. The upper limit may differ if you change the value + of MULTIPATH_NUM during compilation. The default is MULTIPATH_NUM (64). .. _ospf-area: diff --git a/docker/alpine/Dockerfile b/docker/alpine/Dockerfile index 56ac1c0d00..cb2b3eb69e 100644 --- a/docker/alpine/Dockerfile +++ b/docker/alpine/Dockerfile @@ -56,4 +56,4 @@ RUN apk add \ --allow-untrusted /pkgs/apk/*/*.apk \ && rm -rf /pkgs COPY docker/alpine/docker-start /usr/lib/frr/docker-start -ENTRYPOINT [ "/sbin/tini", "--", "/usr/lib/frr/docker-start" ] +CMD [ "/sbin/tini", "--", "/usr/lib/frr/docker-start" ] diff --git a/docker/centos-7/Dockerfile b/docker/centos-7/Dockerfile index a92326fcf3..d2ec9f974b 100644 --- a/docker/centos-7/Dockerfile +++ b/docker/centos-7/Dockerfile @@ -40,4 +40,4 @@ COPY --from=centos-7-builder /rpmbuild/RPMS/ /pkgs/rpm/ RUN yum install -y /pkgs/rpm/*/*.rpm \ && rm -rf /pkgs COPY docker/centos-7/docker-start /usr/lib/frr/docker-start -ENTRYPOINT [ "/usr/lib/frr/docker-start" ] +CMD [ "/usr/lib/frr/docker-start" ] diff --git a/docker/centos-8/Dockerfile b/docker/centos-8/Dockerfile index 7ed7948927..104501aabc 100644 --- a/docker/centos-8/Dockerfile +++ b/docker/centos-8/Dockerfile @@ -41,4 +41,4 @@ COPY --from=centos-8-builder /rpmbuild/RPMS/ /pkgs/rpm/ RUN yum install -y /pkgs/rpm/*/*.rpm \ && rm -rf /pkgs COPY docker/centos-8/docker-start /usr/lib/frr/docker-start -ENTRYPOINT [ "/usr/lib/frr/docker-start" ] +CMD [ "/usr/lib/frr/docker-start" ] diff --git a/docker/debian/Dockerfile b/docker/debian/Dockerfile index 3f830348bc..cc9217f103 100644 --- a/docker/debian/Dockerfile +++ b/docker/debian/Dockerfile @@ -17,4 +17,4 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* ADD docker-start /usr/sbin/docker-start -ENTRYPOINT ["/usr/sbin/docker-start"] +CMD ["/usr/sbin/docker-start"] diff --git a/docker/debian/docker-start b/docker/debian/docker-start index 43854ab142..a0f31f5ac5 100755 --- a/docker/debian/docker-start +++ b/docker/debian/docker-start @@ -7,4 +7,6 @@ set -e ## chown -R frr:frr /etc/frr /etc/init.d/frr start -exec sleep 10000d + +# Sleep forever +exec tail -f /dev/null diff --git a/docker/ubuntu18-ci/Dockerfile b/docker/ubuntu18-ci/Dockerfile index ac745c60a8..f6fa910381 100644 --- a/docker/ubuntu18-ci/Dockerfile +++ b/docker/ubuntu18-ci/Dockerfile @@ -68,4 +68,4 @@ RUN cd ~/frr && \ RUN cd ~/frr && make check || true COPY docker/ubuntu18-ci/docker-start /usr/sbin/docker-start -ENTRYPOINT ["/usr/sbin/docker-start"] +CMD ["/usr/sbin/docker-start"] diff --git a/docker/ubuntu20-ci/Dockerfile b/docker/ubuntu20-ci/Dockerfile index 56657789ee..0b08c2f278 100644 --- a/docker/ubuntu20-ci/Dockerfile +++ b/docker/ubuntu20-ci/Dockerfile @@ -71,4 +71,4 @@ RUN cd ~/frr && \ RUN cd ~/frr && make check || true COPY docker/ubuntu20-ci/docker-start /usr/sbin/docker-start -ENTRYPOINT ["/usr/sbin/docker-start"] +CMD ["/usr/sbin/docker-start"] diff --git a/fpm/fpm_pb.h b/fpm/fpm_pb.h index 2e265511f2..659b5a64ac 100644 --- a/fpm/fpm_pb.h +++ b/fpm/fpm_pb.h @@ -29,7 +29,7 @@ #ifndef _FPM_PB_H #define _FPM_PB_H -#include "route_types.h" +#include "lib/route_types.h" #include "qpb/qpb.h" #include "fpm/fpm.pb-c.h" diff --git a/grpc/subdir.am b/grpc/subdir.am index 045848aee7..d9ec365ba8 100644 --- a/grpc/subdir.am +++ b/grpc/subdir.am @@ -23,12 +23,12 @@ EXTRA_DIST += grpc/frr-northbound.proto AM_V_PROTOC = $(am__v_PROTOC_$(V)) am__v_PROTOC_ = $(am__v_PROTOC_$(AM_DEFAULT_VERBOSITY)) -am__v_PROTOC_0 = @echo " PROTOC" $@; +am__v_PROTOC_0 = @echo " PROTOC " $@; am__v_PROTOC_1 = SUFFIXES += .pb.h .pb.cc .grpc.pb.cc .proto.pb.cc: - $(AM_V_PROTOC)$(PROTOC) -I$(top_srcdir) --cpp_out=$(top_srcdir) $(top_srcdir)/$^ + $(AM_V_PROTOC)$(PROTOC) -I$(top_srcdir) --cpp_out=$(top_builddir) $^ .proto.grpc.pb.cc: - $(AM_V_PROTOC)$(PROTOC) -I$(top_srcdir) --grpc_out=$(top_srcdir) --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` $(top_srcdir)/$^ + $(AM_V_PROTOC)$(PROTOC) -I$(top_srcdir) --grpc_out=$(top_builddir) --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` $^ diff --git a/isisd/isis_snmp.c b/isisd/isis_snmp.c index fe6a2f4052..1efe9f3bfb 100644 --- a/isisd/isis_snmp.c +++ b/isisd/isis_snmp.c @@ -36,7 +36,7 @@ #include "memory.h" #include "smux.h" #include "libfrr.h" -#include "version.h" +#include "lib/version.h" #include "isisd/isis_constants.h" #include "isisd/isis_common.h" diff --git a/isisd/subdir.am b/isisd/subdir.am index 11bae41657..4243bd60cf 100644 --- a/isisd/subdir.am +++ b/isisd/subdir.am @@ -138,7 +138,7 @@ nodist_isisd_isisd_SOURCES = \ # end isisd_isisd_snmp_la_SOURCES = isisd/isis_snmp.c -isisd_isisd_snmp_la_CFLAGS = $(WERROR) $(SNMP_CFLAGS) -std=gnu11 +isisd_isisd_snmp_la_CFLAGS = $(AM_CFLAGS) $(SNMP_CFLAGS) -std=gnu11 isisd_isisd_snmp_la_LDFLAGS = -avoid-version -module -shared -export-dynamic isisd_isisd_snmp_la_LIBADD = lib/libfrrsnmp.la diff --git a/ldpd/ldp_snmp.c b/ldpd/ldp_snmp.c index 9fb4e46515..3932df48e0 100644 --- a/ldpd/ldp_snmp.c +++ b/ldpd/ldp_snmp.c @@ -36,7 +36,7 @@ #include "memory.h" #include "smux.h" #include "libfrr.h" -#include "version.h" +#include "lib/version.h" #include "ldpd.h" #include "ldpe.h" diff --git a/ldpd/subdir.am b/ldpd/subdir.am index 5fc3847c6d..b7e2ab72d6 100644 --- a/ldpd/subdir.am +++ b/ldpd/subdir.am @@ -64,6 +64,6 @@ ldpd_ldpd_SOURCES = ldpd/ldpd.c ldpd_ldpd_LDADD = ldpd/libldp.a lib/libfrr.la $(LIBCAP) ldpd_ldpd_snmp_la_SOURCES = ldpd/ldp_snmp.c -ldpd_ldpd_snmp_la_CFLAGS = $(WERROR) $(SNMP_CFLAGS) -std=gnu11 +ldpd_ldpd_snmp_la_CFLAGS = $(AM_CFLAGS) $(SNMP_CFLAGS) -std=gnu11 ldpd_ldpd_snmp_la_LDFLAGS = -avoid-version -module -shared -export-dynamic ldpd_ldpd_snmp_la_LIBADD = lib/libfrrsnmp.la diff --git a/lib/agentx.c b/lib/agentx.c index b5a035ee2b..6d4e68d651 100644 --- a/lib/agentx.c +++ b/lib/agentx.c @@ -30,7 +30,7 @@ #include "smux.h" #include "memory.h" #include "linklist.h" -#include "version.h" +#include "lib/version.h" #include "lib_errors.h" #include "xref.h" diff --git a/lib/command_lex.l b/lib/command_lex.l index 0556605d63..9c096995f5 100644 --- a/lib/command_lex.l +++ b/lib/command_lex.l @@ -35,7 +35,7 @@ #pragma GCC diagnostic ignored "-Wsign-compare" #pragma GCC diagnostic ignored "-Wmissing-prototypes" -#include "command_parse.h" +#include "lib/command_parse.h" #define YY_USER_ACTION yylloc->last_column += yyleng; #define LOC_STEP do { if (yylloc) { \ diff --git a/lib/command_parse.y b/lib/command_parse.y index 5ebc19b278..f5e42cc304 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -75,7 +75,7 @@ %code provides { #ifndef FLEX_SCANNER - #include "command_lex.h" + #include "lib/command_lex.h" #endif extern void set_lexer_string (yyscan_t *scn, const char *string); diff --git a/lib/defaults.c b/lib/defaults.c index 7466aad5b1..fe099b6469 100644 --- a/lib/defaults.c +++ b/lib/defaults.c @@ -18,7 +18,7 @@ #include <zebra.h> #include "defaults.h" -#include "version.h" +#include "lib/version.h" static char df_version[128] = FRR_VER_SHORT, df_profile[128] = DFLT_NAME; static struct frr_default *dflt_first = NULL, **dflt_next = &dflt_first; diff --git a/lib/libfrr.c b/lib/libfrr.c index 5b0a523fb5..c8f2540db5 100644 --- a/lib/libfrr.c +++ b/lib/libfrr.c @@ -29,7 +29,7 @@ #include "privs.h" #include "vty.h" #include "command.h" -#include "version.h" +#include "lib/version.h" #include "lib_vty.h" #include "log_vty.h" #include "zclient.h" diff --git a/lib/module.c b/lib/module.c index d2491a3479..1d51a6396d 100644 --- a/lib/module.c +++ b/lib/module.c @@ -25,7 +25,7 @@ #include "module.h" #include "memory.h" -#include "version.h" +#include "lib/version.h" DEFINE_MTYPE_STATIC(LIB, MODULE_LOADNAME, "Module loading name"); DEFINE_MTYPE_STATIC(LIB, MODULE_LOADARGS, "Module loading arguments"); diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c index f88c2161da..81e30bce49 100644 --- a/lib/northbound_cli.c +++ b/lib/northbound_cli.c @@ -20,7 +20,7 @@ #include <zebra.h> #include "libfrr.h" -#include "version.h" +#include "lib/version.h" #include "defaults.h" #include "log.h" #include "lib_errors.h" diff --git a/lib/northbound_confd.c b/lib/northbound_confd.c index 3d8771ffbc..403537e043 100644 --- a/lib/northbound_confd.c +++ b/lib/northbound_confd.c @@ -24,7 +24,7 @@ #include "command.h" #include "debug.h" #include "libfrr.h" -#include "version.h" +#include "lib/version.h" #include "northbound.h" #include <confd_lib.h> diff --git a/lib/northbound_grpc.cpp b/lib/northbound_grpc.cpp index d042e15dad..58f4e42516 100644 --- a/lib/northbound_grpc.cpp +++ b/lib/northbound_grpc.cpp @@ -23,7 +23,7 @@ #include "log.h" #include "libfrr.h" -#include "version.h" +#include "lib/version.h" #include "command.h" #include "lib_errors.h" #include "northbound.h" diff --git a/lib/northbound_sysrepo.c b/lib/northbound_sysrepo.c index 9fc640ceea..fc1af092d0 100644 --- a/lib/northbound_sysrepo.c +++ b/lib/northbound_sysrepo.c @@ -25,7 +25,7 @@ #include "debug.h" #include "memory.h" #include "libfrr.h" -#include "version.h" +#include "lib/version.h" #include "northbound.h" #include <sysrepo.h> diff --git a/lib/pid_output.c b/lib/pid_output.c index bd1d89a94c..b82dde8258 100644 --- a/lib/pid_output.c +++ b/lib/pid_output.c @@ -22,7 +22,7 @@ #include <zebra.h> #include <fcntl.h> #include <log.h> -#include "version.h" +#include "lib/version.h" #include "network.h" #include "lib_errors.h" diff --git a/lib/sha256.c b/lib/sha256.c index 37ced5b402..a9b7a4aefc 100644 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -35,8 +35,6 @@ static inline uint32_t be32dec(const void *pp) return ((uint32_t)(p[3]) + ((uint32_t)(p[2]) << 8) + ((uint32_t)(p[1]) << 16) + ((uint32_t)(p[0]) << 24)); } -#else -#include <sys/endian.h> #endif #if !HAVE_DECL_BE32ENC @@ -49,8 +47,6 @@ static inline void be32enc(void *pp, uint32_t x) p[1] = (x >> 16) & 0xff; p[0] = (x >> 24) & 0xff; } -#else -#include <sys/endian.h> #endif /* diff --git a/lib/sigevent.c b/lib/sigevent.c index 64cec1385d..be7297f264 100644 --- a/lib/sigevent.c +++ b/lib/sigevent.c @@ -237,9 +237,12 @@ core_handler(int signo, siginfo_t *siginfo, void *context) /* make sure we don't hang in here. default for SIGALRM is terminate. * - if we're in backtrace for more than a second, abort. */ struct sigaction sa_default = {.sa_handler = SIG_DFL}; + sigaction(SIGALRM, &sa_default, NULL); + sigaction(signo, &sa_default, NULL); sigset_t sigset; + sigemptyset(&sigset); sigaddset(&sigset, SIGALRM); sigprocmask(SIG_UNBLOCK, &sigset, NULL); @@ -252,7 +255,16 @@ core_handler(int signo, siginfo_t *siginfo, void *context) log_memstats(stderr, "core_handler"); zlog_tls_buffer_fini(); - abort(); + + /* give the kernel a chance to generate a coredump */ + sigaddset(&sigset, signo); + sigprocmask(SIG_UNBLOCK, &sigset, NULL); + raise(signo); + + /* only chance to end up here is if the default action for signo is + * something other than kill or coredump the process + */ + _exit(128 + signo); } static void trap_default_signals(void) diff --git a/lib/sockopt.c b/lib/sockopt.c index ed21b72df7..b624fe2230 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -25,6 +25,16 @@ #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) +#define HAVE_BSD_STRUCT_IP_MREQ_HACK +#endif + void setsockopt_so_recvbuf(int sock, int size) { int orig_req = size; diff --git a/lib/subdir.am b/lib/subdir.am index b7efec4882..98ba1cf24c 100644 --- a/lib/subdir.am +++ b/lib/subdir.am @@ -318,7 +318,7 @@ if SNMP lib_LTLIBRARIES += lib/libfrrsnmp.la endif -lib_libfrrsnmp_la_CFLAGS = $(WERROR) $(SNMP_CFLAGS) -std=gnu11 +lib_libfrrsnmp_la_CFLAGS = $(AM_CFLAGS) $(SNMP_CFLAGS) -std=gnu11 lib_libfrrsnmp_la_LDFLAGS = -version-info 0:0:0 lib_libfrrsnmp_la_LIBADD = $(SNMP_LIBS) lib_libfrrsnmp_la_SOURCES = \ @@ -334,7 +334,7 @@ lib_LTLIBRARIES += lib/libfrrcares.la pkginclude_HEADERS += lib/resolver.h endif -lib_libfrrcares_la_CFLAGS = $(WERROR) $(CARES_CFLAGS) +lib_libfrrcares_la_CFLAGS = $(AM_CFLAGS) $(CARES_CFLAGS) lib_libfrrcares_la_LDFLAGS = -version-info 0:0:0 lib_libfrrcares_la_LIBADD = $(CARES_LIBS) lib_libfrrcares_la_SOURCES = \ @@ -349,7 +349,7 @@ lib_LTLIBRARIES += lib/libfrrzmq.la pkginclude_HEADERS += lib/frr_zmq.h endif -lib_libfrrzmq_la_CFLAGS = $(WERROR) $(ZEROMQ_CFLAGS) +lib_libfrrzmq_la_CFLAGS = $(AM_CFLAGS) $(ZEROMQ_CFLAGS) lib_libfrrzmq_la_LDFLAGS = -version-info 0:0:0 lib_libfrrzmq_la_LIBADD = $(ZEROMQ_LIBS) lib_libfrrzmq_la_SOURCES = \ @@ -363,7 +363,7 @@ if CONFD module_LTLIBRARIES += lib/confd.la endif -lib_confd_la_CFLAGS = $(WERROR) $(CONFD_CFLAGS) +lib_confd_la_CFLAGS = $(AM_CFLAGS) $(CONFD_CFLAGS) lib_confd_la_LDFLAGS = -avoid-version -module -shared -export-dynamic lib_confd_la_LIBADD = lib/libfrr.la $(CONFD_LIBS) lib_confd_la_SOURCES = lib/northbound_confd.c @@ -375,7 +375,7 @@ if SYSREPO module_LTLIBRARIES += lib/sysrepo.la endif -lib_sysrepo_la_CFLAGS = $(WERROR) $(SYSREPO_CFLAGS) +lib_sysrepo_la_CFLAGS = $(AM_CFLAGS) $(SYSREPO_CFLAGS) lib_sysrepo_la_LDFLAGS = -avoid-version -module -shared -export-dynamic lib_sysrepo_la_LIBADD = lib/libfrr.la $(SYSREPO_LIBS) lib_sysrepo_la_SOURCES = lib/northbound_sysrepo.c @@ -414,7 +414,7 @@ lib_grammar_sandbox_LDADD = \ lib/libfrr.la lib_clippy_CPPFLAGS = $(AM_CPPFLAGS) -D_GNU_SOURCE -DBUILDING_CLIPPY -lib_clippy_CFLAGS = $(PYTHON_CFLAGS) +lib_clippy_CFLAGS = $(AC_CFLAGS) $(PYTHON_CFLAGS) lib_clippy_LDADD = $(PYTHON_LIBS) $(UST_LIBS) -lelf lib_clippy_LDFLAGS = -export-dynamic lib_clippy_SOURCES = \ diff --git a/lib/version.h.in b/lib/version.h.in index d535d131c8..5078f3ad6e 100644 --- a/lib/version.h.in +++ b/lib/version.h.in @@ -25,7 +25,7 @@ #define _ZEBRA_VERSION_H #ifdef GIT_VERSION -#include "gitversion.h" +#include "lib/gitversion.h" #endif #ifdef __cplusplus diff --git a/lib/zebra.h b/lib/zebra.h index 5c3d91ba74..26c0fe05b5 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -68,6 +68,12 @@ #include <limits.h> #include <inttypes.h> #include <stdbool.h> +#ifdef HAVE_SYS_ENDIAN_H +#include <sys/endian.h> +#endif +#ifdef HAVE_ENDIAN_H +#include <endian.h> +#endif /* machine dependent includes */ #ifdef HAVE_LINUX_VERSION_H @@ -280,22 +286,10 @@ struct in_pktinfo { #define HAVE_IP_HDRINCL_BSD_ORDER #endif -/* Define BYTE_ORDER, if not defined. Useful for compiler conditional - * code, rather than preprocessor conditional. - * Not all the world has this BSD define. - */ +/* autoconf macros for this are deprecated, just find endian.h */ #ifndef BYTE_ORDER -#define BIG_ENDIAN 4321 /* least-significant byte first (vax, pc) */ -#define LITTLE_ENDIAN 1234 /* most-significant byte first (IBM, net) */ -#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */ - -#if defined(WORDS_BIGENDIAN) -#define BYTE_ORDER BIG_ENDIAN -#else /* !WORDS_BIGENDIAN */ -#define BYTE_ORDER LITTLE_ENDIAN -#endif /* WORDS_BIGENDIAN */ - -#endif /* ndef BYTE_ORDER */ +#error please locate an endian.h file appropriate to your platform +#endif /* For old definition. */ #ifndef IN6_ARE_ADDR_EQUAL @@ -312,7 +306,7 @@ struct in_pktinfo { #include "compiler.h" /* Zebra route's types are defined in route_types.h */ -#include "route_types.h" +#include "lib/route_types.h" #define strmatch(a,b) (!strcmp((a), (b))) diff --git a/lib/zlog.c b/lib/zlog.c index f546709328..24800c6e64 100644 --- a/lib/zlog.c +++ b/lib/zlog.c @@ -142,6 +142,7 @@ struct zlog_msg { struct zlog_tls { char *mmbuf; size_t bufpos; + bool do_unlink; size_t nmsgs; struct zlog_msg msgs[TLS_LOG_MAXMSG]; @@ -266,13 +267,14 @@ void zlog_tls_buffer_init(void) mmpath, strerror(errno)); goto out_anon_unlink; } + zlog_tls->do_unlink = true; close(mmfd); zlog_tls_set(zlog_tls); return; out_anon_unlink: - unlink(mmpath); + unlinkat(zlog_tmpdirfd, mmpath, 0); close(mmfd); out_anon: @@ -296,14 +298,16 @@ out_anon: void zlog_tls_buffer_fini(void) { char mmpath[MAXPATHLEN]; + struct zlog_tls *zlog_tls = zlog_tls_get(); + bool do_unlink = zlog_tls ? zlog_tls->do_unlink : false; zlog_tls_buffer_flush(); - zlog_tls_free(zlog_tls_get()); + zlog_tls_free(zlog_tls); zlog_tls_set(NULL); snprintfrr(mmpath, sizeof(mmpath), "logbuf.%ld", zlog_gettid()); - if (unlinkat(zlog_tmpdirfd, mmpath, 0)) + if (do_unlink && unlinkat(zlog_tmpdirfd, mmpath, 0)) zlog_err("unlink logbuf: %s (%d)", strerror(errno), errno); } diff --git a/m4/.gitignore b/m4/.gitignore index cc778b9e99..d444101103 100644 --- a/m4/.gitignore +++ b/m4/.gitignore @@ -8,3 +8,5 @@ !ax_sys_weak_alias.m4 !ax_sys_weak_alias.m4 !pkg.m4 + +/ac diff --git a/m4/ax_lua.m4 b/m4/ax_lua.m4 index 9feb352255..dde24eaf89 100644 --- a/m4/ax_lua.m4 +++ b/m4/ax_lua.m4 @@ -514,47 +514,24 @@ AC_DEFUN([AX_LUA_HEADERS], ]) AS_IF([test "x$ac_cv_header_lua_h" = 'xyes'], - [ dnl Make a program to print LUA_VERSION defined in the header. - dnl TODO It would be really nice if we could do this without compiling a - dnl program, then it would work when cross compiling. But I'm not sure how - dnl to do this reliably. For now, assume versions match when cross compiling. - - AS_IF([test "x$cross_compiling" != 'xyes'], - [ AC_CACHE_CHECK([for Lua header version], - [ax_cv_lua_header_version], - [ _ax_lua_saved_cppflags=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $LUA_INCLUDE" - AC_RUN_IFELSE( - [ AC_LANG_SOURCE([[ -#include <lua.h> -#include <stdlib.h> -#include <stdio.h> -int main(int argc, char ** argv) -{ - if(argc > 1) printf("%s", LUA_VERSION); - exit(EXIT_SUCCESS); -} -]]) - ], - [ ax_cv_lua_header_version=`./conftest$EXEEXT p | \ + [ AC_CACHE_CHECK([for Lua header version], + [ax_cv_lua_header_version], + [ + ax_cv_lua_header_version=`echo LUA_VERSION | \ + $CC -P -E $LUA_INCLUDE -imacros lua.h - | \ + $SED -e 's%"\s*"%%g' -e 's%^\s*%%' | \ + tr -d '"\n' | \ $SED -n "s|^Lua \(@<:@0-9@:>@\{1,\}\.@<:@0-9@:>@\{1,\}\).\{0,\}|\1|p"` - ], - [ax_cv_lua_header_version='unknown']) - CPPFLAGS=$_ax_lua_saved_cppflags - ]) - - dnl Compare this to the previously found LUA_VERSION. - AC_MSG_CHECKING([if Lua header version matches $LUA_VERSION]) - AS_IF([test "x$ax_cv_lua_header_version" = "x$LUA_VERSION"], - [ AC_MSG_RESULT([yes]) - ax_header_version_match='yes' - ], - [ AC_MSG_RESULT([no]) - ax_header_version_match='no' - ]) - ], - [ AC_MSG_WARN([cross compiling so assuming header version number matches]) + ]) + + dnl Compare this to the previously found LUA_VERSION. + AC_MSG_CHECKING([if Lua header version matches $LUA_VERSION]) + AS_IF([test "x$ax_cv_lua_header_version" = "x$LUA_VERSION"], + [ AC_MSG_RESULT([yes]) ax_header_version_match='yes' + ], + [ AC_MSG_RESULT([no]) + ax_header_version_match='no' ]) ]) diff --git a/nhrpd/nhrp_main.c b/nhrpd/nhrp_main.c index 5c819017f4..e9bce3e09a 100644 --- a/nhrpd/nhrp_main.c +++ b/nhrpd/nhrp_main.c @@ -18,7 +18,7 @@ #include "getopt.h" #include "thread.h" #include "sigevent.h" -#include "version.h" +#include "lib/version.h" #include "log.h" #include "memory.h" #include "command.h" diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c index b9d413c3df..dcf76c7038 100644 --- a/ospf6d/ospf6_snmp.c +++ b/ospf6d/ospf6_snmp.c @@ -30,7 +30,7 @@ #include "vrf.h" #include "smux.h" #include "libfrr.h" -#include "version.h" +#include "lib/version.h" #include "ospf6_proto.h" #include "ospf6_lsa.h" diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 52e40dc1ad..d05c164225 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -890,7 +890,6 @@ static void ospf6_restart_spf(struct ospf6 *ospf6) { ospf6_route_remove_all(ospf6->route_table); ospf6_route_remove_all(ospf6->brouter_table); - ospf6_route_remove_all(ospf6->external_table); /* Trigger SPF */ ospf6_spf_schedule(ospf6, OSPF6_SPF_FLAGS_CONFIG_CHANGE); diff --git a/ospf6d/subdir.am b/ospf6d/subdir.am index 5ccae5b279..00388afd38 100644 --- a/ospf6d/subdir.am +++ b/ospf6d/subdir.am @@ -80,7 +80,7 @@ ospf6d_ospf6d_SOURCES = \ # end ospf6d_ospf6d_snmp_la_SOURCES = ospf6d/ospf6_snmp.c -ospf6d_ospf6d_snmp_la_CFLAGS = $(WERROR) $(SNMP_CFLAGS) -std=gnu11 +ospf6d_ospf6d_snmp_la_CFLAGS = $(AM_CFLAGS) $(SNMP_CFLAGS) -std=gnu11 ospf6d_ospf6d_snmp_la_LDFLAGS = -avoid-version -module -shared -export-dynamic ospf6d_ospf6d_snmp_la_LIBADD = lib/libfrrsnmp.la diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c index b5c97eda3c..a6027ee9d1 100644 --- a/ospfd/ospf_abr.c +++ b/ospfd/ospf_abr.c @@ -1818,7 +1818,6 @@ static int ospf_abr_task_timer(struct thread *thread) ospf_abr_task(ospf); ospf_abr_nssa_task(ospf); /* if nssa-abr, then scan Type-7 LSDB */ - ospf_asbr_nssa_redist_task(ospf); return 0; } diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c index 0b4e5d7762..6d80725ae6 100644 --- a/ospfd/ospf_asbr.c +++ b/ospfd/ospf_asbr.c @@ -277,10 +277,16 @@ void ospf_asbr_status_update(struct ospf *ospf, uint8_t status) /* If there's redistribution configured, we need to refresh external * LSAs in order to install Type-7 and flood to all NSSA Areas */ -void ospf_asbr_nssa_redist_task(struct ospf *ospf) +static int ospf_asbr_nssa_redist_update_timer(struct thread *thread) { + struct ospf *ospf = THREAD_ARG(thread); int type; + ospf->t_asbr_nssa_redist_update = NULL; + + if (IS_DEBUG_OSPF_EVENT) + zlog_debug("Running ASBR NSSA redistribution update on timer"); + for (type = 0; type < ZEBRA_ROUTE_MAX; type++) { struct list *red_list; struct listnode *node; @@ -293,10 +299,22 @@ void ospf_asbr_nssa_redist_task(struct ospf *ospf) for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) ospf_external_lsa_refresh_type(ospf, type, red->instance, - LSA_REFRESH_IF_CHANGED); + LSA_REFRESH_FORCE); } ospf_external_lsa_refresh_default(ospf); + + return 0; +} + +void ospf_schedule_asbr_nssa_redist_update(struct ospf *ospf) +{ + if (IS_DEBUG_OSPF_EVENT) + zlog_debug("Scheduling ASBR NSSA redistribution update"); + + thread_add_timer(master, ospf_asbr_nssa_redist_update_timer, ospf, + OSPF_ASBR_NSSA_REDIST_UPDATE_DELAY, + &ospf->t_asbr_nssa_redist_update); } void ospf_redistribute_withdraw(struct ospf *ospf, uint8_t type, diff --git a/ospfd/ospf_asbr.h b/ospfd/ospf_asbr.h index 7759d45455..d3e50903ef 100644 --- a/ospfd/ospf_asbr.h +++ b/ospfd/ospf_asbr.h @@ -104,6 +104,7 @@ struct ospf_external_aggr_rt { }; #define OSPF_ASBR_CHECK_DELAY 30 +#define OSPF_ASBR_NSSA_REDIST_UPDATE_DELAY 9 extern void ospf_external_route_remove(struct ospf *, struct prefix_ipv4 *); extern struct external_info *ospf_external_info_new(uint8_t, unsigned short); @@ -121,7 +122,7 @@ extern struct external_info *ospf_external_info_lookup(struct ospf *, uint8_t, unsigned short, struct prefix_ipv4 *); extern void ospf_asbr_status_update(struct ospf *, uint8_t); -extern void ospf_asbr_nssa_redist_task(struct ospf *ospf); +extern void ospf_schedule_asbr_nssa_redist_update(struct ospf *ospf); extern void ospf_redistribute_withdraw(struct ospf *, uint8_t, unsigned short); extern void ospf_asbr_check(void); diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index 2442f2e781..8f31f90346 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -169,8 +169,7 @@ const char *ospf_timeval_dump(struct timeval *t, char *buf, size_t size) /* Making formatted timer strings. */ #define MINUTE_IN_SECONDS 60 #define HOUR_IN_SECONDS (60*MINUTE_IN_SECONDS) -#define DAY_IN_SECONDS (24*HOUR_IN_SECONDS) -#define WEEK_IN_SECONDS (7*DAY_IN_SECONDS) + unsigned long w, d, h, m, ms, us; if (!t) @@ -191,14 +190,14 @@ const char *ospf_timeval_dump(struct timeval *t, char *buf, size_t size) ms %= 1000; } - if (t->tv_sec > WEEK_IN_SECONDS) { - w = t->tv_sec / WEEK_IN_SECONDS; - t->tv_sec -= w * WEEK_IN_SECONDS; + if (t->tv_sec > ONE_WEEK_SECOND) { + w = t->tv_sec / ONE_WEEK_SECOND; + t->tv_sec -= w * ONE_WEEK_SECOND; } - if (t->tv_sec > DAY_IN_SECONDS) { - d = t->tv_sec / DAY_IN_SECONDS; - t->tv_sec -= d * DAY_IN_SECONDS; + if (t->tv_sec > ONE_DAY_SECOND) { + d = t->tv_sec / ONE_DAY_SECOND; + t->tv_sec -= d * ONE_DAY_SECOND; } if (t->tv_sec >= HOUR_IN_SECONDS) { @@ -221,7 +220,7 @@ const char *ospf_timeval_dump(struct timeval *t, char *buf, size_t size) snprintf(buf, size, "%luh%02lum%02lds", h, m, (long)t->tv_sec); else if (m) snprintf(buf, size, "%lum%02lds", m, (long)t->tv_sec); - else if (ms) + else if (t->tv_sec > 0 || ms > 0) snprintf(buf, size, "%ld.%03lus", (long)t->tv_sec, ms); else snprintf(buf, size, "%ld usecs", (long)t->tv_usec); diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c index 43b998ac5b..432f95f9dd 100644 --- a/ospfd/ospf_snmp.c +++ b/ospfd/ospf_snmp.c @@ -34,7 +34,7 @@ #include "memory.h" #include "smux.h" #include "libfrr.h" -#include "version.h" +#include "lib/version.h" #include "ospfd/ospfd.h" #include "ospfd/ospf_interface.h" diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index be446705ea..69a3e45878 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -1546,6 +1546,7 @@ static int ospf_area_nssa_cmd_handler(struct vty *vty, int argc, /* Flush the external LSA for the specified area */ ospf_flush_lsa_from_area(ospf, area_id, OSPF_AS_EXTERNAL_LSA); ospf_schedule_abr_task(ospf); + ospf_schedule_asbr_nssa_redist_update(ospf); return CMD_SUCCESS; } diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index 9949a78336..faec868b2a 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -791,6 +791,7 @@ static void ospf_finish_final(struct ospf *ospf) OSPF_TIMER_OFF(ospf->t_maxage_walker); OSPF_TIMER_OFF(ospf->t_abr_task); OSPF_TIMER_OFF(ospf->t_asbr_check); + OSPF_TIMER_OFF(ospf->t_asbr_nssa_redist_update); OSPF_TIMER_OFF(ospf->t_distribute_update); OSPF_TIMER_OFF(ospf->t_lsa_refresher); OSPF_TIMER_OFF(ospf->t_opaque_lsa_self); diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h index 2093eb2e42..318400e968 100644 --- a/ospfd/ospfd.h +++ b/ospfd/ospfd.h @@ -242,6 +242,8 @@ struct ospf { /* Threads. */ struct thread *t_abr_task; /* ABR task timer. */ struct thread *t_asbr_check; /* ASBR check timer. */ + struct thread *t_asbr_nssa_redist_update; /* ASBR NSSA redistribution + update timer. */ struct thread *t_distribute_update; /* Distirbute list update timer. */ struct thread *t_spf_calc; /* SPF calculation timer. */ struct thread *t_ase_calc; /* ASE calculation timer. */ diff --git a/ospfd/subdir.am b/ospfd/subdir.am index f592a9eec8..574e0e3bdf 100644 --- a/ospfd/subdir.am +++ b/ospfd/subdir.am @@ -115,7 +115,7 @@ ospfd_ospfd_LDADD = ospfd/libfrrospf.a lib/libfrr.la $(LIBCAP) $(LIBM) ospfd_ospfd_SOURCES = ospfd/ospf_main.c ospfd_ospfd_snmp_la_SOURCES = ospfd/ospf_snmp.c -ospfd_ospfd_snmp_la_CFLAGS = $(WERROR) $(SNMP_CFLAGS) -std=gnu11 +ospfd_ospfd_snmp_la_CFLAGS = $(AM_CFLAGS) $(SNMP_CFLAGS) -std=gnu11 ospfd_ospfd_snmp_la_LDFLAGS = -avoid-version -module -shared -export-dynamic ospfd_ospfd_snmp_la_LIBADD = lib/libfrrsnmp.la diff --git a/pathd/path_pcep.c b/pathd/path_pcep.c index d6cd48ecdb..1c650737b2 100644 --- a/pathd/path_pcep.c +++ b/pathd/path_pcep.c @@ -24,7 +24,7 @@ #include "command.h" #include "libfrr.h" #include "printfrr.h" -#include "version.h" +#include "lib/version.h" #include "northbound.h" #include "frr_pthread.h" #include "jhash.h" diff --git a/pathd/path_pcep_cli.c b/pathd/path_pcep_cli.c index 14404b1d08..2e4e331ad9 100644 --- a/pathd/path_pcep_cli.c +++ b/pathd/path_pcep_cli.c @@ -25,7 +25,7 @@ #include "command.h" #include "libfrr.h" #include "printfrr.h" -#include "version.h" +#include "lib/version.h" #include "northbound.h" #include "frr_pthread.h" #include "jhash.h" diff --git a/pathd/path_pcep_controller.c b/pathd/path_pcep_controller.c index db7d2b55a5..528dcc3539 100644 --- a/pathd/path_pcep_controller.c +++ b/pathd/path_pcep_controller.c @@ -22,7 +22,7 @@ #include "command.h" #include "libfrr.h" #include "printfrr.h" -#include "version.h" +#include "lib/version.h" #include "northbound.h" #include "frr_pthread.h" #include "jhash.h" diff --git a/pathd/path_pcep_pcc.c b/pathd/path_pcep_pcc.c index a2c1e7cd4c..9af2148819 100644 --- a/pathd/path_pcep_pcc.c +++ b/pathd/path_pcep_pcc.c @@ -33,7 +33,7 @@ #include "command.h" #include "libfrr.h" #include "printfrr.h" -#include "version.h" +#include "lib/version.h" #include "northbound.h" #include "frr_pthread.h" #include "jhash.h" diff --git a/pathd/subdir.am b/pathd/subdir.am index 4eabdd2ac5..0666e8d3c8 100644 --- a/pathd/subdir.am +++ b/pathd/subdir.am @@ -75,5 +75,5 @@ pathd_pathd_pcep_la_LIBADD = endif -pathd_pathd_pcep_la_CFLAGS = $(WERROR) +#pathd_pathd_pcep_la_CFLAGS = $(AM_CFLAGS) pathd_pathd_pcep_la_LDFLAGS = -avoid-version -module -shared -export-dynamic diff --git a/pceplib/subdir.am b/pceplib/subdir.am index eee2ec28c7..2633f678fd 100644 --- a/pceplib/subdir.am +++ b/pceplib/subdir.am @@ -1,7 +1,7 @@ if PATHD_PCEP noinst_LTLIBRARIES = pceplib/libpcep_pcc.la pceplib/libsocket_comm_mock.la -pceplib_libpcep_pcc_la_CFLAGS = -fPIC +pceplib_libpcep_pcc_la_CFLAGS = $(AM_CFLAGS) -fPIC pceplib_libpcep_pcc_la_SOURCES = pceplib/pcep_msg_messages.c \ pceplib/pcep_msg_objects.c \ pceplib/pcep_msg_tlvs.c \ diff --git a/pceplib/test/subdir.am b/pceplib/test/subdir.am index 0ae61d1bce..88af592679 100644 --- a/pceplib/test/subdir.am +++ b/pceplib/test/subdir.am @@ -36,7 +36,7 @@ noinst_HEADERS += pceplib/test/pcep_msg_messages_test.h \ pceplib/test/pcep_utils_ordered_list_test.h \ pceplib/test/pcep_utils_queue_test.h -pceplib_test_pcep_msg_tests_CFLAGS = -I$(top_srcdir)/pceplib +pceplib_test_pcep_msg_tests_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/pceplib pceplib_test_pcep_msg_tests_LDADD = $(top_builddir)/pceplib/libpcep_pcc.la lib/libfrr.la -lcunit -lpthread pceplib_test_pcep_msg_tests_SOURCES = pceplib/test/pcep_msg_messages_test.c \ pceplib/test/pcep_msg_messages_tests.c \ @@ -47,7 +47,7 @@ pceplib_test_pcep_msg_tests_SOURCES = pceplib/test/pcep_msg_messages_test.c \ # The pcc_api_tests and pcep_session_logic_tests use the # socket_comm_mock, so the LDADD variable needs to be modified -pceplib_test_pcep_pcc_api_tests_CFLAGS = -I$(top_srcdir)/pceplib +pceplib_test_pcep_pcc_api_tests_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/pceplib pceplib_test_pcep_pcc_api_tests_LDADD = $(top_builddir)/pceplib/libsocket_comm_mock.la $(top_builddir)/pceplib/libpcep_pcc.la lib/libfrr.la -lcunit -lpthread pceplib_test_pcep_pcc_api_tests_SOURCES = pceplib/test/pcep_pcc_api_test.c pceplib/test/pcep_pcc_api_tests.c diff --git a/pimd/pim_main.c b/pimd/pim_main.c index 70c233848a..96132c4425 100644 --- a/pimd/pim_main.c +++ b/pimd/pim_main.c @@ -21,7 +21,7 @@ #include "log.h" #include "privs.h" -#include "version.h" +#include "lib/version.h" #include <getopt.h> #include "command.h" #include "thread.h" @@ -32,7 +32,7 @@ #include "filter.h" #include "vty.h" #include "sigevent.h" -#include "version.h" +#include "lib/version.h" #include "prefix.h" #include "plist.h" #include "vrf.h" diff --git a/pimd/pim_nb_config.c b/pimd/pim_nb_config.c index 475e393cf0..f64adc6254 100644 --- a/pimd/pim_nb_config.c +++ b/pimd/pim_nb_config.c @@ -755,18 +755,14 @@ int pim_join_prune_interval_modify(struct nb_cb_modify_args *args) */ int pim_register_suppress_time_modify(struct nb_cb_modify_args *args) { - struct vrf *vrf; - struct pim_instance *pim; - switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: break; case NB_EV_APPLY: - vrf = nb_running_get_entry(args->dnode, NULL, true); - pim = vrf->info; - pim->keep_alive_time = yang_dnode_get_uint16(args->dnode, NULL); + router->register_suppress_time = + yang_dnode_get_uint16(args->dnode, NULL); break; } diff --git a/qpb/subdir.am b/qpb/subdir.am index 80f8f3aca9..4f826355d9 100644 --- a/qpb/subdir.am +++ b/qpb/subdir.am @@ -35,7 +35,7 @@ if HAVE_PROTOBUF # Rules .proto.pb.h: - $(PROTOC) -I$(top_srcdir) --cpp_out=$(top_srcdir) $(top_srcdir)/$^ + $(PROTOC) -I$(top_srcdir) --cpp_out=$(top_builddir) $^ AM_V_PROTOC_C = $(am__v_PROTOC_C_$(V)) am__v_PROTOC_C_ = $(am__v_PROTOC_C_$(AM_DEFAULT_VERBOSITY)) @@ -43,7 +43,7 @@ am__v_PROTOC_C_0 = @echo " PROTOC_C" $@; am__v_PROTOC_C_1 = .proto.pb-c.c: - $(AM_V_PROTOC_C)$(PROTOC_C) -I$(top_srcdir) --c_out=$(top_srcdir) $(top_srcdir)/$^ + $(AM_V_PROTOC_C)$(PROTOC_C) -I$(top_srcdir) --c_out=$(top_builddir) $^ .pb-c.c.pb-c.h: @/bin/true diff --git a/ripd/rip_snmp.c b/ripd/rip_snmp.c index b922d66912..d49d360b7e 100644 --- a/ripd/rip_snmp.c +++ b/ripd/rip_snmp.c @@ -31,7 +31,7 @@ #include "table.h" #include "smux.h" #include "libfrr.h" -#include "version.h" +#include "lib/version.h" #include "ripd/ripd.h" diff --git a/ripd/subdir.am b/ripd/subdir.am index 99979bff0d..8de0fc4b5a 100644 --- a/ripd/subdir.am +++ b/ripd/subdir.am @@ -56,6 +56,6 @@ nodist_ripd_ripd_SOURCES = \ # end ripd_ripd_snmp_la_SOURCES = ripd/rip_snmp.c -ripd_ripd_snmp_la_CFLAGS = $(WERROR) $(SNMP_CFLAGS) -std=gnu11 +ripd_ripd_snmp_la_CFLAGS = $(AM_CFLAGS) $(SNMP_CFLAGS) -std=gnu11 ripd_ripd_snmp_la_LDFLAGS = -avoid-version -module -shared -export-dynamic ripd_ripd_snmp_la_LIBADD = lib/libfrrsnmp.la diff --git a/tests/subdir.am b/tests/subdir.am index 370e6a49a9..ec0a154a2d 100644 --- a/tests/subdir.am +++ b/tests/subdir.am @@ -148,6 +148,7 @@ TESTS_CPPFLAGS = $(AM_CPPFLAGS) \ -I$(top_builddir)/tests/helpers/c \ # end TESTS_CFLAGS = \ + $(AC_CFLAGS) \ $(LIBYANG_CFLAGS) \ $(SAN_FLAGS) \ # end diff --git a/tools/frr-reload.py b/tools/frr-reload.py index f4b832691e..a617c0a9c5 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -188,17 +188,17 @@ class Vtysh(object): class Context(object): """ - A Context object represents a section of frr configuration such as: -! -interface swp3 - description swp3 -> r8's swp1 - ipv6 nd suppress-ra - link-detect -! + A Context object represents a section of frr configuration such as: + ! + interface swp3 + description swp3 -> r8's swp1 + ipv6 nd suppress-ra + link-detect + ! -or a single line context object such as this: + or a single line context object such as this: -ip forwarding + ip forwarding """ @@ -1091,7 +1091,7 @@ def check_for_exit_vrf(lines_to_add, lines_to_del): add_exit_vrf = False if ctx_keys[0].startswith("vrf") and line: - if line is not "exit-vrf": + if line != "exit-vrf": add_exit_vrf = True prior_ctx_key = ctx_keys[0] else: @@ -1119,12 +1119,15 @@ def ignore_delete_re_add_lines(lines_to_add, lines_to_del): # in-place, to avoid requesting spurious label chunks which might fail if line and "segment-routing global-block" in line: for (add_key, add_line) in lines_to_add: - if ctx_keys[0] == add_key[0] and add_line and "segment-routing global-block" in add_line: + if ( + ctx_keys[0] == add_key[0] + and add_line + and "segment-routing global-block" in add_line + ): lines_to_del_to_del.append((ctx_keys, line)) break continue - if ctx_keys[0].startswith("router bgp") and line: if line.startswith("neighbor "): diff --git a/version.h b/version.h new file mode 100644 index 0000000000..28e0238dfd --- /dev/null +++ b/version.h @@ -0,0 +1,3 @@ +#include "lib/compiler.h" +CPP_NOTICE("Trying to include version.h. Please fix to use lib/version.h.") +#include "lib/version.h" diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c index 600fc3f2fc..66a6bd0545 100644 --- a/zebra/irdp_main.c +++ b/zebra/irdp_main.c @@ -51,7 +51,7 @@ #include "privs.h" #include "libfrr.h" #include "lib_errors.h" -#include "version.h" +#include "lib/version.h" #include "zebra/interface.h" #include "zebra/rtadv.h" #include "zebra/rib.h" diff --git a/zebra/redistribute.c b/zebra/redistribute.c index 9e675011ee..104f952b3b 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -347,17 +347,12 @@ void zebra_redistribute_add(ZAPI_HANDLER_ARGS) zvrf_id(zvrf), afi); } } else { - if (!vrf_bitmap_check(client->redist[afi][type], - zvrf_id(zvrf))) { - if (IS_ZEBRA_DEBUG_EVENT) - zlog_debug( - "%s: setting vrf %s(%u) redist bitmap", - __func__, VRF_LOGNAME(zvrf->vrf), - zvrf_id(zvrf)); - vrf_bitmap_set(client->redist[afi][type], - zvrf_id(zvrf)); - zebra_redistribute(client, type, 0, zvrf_id(zvrf), afi); - } + if (IS_ZEBRA_DEBUG_EVENT) + zlog_debug("%s: setting vrf %s(%u) redist bitmap", + __func__, VRF_LOGNAME(zvrf->vrf), + zvrf_id(zvrf)); + vrf_bitmap_set(client->redist[afi][type], zvrf_id(zvrf)); + zebra_redistribute(client, type, 0, zvrf_id(zvrf), afi); } stream_failure: diff --git a/zebra/subdir.am b/zebra/subdir.am index f0d1c5844f..6fc8ef0df5 100644 --- a/zebra/subdir.am +++ b/zebra/subdir.am @@ -193,7 +193,7 @@ zebra_zebra_irdp_la_SOURCES = \ zebra_zebra_irdp_la_LDFLAGS = -avoid-version -module -shared -export-dynamic zebra_zebra_snmp_la_SOURCES = zebra/zebra_snmp.c -zebra_zebra_snmp_la_CFLAGS = $(WERROR) $(SNMP_CFLAGS) -std=gnu11 +zebra_zebra_snmp_la_CFLAGS = $(AM_CFLAGS) $(SNMP_CFLAGS) -std=gnu11 zebra_zebra_snmp_la_LDFLAGS = -avoid-version -module -shared -export-dynamic zebra_zebra_snmp_la_LIBADD = lib/libfrrsnmp.la diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c index 5fe8934a82..07a8288605 100644 --- a/zebra/zebra_fpm.c +++ b/zebra/zebra_fpm.c @@ -29,7 +29,7 @@ #include "thread.h" #include "network.h" #include "command.h" -#include "version.h" +#include "lib/version.h" #include "jhash.h" #include "zebra/rib.h" diff --git a/zebra/zebra_mlag_private.c b/zebra/zebra_mlag_private.c index aaf93b4dc1..b1bba831d2 100644 --- a/zebra/zebra_mlag_private.c +++ b/zebra/zebra_mlag_private.c @@ -28,7 +28,7 @@ #include "thread.h" #include "frr_pthread.h" #include "libfrr.h" -#include "version.h" +#include "lib/version.h" #include "network.h" #include "lib/stream.h" diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index bea855d1af..37d9399054 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -31,7 +31,7 @@ #include "ptm_lib.h" #include "rib.h" #include "stream.h" -#include "version.h" +#include "lib/version.h" #include "vrf.h" #include "vty.h" #include "lib_errors.h" diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index 6a42c682ad..d07a49fb6e 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -30,7 +30,7 @@ #include "plist.h" #include "nexthop.h" #include "northbound_cli.h" -#include "route_types.h" +#include "lib/route_types.h" #include "vrf.h" #include "frrstr.h" diff --git a/zebra/zebra_snmp.c b/zebra/zebra_snmp.c index 3e08d83724..6fe24dfa54 100644 --- a/zebra/zebra_snmp.c +++ b/zebra/zebra_snmp.c @@ -36,7 +36,7 @@ #include "vrf.h" #include "hook.h" #include "libfrr.h" -#include "version.h" +#include "lib/version.h" #include "zebra/rib.h" #include "zebra/zserv.h" |
