From 4007e3adf1208f2943c72ab11044b57a01b3813b Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Sun, 2 Sep 2018 14:52:43 +0200 Subject: [PATCH 01/12] build: use -export-dynamic Signed-off-by: David Lamparter --- Makefile.am | 2 ++ configure.ac | 14 -------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/Makefile.am b/Makefile.am index aae89a90d7..b4d38e69af 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,6 +10,8 @@ AM_CPPFLAGS = \ @ASAN_FLAGS@ @TSAN_FLAGS@ @MSAN_FLAGS@ \ -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_srcdir)/lib \ -I$(top_builddir) -I$(top_builddir)/include -I$(top_builddir)/lib +AM_LDFLAGS = \ + -export-dynamic DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" -DCONFDATE=$(CONFDATE) LIBCAP = @LIBCAP@ diff --git a/configure.ac b/configure.ac index 521d27a682..2e8b953c0c 100755 --- a/configure.ac +++ b/configure.ac @@ -287,20 +287,6 @@ if test x"${enable_werror}" = x"yes" ; then fi AC_SUBST(WERROR) -dnl need link on this one, not compile -AC_LANG_PUSH(C) -ac_ld_flag_save="$LDFLAGS" -LDFLAGS="$LDFLAGS -rdynamic" -AC_MSG_CHECKING([[whether linker supports -rdynamic]]) -AC_LINK_IFELSE( - [AC_LANG_PROGRAM([[]])], - [AC_MSG_RESULT([yes])], - [ - LDFLAGS="$ac_ld_flag_save" - AC_MSG_RESULT([no]) - ]) -AC_LANG_POP(C) - dnl ---------- dnl Essentials dnl ---------- From 2b2f275ee2ea2c204f27b94d5db62d2a7da87189 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Sun, 2 Sep 2018 15:15:17 +0200 Subject: [PATCH 02/12] build: clean up protobuf build integration We were linking all libs and binaries against libprotobuf-c if the option was enabled... that makes no sense at all. Signed-off-by: David Lamparter --- configure.ac | 49 ++++++++++++++++++------------------------------- fpm/subdir.am | 10 ++++++---- qpb/subdir.am | 39 ++++++++++++--------------------------- zebra/subdir.am | 3 ++- 4 files changed, 38 insertions(+), 63 deletions(-) diff --git a/configure.ac b/configure.ac index 2e8b953c0c..3657152644 100755 --- a/configure.ac +++ b/configure.ac @@ -616,27 +616,26 @@ AC_SUBST(PYTHON_LIBS) # Logic for protobuf support. # if test "$enable_protobuf" = "yes"; then - have_protobuf=yes + # Check for protoc & protoc-c - # Check for protoc-c - AC_CHECK_PROG([PROTOC_C], [protoc-c], [protoc-c], [/bin/false]) - if test "x$PROTOC_C" = "x/bin/false"; then - have_protobuf=no - else - found_protobuf_c=no - PKG_CHECK_MODULES([PROTOBUF_C], libprotobuf-c >= 0.14, - [found_protobuf_c=yes], - [AC_MSG_RESULT([pkg-config did not find libprotobuf-c])]) + # protoc is not required, it's only for a "be nice" helper target + AC_CHECK_PROGS([PROTOC], [protoc], [/bin/false]) - if test "x$found_protobuf_c" = "xyes"; then - LDFLAGS="$LDFLAGS $PROTOBUF_C_LIBS" - CFLAGS="$CFLAGS $PROTOBUF_C_CFLAGS" - else - AC_CHECK_HEADER([google/protobuf-c/protobuf-c.h], [], - [have_protobuf=no; AC_MSG_RESULT([Couldn't find google/protobuf-c.h])]) - fi - fi + AC_CHECK_PROGS([PROTOC_C], [protoc-c], [/bin/false]) + if test "$PROTOC_C" = "/bin/false"; then + AC_MSG_FAILURE([protobuf requested but protoc-c not found. Install protobuf-c.]) + fi + + PKG_CHECK_MODULES([PROTOBUF_C], [libprotobuf-c >= 0.14],, [ + AC_MSG_FAILURE([protobuf requested but libprotobuf-c not found. Install protobuf-c.]) + ]) + AC_CHECK_HEADER([google/protobuf-c/protobuf-c.h], [], [ + AC_MSG_FAILURE([protobuf requested but protobuf-c.h not found. Install protobuf-c.]) + ]) + + AC_DEFINE(HAVE_PROTOBUF,, protobuf) fi +AM_CONDITIONAL([HAVE_PROTOBUF], [test "x$enable_protobuf" = "xyes"]) # # Logic for old vpn commans support. @@ -645,18 +644,6 @@ if test "$enable_oldvpn_commands" = "yes"; then AC_DEFINE(KEEP_OLD_VPN_COMMANDS,, [Define for compiling with old vpn commands]) fi -# Fail if the user explicity enabled protobuf support and we couldn't -# find the compiler or libraries. -if test "x$have_protobuf" = "xno" && test "x$enable_protobuf" = "xyes"; then - AC_MSG_ERROR([Protobuf enabled explicitly but can't find libraries/tools]) -fi - -if test "x$have_protobuf" = "xyes"; then - AC_DEFINE(HAVE_PROTOBUF,, protobuf) -fi - -AM_CONDITIONAL([HAVE_PROTOBUF], [test "x$have_protobuf" = "xyes"]) - # # End of logic for protobuf support. # @@ -2057,7 +2044,7 @@ group to run as : ${enable_group} group for vty sockets : ${enable_vty_group} config file mask : ${enable_configfile_mask} log file mask : ${enable_logfile_mask} -zebra protobuf enabled : ${have_protobuf:-no} +zebra protobuf enabled : ${enable_protobuf:-no} The above user and group must have read/write access to the state file directory and to the config files in the config file directory." diff --git a/fpm/subdir.am b/fpm/subdir.am index 795535596b..05cec5a528 100644 --- a/fpm/subdir.am +++ b/fpm/subdir.am @@ -3,8 +3,7 @@ lib_LTLIBRARIES += fpm/libfrrfpm_pb.la endif fpm_libfrrfpm_pb_la_LDFLAGS = -version-info 0:0:0 -fpm_libfrrfpm_pb_la_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir) -I$(top_builddir)/lib \ - $(Q_PROTOBUF_C_CLIENT_INCLUDES) +fpm_libfrrfpm_pb_la_CPPFLAGS = $(AM_CPPFLAGS) $(PROTOBUF_C_CFLAGS) fpm_libfrrfpm_pb_la_SOURCES = \ fpm/fpm.h \ fpm/fpm_pb.h \ @@ -12,11 +11,14 @@ fpm_libfrrfpm_pb_la_SOURCES = \ # end if HAVE_PROTOBUF -nodist_fpm_libfrrfpm_pb_la_SOURCES = fpm/fpm.pb-c.c +nodist_fpm_libfrrfpm_pb_la_SOURCES = \ + fpm/fpm.pb-c.c \ + # end +endif + CLEANFILES += \ fpm/fpm.pb-c.c \ fpm/fpm.pb-c.h \ # end -endif EXTRA_DIST += fpm/fpm.proto diff --git a/qpb/subdir.am b/qpb/subdir.am index 0ed50c01be..75a733f8fc 100644 --- a/qpb/subdir.am +++ b/qpb/subdir.am @@ -2,44 +2,36 @@ if HAVE_PROTOBUF lib_LTLIBRARIES += qpb/libfrr_pb.la endif -qpb_libfrr_pb_la_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir) -I$(top_builddir)/lib \ - $(Q_PROTOBUF_C_CLIENT_INCLUDES) +qpb_libfrr_pb_la_CPPFLAGS = $(AM_CPPFLAGS) $(PROTOBUF_C_CFLAGS) +qpb_libfrr_pb_la_LIBADD = $(PROTOBUF_C_LIBS) qpb_libfrr_pb_la_LDFLAGS = -version-info 0:0:0 qpb_libfrr_pb_la_SOURCES = \ + qpb/qpb.c \ + qpb/qpb_allocator.c \ + # end +nodist_qpb_libfrr_pb_la_SOURCES = \ + qpb/qpb.pb-c.c \ + # end + +noinst_HEADERS += \ qpb/linear_allocator.h \ qpb/qpb.h \ - qpb/qpb.c \ qpb/qpb_allocator.h \ # end -if HAVE_PROTOBUF -qpb_libfrr_pb_la_SOURCES += qpb/qpb_allocator.c -nodist_qpb_libfrr_pb_la_SOURCES = qpb/qpb.pb-c.c CLEANFILES += \ qpb/qpb.pb-c.c \ qpb/qpb.pb-c.h \ # end -endif EXTRA_DIST += qpb/qpb.proto if HAVE_PROTOBUF -# Uncomment to use an non-system version of libprotobuf-c. -# -# Q_PROTOBUF_C_CLIENT_INCLUDES = -I$(top_srcdir)/third-party/protobuf-c/src -# Q_PROTOBUF_C_CLIENT_LDOPTS = $(top_builddir)/third-party/protobuf-c/src/libprotobuf-c.la - -Q_PROTOBUF_C_CLIENT_INCLUDES= -Q_PROTOBUF_C_CLIENT_LDOPTS=-lprotobuf-c - -Q_PROTOC=protoc -Q_PROTOC_C=protoc-c - # Rules .proto.pb.h: - $(Q_PROTOC) -I$(top_srcdir) --cpp_out=$(top_srcdir) $(top_srcdir)/$^ + $(PROTOC) -I$(top_srcdir) --cpp_out=$(top_srcdir) $(top_srcdir)/$^ AM_V_PROTOC_C = $(am__v_PROTOC_C_$(V)) am__v_PROTOC_C_ = $(am__v_PROTOC_C_$(AM_DEFAULT_VERBOSITY)) @@ -47,15 +39,8 @@ am__v_PROTOC_C_0 = @echo " PROTOC_C" $@; am__v_PROTOC_C_1 = .proto.pb-c.c: - $(AM_V_PROTOC_C)$(Q_PROTOC_C) -I$(top_srcdir) --c_out=$(top_srcdir) $(top_srcdir)/$^ + $(AM_V_PROTOC_C)$(PROTOC_C) -I$(top_srcdir) --c_out=$(top_srcdir) $(top_srcdir)/$^ .pb-c.c.pb-c.h: @/bin/true -# -# Information about how to link to various libraries. -# -Q_FRR_PB_CLIENT_LDOPTS = $(top_srcdir)/qpb/libfrr_pb.la $(Q_PROTOBUF_C_CLIENT_LDOPTS) - -Q_FPM_PB_CLIENT_LDOPTS = $(top_srcdir)/fpm/libfrrfpm_pb.la $(Q_FRR_PB_CLIENT_LDOPTS) - endif # HAVE_PROTOBUF diff --git a/zebra/subdir.am b/zebra/subdir.am index 91bd792b00..ac0abe348e 100644 --- a/zebra/subdir.am +++ b/zebra/subdir.am @@ -149,10 +149,11 @@ zebra_zebra_snmp_la_LDFLAGS = -avoid-version -module -shared -export-dynamic 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_LIBADD = zebra_zebra_fpm_la_SOURCES = zebra/zebra_fpm.c zebra_zebra_fpm_la_SOURCES += zebra/zebra_fpm_netlink.c if HAVE_PROTOBUF +zebra_zebra_fpm_la_LIBADD += fpm/libfrrfpm_pb.la qpb/libfrr_pb.la $(PROTOBUF_C_LIBS) zebra_zebra_fpm_la_SOURCES += zebra/zebra_fpm_protobuf.c if DEV_BUILD zebra_zebra_fpm_la_SOURCES += zebra/zebra_fpm_dt.c From 184792415987af06870c672ea2dd15d5b7fa06f5 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Mon, 27 Aug 2018 07:02:59 +0200 Subject: [PATCH 03/12] build: make pkgconfig configure output useful The variable name is not exactly the most helpful thing there. Signed-off-by: David Lamparter --- m4/pkg.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m4/pkg.m4 b/m4/pkg.m4 index c5b26b52e6..a8dcd17c41 100644 --- a/m4/pkg.m4 +++ b/m4/pkg.m4 @@ -109,7 +109,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no -AC_MSG_CHECKING([for $1]) +AC_MSG_CHECKING([for $1 ($2)]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) From dbac691da646e624addc8f3ed5e744f9d3f8d69f Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Sun, 2 Sep 2018 20:36:20 +0200 Subject: [PATCH 04/12] build: fix & clean up *SAN flags ASAN/MSAN/TSAN flags need to be in CFLAGS and LDFLAGS; the latter links the correct compiler-dependent library. Also, the configure switch was broken (--disable-... would enable the sanitizer.) Signed-off-by: David Lamparter --- Makefile.am | 10 ++++--- configure.ac | 74 +++++++++++++++++++++---------------------------- lib/subdir.am | 5 ++-- tests/subdir.am | 2 +- 4 files changed, 42 insertions(+), 49 deletions(-) diff --git a/Makefile.am b/Makefile.am index b4d38e69af..303881b077 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,14 +4,16 @@ AUTOMAKE_OPTIONS = subdir-objects 1.12 ACLOCAL_AMFLAGS = -I m4 AM_CFLAGS = \ - @ASAN_FLAGS@ @TSAN_FLAGS@ @MSAN_FLAGS@ \ - $(WERROR) + $(SAN_FLAGS) \ + $(WERROR) \ + # end AM_CPPFLAGS = \ - @ASAN_FLAGS@ @TSAN_FLAGS@ @MSAN_FLAGS@ \ -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_srcdir)/lib \ -I$(top_builddir) -I$(top_builddir)/include -I$(top_builddir)/lib AM_LDFLAGS = \ - -export-dynamic + -export-dynamic \ + $(SAN_FLAGS) \ + # end DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" -DCONFDATE=$(CONFDATE) LIBCAP = @LIBCAP@ diff --git a/configure.ac b/configure.ac index 3657152644..326794f2cc 100755 --- a/configure.ac +++ b/configure.ac @@ -189,46 +189,6 @@ CC="${CC% -std=c99}" AC_C_FLAG([-std=gnu11], [CC="$ac_cc"], [CC="$CC -std=gnu11"]) -dnl AddressSanitizer support -AC_ARG_ENABLE([address-sanitizer], AS_HELP_STRING([--enable-address-sanitizer], \ - [enabled AddressSanitizer support for detecting a wide variety of \ - memory allocation and deallocation errors]), \ - [AC_DEFINE(HAVE_ADDRESS_SANITIZER, 1, [enable AddressSanitizer]) - ASAN_FLAGS="-fsanitize=address" - SAN_CLIPPY_FLAGS="-fno-sanitize=all" - AC_SUBST([ASAN_FLAGS]) - AC_SUBST([SAN_CLIPPY_FLAGS]) - LIBS="-ldl $LIBS" - AC_TRY_COMPILE([],[const int i=0;],[AC_MSG_NOTICE([Address Sanitizer Enabled])], - [AC_MSG_ERROR([Address Sanitizer not available])]) - ]) - -dnl ThreadSanitizer support -AC_ARG_ENABLE([thread-sanitizer], AS_HELP_STRING([--enable-thread-sanitizer], \ - [enabled ThreadSanitizer support for detecting data races]), \ - [AC_DEFINE(HAVE_THREAD_SANITIZER, 1, [enable ThreadSanitizer]) - TSAN_FLAGS="-fsanitize=thread" - SAN_CLIPPY_FLAGS="-fno-sanitize=all" - AC_SUBST([TSAN_FLAGS]) - AC_SUBST([SAN_CLIPPY_FLAGS]) - LIBS="-ldl $LIBS" - AC_TRY_COMPILE([],[const int i=0;],[AC_MSG_NOTICE([Thread Sanitizer Enabled])], - [AC_MSG_ERROR([Thread Sanitizer not available])]) - ]) - -dnl MemorySanitizer support -AC_ARG_ENABLE([memory-sanitizer], AS_HELP_STRING([--enable-memory-sanitizer], \ - [enabled MemorySanitizer support for detecting uninitialized memory reads]), \ - [AC_DEFINE(HAVE_THREAD_SANITIZER, 1, [enable MemorySanitizer]) - MSAN_FLAGS="-fsanitize=memory -fPIE -pie" - SAN_CLIPPY_FLAGS="-fno-sanitize=all" - AC_SUBST([MSAN_FLAGS]) - AC_SUBST([SAN_CLIPPY_FLAGS]) - LIBS="-ldl $LIBS" - AC_TRY_COMPILE([],[const int i=0;],[AC_MSG_NOTICE([Memory Sanitizer Enabled])], - [AC_MSG_ERROR([Memory Sanitizer not available])]) - ]) - dnl if the user has specified any CFLAGS, override our settings if test "x${enable_gcov}" = "xyes"; then if test "z$orig_cflags" = "z"; then @@ -287,6 +247,30 @@ if test x"${enable_werror}" = x"yes" ; then fi AC_SUBST(WERROR) +SAN_FLAGS="" +if test "$enable_address_sanitizer" = "yes"; then + AC_C_FLAG([-fsanitize=address], [ + AC_MSG_ERROR([$CC does not support Address Sanitizer.]) + ], [ + SAN_FLAGS="$SAN_FLAGS -fsanitize=address" + ]) +fi +if test "$enable_thread_sanitizer" = "yes"; then + AC_C_FLAG([-fsanitize=thread], [ + AC_MSG_ERROR([$CC does not support Thread Sanitizer.]) + ], [ + SAN_FLAGS="$SAN_FLAGS -fsanitize=thread" + ]) +fi +if test "$enable_memory_sanitizer" = "yes"; then + AC_C_FLAG([-fsanitize=thread -fPIE -pie], [ + AC_MSG_ERROR([$CC does not support Thread Sanitizer.]) + ], [ + SAN_FLAGS="-fsanitize=memory -fPIE -pie" + ]) +fi +AC_SUBST([SAN_FLAGS]) + dnl ---------- dnl Essentials dnl ---------- @@ -453,6 +437,12 @@ AC_ARG_ENABLE([gcov], AS_HELP_STRING([--enable-gcov], [Add code coverage information])) AC_ARG_ENABLE(bfdd, AS_HELP_STRING([--disable-bfdd], [do not build bfdd])) +AC_ARG_ENABLE([address-sanitizer], + AS_HELP_STRING([--enable-address-sanitizer], [enable AddressSanitizer support for detecting a wide variety of memory allocation and deallocation errors])) +AC_ARG_ENABLE([thread-sanitizer], + AS_HELP_STRING([--enable-thread-sanitizer], [enable ThreadSanitizer support for detecting data races])) +AC_ARG_ENABLE([memory-sanitizer], + AS_HELP_STRING([--enable-memory-sanitizer], [enable MemorySanitizer support for detecting uninitialized memory reads])) AS_IF([test "${enable_clippy_only}" != "yes"], [ AC_CHECK_HEADERS(json-c/json.h) @@ -2032,9 +2022,9 @@ FRR version : ${PACKAGE_VERSION} host operating system : ${host_os} source code location : ${srcdir} compiler : ${CC} -compiler flags : ${CFLAGS} +compiler flags : ${CFLAGS} ${SAN_FLAGS} make : ${MAKE-make} -linker flags : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM} +linker flags : ${LDFLAGS} ${SAN_FLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM} state file directory : ${frr_statedir} config file directory : `eval echo \`echo ${sysconfdir}\`` example directory : `eval echo \`echo ${exampledir}\`` diff --git a/lib/subdir.am b/lib/subdir.am index 09deb9bc1b..499bb94920 100644 --- a/lib/subdir.am +++ b/lib/subdir.am @@ -254,9 +254,10 @@ lib_grammar_sandbox_SOURCES = \ lib_grammar_sandbox_LDADD = \ lib/libfrr.la -lib_clippy_CPPFLAGS = $(AM_CPPFLAGS) -D_GNU_SOURCE -DBUILDING_CLIPPY @SAN_CLIPPY_FLAGS@ -lib_clippy_CFLAGS = $(PYTHON_CFLAGS) @SAN_CLIPPY_FLAGS@ +lib_clippy_CPPFLAGS = $(AM_CPPFLAGS) -D_GNU_SOURCE -DBUILDING_CLIPPY +lib_clippy_CFLAGS = $(PYTHON_CFLAGS) lib_clippy_LDADD = $(PYTHON_LIBS) +lib_clippy_LDFLAGS = -export-dynamic lib_clippy_SOURCES = \ lib/clippy.c \ lib/command_graph.c \ diff --git a/tests/subdir.am b/tests/subdir.am index cffc316927..739a0e86fe 100644 --- a/tests/subdir.am +++ b/tests/subdir.am @@ -108,7 +108,7 @@ TESTS_CPPFLAGS = $(AM_CPPFLAGS) \ -I$(top_srcdir)/tests/helpers/c \ -I$(top_builddir)/tests/helpers/c \ # end -TESTS_CFLAGS = @ASAN_FLAGS@ @TSAN_FLAGS@ @MSAN_FLAGS@ +TESTS_CFLAGS = $(SAN_FLAGS) # note no -Werror ALL_TESTS_LDADD = lib/libfrr.la @LIBCAP@ From b45ac5f5c61f98b0aacf65b456547142193ae1fc Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Tue, 28 Aug 2018 10:57:13 +0200 Subject: [PATCH 05/12] *: fix config.h/zebra.h include order config.h (or, transitively, zebra.h) must be the first include file listed for autoconf things like _GNU_SOURCE and _POSIX_C_SOURCE to work correctly. Signed-off-by: David Lamparter --- babeld/babel_filter.c | 4 ++++ babeld/kernel.c | 4 ++++ babeld/neighbour.c | 4 ++++ babeld/net.c | 4 ++++ babeld/resend.c | 4 ++++ babeld/source.c | 4 ++++ babeld/util.c | 4 ++++ bgpd/bgp_flowspec.c | 4 ++-- bgpd/rfapi/rfapi.c | 3 --- bgpd/rfapi/rfapi_ap.c | 2 -- bgpd/rfapi/rfapi_descriptor_rfp_utils.c | 3 --- bgpd/rfapi/rfapi_import.c | 2 -- bgpd/rfapi/rfapi_monitor.c | 2 -- bgpd/rfapi/rfapi_rib.c | 2 -- bgpd/rfapi/rfapi_vty.c | 3 --- bgpd/rfp-example/librfp/rfp_example.c | 4 ++++ bgpd/rfp-example/rfptest/rfptest.c | 3 +++ eigrpd/eigrp_fsm.c | 2 +- ldpd/pfkey.c | 4 ++++ lib/csv.c | 5 +++++ lib/ferr.c | 4 ++++ lib/frrstr.c | 4 ++++ lib/grammar_sandbox.c | 4 ++++ lib/grammar_sandbox_main.c | 4 ++++ lib/hook.c | 4 ++++ lib/lib_errors.c | 4 ++++ lib/openbsd-tree.c | 4 ++++ lib/ptm_lib.c | 5 +++++ lib/strlcat.c | 6 ++++-- lib/strlcpy.c | 6 ++++-- nhrpd/linux.c | 4 ++++ nhrpd/netlink_arp.c | 4 ++++ nhrpd/netlink_gre.c | 4 ++++ nhrpd/nhrp_event.c | 4 ++++ nhrpd/nhrp_interface.c | 4 ++++ nhrpd/nhrp_main.c | 4 ++++ nhrpd/nhrp_packet.c | 4 ++++ nhrpd/nhrp_peer.c | 4 ++++ nhrpd/nhrp_route.c | 4 ++++ nhrpd/nhrp_shortcut.c | 4 ++++ nhrpd/resolver.c | 4 ++++ nhrpd/vici.c | 4 ++++ nhrpd/zbuf.c | 5 ++++- nhrpd/znl.c | 4 ++++ ospfd/ospf_sr.c | 4 ++++ pimd/mtracebis.c | 4 ++++ pimd/mtracebis_netlink.c | 4 ++++ pimd/mtracebis_routeget.c | 4 ++++ pimd/pim_igmp_stats.c | 4 ++++ qpb/qpb_allocator.c | 4 ++++ tests/isisd/test_fuzz_isis_tlv.c | 4 ++++ tests/test_lblmgr.c | 4 ++++ tools/permutations.c | 4 ++++ tools/start-stop-daemon.c | 5 +++++ 54 files changed, 185 insertions(+), 25 deletions(-) diff --git a/babeld/babel_filter.c b/babeld/babel_filter.c index ff5cca42a0..31778901a6 100644 --- a/babeld/babel_filter.c +++ b/babeld/babel_filter.c @@ -20,6 +20,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "babel_filter.h" #include "vty.h" #include "filter.h" diff --git a/babeld/kernel.c b/babeld/kernel.c index ba2b58131c..d4c962af3b 100644 --- a/babeld/kernel.c +++ b/babeld/kernel.c @@ -21,6 +21,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/babeld/neighbour.c b/babeld/neighbour.c index c1592fb18a..512b60e29a 100644 --- a/babeld/neighbour.c +++ b/babeld/neighbour.c @@ -20,6 +20,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/babeld/net.c b/babeld/net.c index ad9a6bad92..d1f6a44142 100644 --- a/babeld/net.c +++ b/babeld/net.c @@ -20,6 +20,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/babeld/resend.c b/babeld/resend.c index 1f21977442..8949075f67 100644 --- a/babeld/resend.c +++ b/babeld/resend.c @@ -20,6 +20,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/babeld/source.c b/babeld/source.c index d6dd848952..75bca06206 100644 --- a/babeld/source.c +++ b/babeld/source.c @@ -20,6 +20,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/babeld/util.c b/babeld/util.c index 4a3ecace0c..880cda2fce 100644 --- a/babeld/util.c +++ b/babeld/util.c @@ -21,6 +21,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/bgpd/bgp_flowspec.c b/bgpd/bgp_flowspec.c index e29508bf36..c604135bfd 100644 --- a/bgpd/bgp_flowspec.c +++ b/bgpd/bgp_flowspec.c @@ -18,9 +18,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "math.h" - #include +#include + #include "prefix.h" #include "lib_errors.h" diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index a427608f67..51504bb0ad 100644 --- a/bgpd/rfapi/rfapi.c +++ b/bgpd/rfapi/rfapi.c @@ -18,9 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#include - #include "lib/zebra.h" #include "lib/prefix.h" #include "lib/agg_table.h" diff --git a/bgpd/rfapi/rfapi_ap.c b/bgpd/rfapi/rfapi_ap.c index 691e1e4ec8..c5fda15d33 100644 --- a/bgpd/rfapi/rfapi_ap.c +++ b/bgpd/rfapi/rfapi_ap.c @@ -18,8 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include - #include "lib/zebra.h" #include "lib/prefix.h" #include "lib/agg_table.h" diff --git a/bgpd/rfapi/rfapi_descriptor_rfp_utils.c b/bgpd/rfapi/rfapi_descriptor_rfp_utils.c index 3217d34e77..ce5acf002c 100644 --- a/bgpd/rfapi/rfapi_descriptor_rfp_utils.c +++ b/bgpd/rfapi/rfapi_descriptor_rfp_utils.c @@ -18,9 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#include - #include "lib/zebra.h" #include "lib/prefix.h" #include "lib/table.h" diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index 4c506da686..4601718f12 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -23,8 +23,6 @@ * Purpose: Handle import of routes from BGP to RFAPI */ -#include - #include "lib/zebra.h" #include "lib/prefix.h" #include "lib/agg_table.h" diff --git a/bgpd/rfapi/rfapi_monitor.c b/bgpd/rfapi/rfapi_monitor.c index 59387240fa..f18c6bfe12 100644 --- a/bgpd/rfapi/rfapi_monitor.c +++ b/bgpd/rfapi/rfapi_monitor.c @@ -24,8 +24,6 @@ /* TBD remove unneeded includes */ -#include - #include "lib/zebra.h" #include "lib/prefix.h" #include "lib/agg_table.h" diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c index 3ac217ff89..008da30118 100644 --- a/bgpd/rfapi/rfapi_rib.c +++ b/bgpd/rfapi/rfapi_rib.c @@ -23,8 +23,6 @@ * Purpose: maintain per-nve ribs and generate change lists */ -#include - #include "lib/zebra.h" #include "lib/prefix.h" #include "lib/agg_table.h" diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index b2767da8b2..cd751319eb 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -18,9 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#include - #include "lib/zebra.h" #include "lib/prefix.h" #include "lib/agg_table.h" diff --git a/bgpd/rfp-example/librfp/rfp_example.c b/bgpd/rfp-example/librfp/rfp_example.c index 75e57a029e..af3092232c 100644 --- a/bgpd/rfp-example/librfp/rfp_example.c +++ b/bgpd/rfp-example/librfp/rfp_example.c @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + /* stub rfp */ #include "rfp_internal.h" #include "bgpd/rfapi/rfapi.h" diff --git a/bgpd/rfp-example/rfptest/rfptest.c b/bgpd/rfp-example/rfptest/rfptest.c index 53e1c33cfb..48df6c0cc7 100644 --- a/bgpd/rfp-example/rfptest/rfptest.c +++ b/bgpd/rfp-example/rfptest/rfptest.c @@ -18,6 +18,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif /* dummy test program */ #include diff --git a/eigrpd/eigrp_fsm.c b/eigrpd/eigrp_fsm.c index eeefc51968..d291cab4c0 100644 --- a/eigrpd/eigrp_fsm.c +++ b/eigrpd/eigrp_fsm.c @@ -67,8 +67,8 @@ * 7- state not changed, usually by receiving not last reply */ -#include #include +#include #include "prefix.h" #include "table.h" diff --git a/ldpd/pfkey.c b/ldpd/pfkey.c index 906737217c..a719d0cbb7 100644 --- a/ldpd/pfkey.c +++ b/ldpd/pfkey.c @@ -17,6 +17,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #ifdef __OpenBSD__ #include #include diff --git a/lib/csv.c b/lib/csv.c index ce84783aa6..10e62731d1 100644 --- a/lib/csv.c +++ b/lib/csv.c @@ -17,6 +17,11 @@ * with this program; see the file COPYING; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/lib/ferr.c b/lib/ferr.c index fb5719d4de..afef196cec 100644 --- a/lib/ferr.c +++ b/lib/ferr.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/lib/frrstr.c b/lib/frrstr.c index 715e67b868..85d968182b 100644 --- a/lib/frrstr.c +++ b/lib/frrstr.c @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 51e7a3987e..ef03e85217 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -23,6 +23,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "command.h" #include "memory_vty.h" #include "graph.h" diff --git a/lib/grammar_sandbox_main.c b/lib/grammar_sandbox_main.c index 264c7c48f0..c9c942f9bf 100644 --- a/lib/grammar_sandbox_main.c +++ b/lib/grammar_sandbox_main.c @@ -23,6 +23,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "command.h" #include "memory_vty.h" diff --git a/lib/hook.c b/lib/hook.c index 935064f4d2..4fe305f282 100644 --- a/lib/hook.c +++ b/lib/hook.c @@ -20,6 +20,10 @@ * DEALINGS IN THE SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "memory.h" #include "hook.h" diff --git a/lib/lib_errors.c b/lib/lib_errors.c index 332a5b1d45..2ddc571e68 100644 --- a/lib/lib_errors.c +++ b/lib/lib_errors.c @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "lib_errors.h" /* clang-format off */ diff --git a/lib/openbsd-tree.c b/lib/openbsd-tree.c index 35bfce3a89..e8d13339b6 100644 --- a/lib/openbsd-tree.c +++ b/lib/openbsd-tree.c @@ -41,6 +41,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include diff --git a/lib/ptm_lib.c b/lib/ptm_lib.c index 69fd61e2a0..7f868beda4 100644 --- a/lib/ptm_lib.c +++ b/lib/ptm_lib.c @@ -17,6 +17,11 @@ * with this program; see the file COPYING; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/lib/strlcat.c b/lib/strlcat.c index be211f82a8..39773d9ac8 100644 --- a/lib/strlcat.c +++ b/lib/strlcat.c @@ -20,11 +20,13 @@ /* adapted for Quagga from glibc patch submission originally from * Florian Weimer , 2016-05-18 */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include -#include "config.h" - #ifndef HAVE_STRLCAT #undef strlcat diff --git a/lib/strlcpy.c b/lib/strlcpy.c index b0c33ca7f4..71ee9f1a54 100644 --- a/lib/strlcpy.c +++ b/lib/strlcpy.c @@ -20,9 +20,11 @@ /* adapted for Quagga from glibc patch submission originally from * Florian Weimer , 2016-05-18 */ -#include - +#ifdef HAVE_CONFIG_H #include "config.h" +#endif + +#include #ifndef HAVE_STRLCPY #undef strlcpy diff --git a/nhrpd/linux.c b/nhrpd/linux.c index 46a327b59f..85e941e7ba 100644 --- a/nhrpd/linux.c +++ b/nhrpd/linux.c @@ -7,6 +7,10 @@ * (at your option) any later version. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/nhrpd/netlink_arp.c b/nhrpd/netlink_arp.c index af78b3d9ee..4c6827cb3d 100644 --- a/nhrpd/netlink_arp.c +++ b/nhrpd/netlink_arp.c @@ -7,6 +7,10 @@ * (at your option) any later version. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/nhrpd/netlink_gre.c b/nhrpd/netlink_gre.c index 75ecaa70c1..3fdfa9c313 100644 --- a/nhrpd/netlink_gre.c +++ b/nhrpd/netlink_gre.c @@ -7,6 +7,10 @@ * (at your option) any later version. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/nhrpd/nhrp_event.c b/nhrpd/nhrp_event.c index 7ca9731765..9301c2d515 100644 --- a/nhrpd/nhrp_event.c +++ b/nhrpd/nhrp_event.c @@ -7,6 +7,10 @@ * (at your option) any later version. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/nhrpd/nhrp_interface.c b/nhrpd/nhrp_interface.c index 3a42712748..ccca100db5 100644 --- a/nhrpd/nhrp_interface.c +++ b/nhrpd/nhrp_interface.c @@ -7,6 +7,10 @@ * (at your option) any later version. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include "zebra.h" #include "linklist.h" diff --git a/nhrpd/nhrp_main.c b/nhrpd/nhrp_main.c index 737e70103e..f99e566399 100644 --- a/nhrpd/nhrp_main.c +++ b/nhrpd/nhrp_main.c @@ -7,6 +7,10 @@ * (at your option) any later version. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include "zebra.h" diff --git a/nhrpd/nhrp_packet.c b/nhrpd/nhrp_packet.c index e62ee1ef72..a983aa71bc 100644 --- a/nhrpd/nhrp_packet.c +++ b/nhrpd/nhrp_packet.c @@ -7,6 +7,10 @@ * (at your option) any later version. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include "nhrpd.h" #include "zbuf.h" diff --git a/nhrpd/nhrp_peer.c b/nhrpd/nhrp_peer.c index 44271d68ac..e051830f85 100644 --- a/nhrpd/nhrp_peer.c +++ b/nhrpd/nhrp_peer.c @@ -7,6 +7,10 @@ * (at your option) any later version. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include "zebra.h" diff --git a/nhrpd/nhrp_route.c b/nhrpd/nhrp_route.c index 044529a5ca..e7b187f3b6 100644 --- a/nhrpd/nhrp_route.c +++ b/nhrpd/nhrp_route.c @@ -7,6 +7,10 @@ * (at your option) any later version. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "nhrpd.h" #include "table.h" #include "memory.h" diff --git a/nhrpd/nhrp_shortcut.c b/nhrpd/nhrp_shortcut.c index 9ed2517069..84053b4b5d 100644 --- a/nhrpd/nhrp_shortcut.c +++ b/nhrpd/nhrp_shortcut.c @@ -7,6 +7,10 @@ * (at your option) any later version. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "nhrpd.h" #include "table.h" #include "memory.h" diff --git a/nhrpd/resolver.c b/nhrpd/resolver.c index dfa5dc3df0..f017d974df 100644 --- a/nhrpd/resolver.c +++ b/nhrpd/resolver.c @@ -7,6 +7,10 @@ * (at your option) any later version. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include diff --git a/nhrpd/vici.c b/nhrpd/vici.c index 7cd703414a..c1a99685f3 100644 --- a/nhrpd/vici.c +++ b/nhrpd/vici.c @@ -7,6 +7,10 @@ * (at your option) any later version. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/nhrpd/zbuf.c b/nhrpd/zbuf.c index 6e7cad8aec..c662295083 100644 --- a/nhrpd/zbuf.c +++ b/nhrpd/zbuf.c @@ -7,7 +7,10 @@ * (at your option) any later version. */ -#define _GNU_SOURCE +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/nhrpd/znl.c b/nhrpd/znl.c index 01b2f433af..6030987a1b 100644 --- a/nhrpd/znl.c +++ b/nhrpd/znl.c @@ -7,6 +7,10 @@ * (at your option) any later version. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c index 62eca156f5..220de3234d 100644 --- a/ospfd/ospf_sr.c +++ b/ospfd/ospf_sr.c @@ -24,6 +24,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/pimd/mtracebis.c b/pimd/mtracebis.c index c0d95aeed9..65c495eff0 100644 --- a/pimd/mtracebis.c +++ b/pimd/mtracebis.c @@ -17,6 +17,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #ifdef __linux__ #include "pim_igmp_mtrace.h" diff --git a/pimd/mtracebis_netlink.c b/pimd/mtracebis_netlink.c index b4bf6bada3..30ee8f24ab 100644 --- a/pimd/mtracebis_netlink.c +++ b/pimd/mtracebis_netlink.c @@ -10,6 +10,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #ifdef __linux__ #include diff --git a/pimd/mtracebis_routeget.c b/pimd/mtracebis_routeget.c index 8c1cd8d963..8d974403ac 100644 --- a/pimd/mtracebis_routeget.c +++ b/pimd/mtracebis_routeget.c @@ -17,6 +17,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #ifdef __linux__ #include diff --git a/pimd/pim_igmp_stats.c b/pimd/pim_igmp_stats.c index 428816e1f0..40851a4529 100644 --- a/pimd/pim_igmp_stats.c +++ b/pimd/pim_igmp_stats.c @@ -17,6 +17,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "pim_igmp_stats.h" void igmp_stats_init(struct igmp_stats *stats) diff --git a/qpb/qpb_allocator.c b/qpb/qpb_allocator.c index 7e5ba5b0ce..aca611ba19 100644 --- a/qpb/qpb_allocator.c +++ b/qpb/qpb_allocator.c @@ -22,6 +22,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "linear_allocator.h" #include "qpb_allocator.h" diff --git a/tests/isisd/test_fuzz_isis_tlv.c b/tests/isisd/test_fuzz_isis_tlv.c index 3a56f83f0a..b75c1002d4 100644 --- a/tests/isisd/test_fuzz_isis_tlv.c +++ b/tests/isisd/test_fuzz_isis_tlv.c @@ -1,3 +1,7 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "test_fuzz_isis_tlv_tests.h" #include diff --git a/tests/test_lblmgr.c b/tests/test_lblmgr.c index c751c0b12d..652d7618a8 100644 --- a/tests/test_lblmgr.c +++ b/tests/test_lblmgr.c @@ -21,6 +21,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "lib/stream.h" #include "lib/zclient.h" diff --git a/tools/permutations.c b/tools/permutations.c index 80441753e7..c5109dc3e8 100644 --- a/tools/permutations.c +++ b/tools/permutations.c @@ -20,6 +20,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "command.h" #include "graph.h" #include "vector.h" diff --git a/tools/start-stop-daemon.c b/tools/start-stop-daemon.c index de58e0a20e..e1cce85557 100644 --- a/tools/start-stop-daemon.c +++ b/tools/start-stop-daemon.c @@ -25,12 +25,17 @@ * the whole automake/config.h dance. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #ifdef HAVE_LXC #define _GNU_SOURCE #include #endif /* HAVE_LXC */ #include +#undef VERSION #define VERSION "1.9.18" #define MIN_POLL_INTERVAL 20000 /*us*/ From ae9eebcaeb68cae4f2e4ae6cc689b505c9814591 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Tue, 28 Aug 2018 10:59:02 +0200 Subject: [PATCH 06/12] *: fix some solaris warnings Signed-off-by: David Lamparter --- bfdd/ptm_adapter.c | 2 +- lib/if.c | 2 +- python/clidef.py | 2 +- tools/start-stop-daemon.c | 30 +++++++++++++++--------------- zebra/if_ioctl_solaris.c | 6 ++---- zebra/rtread_getmsg.c | 1 + 6 files changed, 21 insertions(+), 22 deletions(-) diff --git a/bfdd/ptm_adapter.c b/bfdd/ptm_adapter.c index 4287891621..a5fae3383c 100644 --- a/bfdd/ptm_adapter.c +++ b/bfdd/ptm_adapter.c @@ -289,7 +289,7 @@ static int _ptm_msg_read(struct stream *msg, int command, { uint32_t pid; uint8_t ttl __attribute__((unused)); - uint8_t ifnamelen; + size_t ifnamelen; /* * Register/Deregister/Update Message format: diff --git a/lib/if.c b/lib/if.c index 2bf0c6e6b5..a03c9da6f9 100644 --- a/lib/if.c +++ b/lib/if.c @@ -619,7 +619,7 @@ DEFUN (no_interface_desc, * if not: * - no idea, just get the name in its entirety. */ -static struct interface *if_sunwzebra_get(char *name, vrf_id_t vrf_id) +static struct interface *if_sunwzebra_get(const char *name, vrf_id_t vrf_id) { struct interface *ifp; char *cp; diff --git a/python/clidef.py b/python/clidef.py index 4134f4c94e..a140ce3d54 100644 --- a/python/clidef.py +++ b/python/clidef.py @@ -96,7 +96,7 @@ class IP4Handler(IPBase): code = Template('_fail = !inet_aton(argv[_i]->arg, &$varname);') class IP6Handler(IPBase): argtype = 'struct in6_addr' - decl = Template('struct in6_addr $varname = IN6ADDR_ANY_INIT;') + decl = Template('struct in6_addr $varname = {};') code = Template('_fail = !inet_pton(AF_INET6, argv[_i]->arg, &$varname);') class IPGenHandler(IPBase): argtype = 'const union sockunion *' diff --git a/tools/start-stop-daemon.c b/tools/start-stop-daemon.c index e1cce85557..cc0315c130 100644 --- a/tools/start-stop-daemon.c +++ b/tools/start-stop-daemon.c @@ -607,7 +607,7 @@ static int pid_is_exec(pid_t pid, const struct stat *esb) struct stat sb; char buf[32]; - sprintf(buf, "/proc/%d/exe", pid); + sprintf(buf, "/proc/%ld/exe", (long)pid); if (stat(buf, &sb) != 0) return 0; return (sb.st_dev == esb->st_dev && sb.st_ino == esb->st_ino); @@ -619,7 +619,7 @@ static int pid_is_user(pid_t pid, uid_t uid) struct stat sb; char buf[32]; - sprintf(buf, "/proc/%d", pid); + sprintf(buf, "/proc/%ld", (long)pid); if (stat(buf, &sb) != 0) return 0; return (sb.st_uid == uid); @@ -632,7 +632,7 @@ static int pid_is_cmd(pid_t pid, const char *name) FILE *f; int c; - sprintf(buf, "/proc/%d/stat", pid); + sprintf(buf, "/proc/%ld/stat", (long)pid); f = fopen(buf, "r"); if (!f) return 0; @@ -664,12 +664,12 @@ static void check(pid_t pid) static void do_pidfile(const char *name) { FILE *f; - pid_t pid; + long pid; f = fopen(name, "r"); if (f) { - if (fscanf(f, "%d", &pid) == 1) - check(pid); + if (fscanf(f, "%ld", &pid) == 1) + check((pid_t)pid); fclose(f); } else if (errno != ENOENT) fatal("open pidfile %s: %s", name, strerror(errno)); @@ -682,7 +682,7 @@ static void do_procinit(void) DIR *procdir; struct dirent *entry; int foundany; - pid_t pid; + long pid; procdir = opendir("/proc"); if (!procdir) @@ -690,10 +690,10 @@ static void do_procinit(void) foundany = 0; while ((entry = readdir(procdir)) != NULL) { - if (sscanf(entry->d_name, "%d", &pid) != 1) + if (sscanf(entry->d_name, "%ld", &pid) != 1) continue; foundany++; - check(pid); + check((pid_t)pid); } closedir(procdir); if (!foundany) @@ -728,21 +728,21 @@ static void do_stop(int signal_nr, int quietmode, int *n_killed, for (p = found; p; p = p->next) { if (testmode) - printf("Would send signal %d to %d.\n", signal_nr, - p->pid); + printf("Would send signal %d to %ld.\n", signal_nr, + (long)p->pid); else if (kill(p->pid, signal_nr) == 0) { push(&killed, p->pid); (*n_killed)++; } else { - printf("%s: warning: failed to kill %d: %s\n", progname, - p->pid, strerror(errno)); + printf("%s: warning: failed to kill %ld: %s\n", + progname, (long)p->pid, strerror(errno)); (*n_notkilled)++; } } if (quietmode < 0 && killed) { printf("Stopped %s (pid", what_stop); for (p = killed; p; p = p->next) - printf(" %d", p->pid); + printf(" %ld", (long)p->pid); putchar(')'); if (retry_nr > 0) printf(", retry #%d", retry_nr); @@ -1055,7 +1055,7 @@ int main(int argc, char **argv) if (pidf == NULL) fatal("Unable to open pidfile `%s' for writing: %s", pidfile, strerror(errno)); - fprintf(pidf, "%d\n", pidt); + fprintf(pidf, "%ld\n", (long)pidt); fclose(pidf); } set_namespaces(); diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c index 5a58fe1751..7ec73ea111 100644 --- a/zebra/if_ioctl_solaris.c +++ b/zebra/if_ioctl_solaris.c @@ -39,6 +39,7 @@ #include "zebra/interface.h" #include "zebra/ioctl_solaris.h" #include "zebra/rib.h" +#include "zebra/rt.h" static int if_get_addr(struct interface *, struct sockaddr *, const char *); static void interface_info_ioctl(struct interface *); @@ -55,7 +56,6 @@ static int interface_list_ioctl(int af) struct lifconf lifconf; struct interface *ifp; int n; - int save_errno; size_t needed, lastneeded = 0; char *buf = NULL; @@ -76,13 +76,11 @@ calculate_lifc_len: lifn.lifn_flags = LIFC_NOXMIT; /* we want NOXMIT interfaces too */ ret = ioctl(sock, SIOCGLIFNUM, &lifn); - save_errno = errno; - } if (ret < 0) { zlog_warn("interface_list_ioctl: SIOCGLIFNUM failed %s", - safe_strerror(save_errno)); + safe_strerror(errno)); close(sock); return -1; } diff --git a/zebra/rtread_getmsg.c b/zebra/rtread_getmsg.c index b3aeaf2f76..8e5d7fbdbe 100644 --- a/zebra/rtread_getmsg.c +++ b/zebra/rtread_getmsg.c @@ -31,6 +31,7 @@ #include "zebra/rib.h" #include "zebra/rt.h" +#include "zebra/zebra_pbr.h" /* Thank you, Solaris, for polluting application symbol namespace. */ #undef hook_register From 0718b5624c20132450ba39454a8e245bc543281b Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Tue, 28 Aug 2018 11:40:57 +0200 Subject: [PATCH 07/12] build: use _POSIX_C_SOURCE Need this to get CMSG_SPACE/CMSG_LEN on Solaris. Also, AC_GNU_SOURCE is deprecated, AC_USE_SYSTEM_EXTENSIONS does that. Signed-off-by: David Lamparter --- configure.ac | 8 ++------ lib/zebra.h | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 326794f2cc..e6ca7d9589 100755 --- a/configure.ac +++ b/configure.ac @@ -298,11 +298,6 @@ AC_PROG_LN_S AC_PROG_MAKE_SET AC_CHECK_TOOL(AR, ar) -dnl ----------------- -dnl System extensions -dnl ----------------- -AC_GNU_SOURCE - dnl ------- dnl libtool dnl ------- @@ -823,7 +818,7 @@ int main(int argc, char **argv) { dnl Utility macro to avoid retyping includes all the time m4_define([FRR_INCLUDES], [#ifdef SUNOS_5 -#define _XPG4_2 +#define _POSIX_C_SOURCE 200809L #define __EXTENSIONS__ #endif #include @@ -916,6 +911,7 @@ case "$host_os" in AC_DEFINE(SUNOS_5, 1, [SunOS 5]) AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6) + AC_DEFINE(_POSIX_C_SOURCE, 200809L, [enable POSIX.1-2008 and XPG7/SUSv4]) AC_CHECK_LIB(socket, main) AC_CHECK_LIB(nsl, main) diff --git a/lib/zebra.h b/lib/zebra.h index 7b7a42d908..d80aa06935 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -28,7 +28,6 @@ #include "compiler.h" #ifdef SUNOS_5 -#define _XPG4_2 typedef unsigned int uint32_t; typedef unsigned short uint16_t; typedef unsigned char uint8_t; From 324be174d79290281ec42b41636a5303c569a133 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Tue, 4 Sep 2018 12:24:22 +0200 Subject: [PATCH 08/12] build: check {malloc,pthread}_np.h for *BSD FreeBSD has malloc_usable_size() in malloc_np.h OpenBSD has pthread_set_name_np() in pthread_np.h Signed-off-by: David Lamparter --- configure.ac | 9 ++++++++- lib/frr_pthread.c | 3 +++ lib/memory.c | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index e6ca7d9589..779c7ebb6a 100755 --- a/configure.ac +++ b/configure.ac @@ -815,6 +815,10 @@ int main(int argc, char **argv) { ]) ]) +AC_CHECK_HEADERS([pthread_np.h],,, [ +#include +]) + dnl Utility macro to avoid retyping includes all the time m4_define([FRR_INCLUDES], [#ifdef SUNOS_5 @@ -1784,13 +1788,16 @@ dnl order to check no alternative allocator dnl has been specified, which might not provide dnl mallinfo, e.g. such as Umem on Solaris. dnl ----------------------------------------- -AC_CHECK_HEADERS([malloc.h malloc/malloc.h],,, [FRR_INCLUDES]) +AC_CHECK_HEADERS([malloc.h malloc_np.h malloc/malloc.h],,, [FRR_INCLUDES]) AC_CACHE_CHECK([whether mallinfo is available], [frr_cv_mallinfo], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([FRR_INCLUDES [ #ifdef HAVE_MALLOC_H #include #endif +#ifdef HAVE_MALLOC_NP_H +#include +#endif #ifdef HAVE_MALLOC_MALLOC_H #include #endif diff --git a/lib/frr_pthread.c b/lib/frr_pthread.c index c0aae5e52e..7cae889ca9 100644 --- a/lib/frr_pthread.c +++ b/lib/frr_pthread.c @@ -19,6 +19,9 @@ #include #include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif #include #include "frr_pthread.h" diff --git a/lib/memory.c b/lib/memory.c index 695bbfe115..fee23a75ac 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -20,6 +20,9 @@ #ifdef HAVE_MALLOC_H #include #endif +#ifdef HAVE_MALLOC_NP_H +#include +#endif #ifdef HAVE_MALLOC_MALLOC_H #include #endif From e9d938b82a630d61a5cb0890c424c42f3e9ce241 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Tue, 4 Sep 2018 13:15:56 +0200 Subject: [PATCH 09/12] lib: make pthread_set[_]name_np test OS agnostic FreeBSD supports pthread_set_name_np() too. Also, pthread_set_name_np() returns void. And NetBSD has pthread_setname_np() with an extra arg... Signed-off-by: David Lamparter --- configure.ac | 1 + lib/frr_pthread.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 779c7ebb6a..294d3bf325 100755 --- a/configure.ac +++ b/configure.ac @@ -818,6 +818,7 @@ int main(int argc, char **argv) { AC_CHECK_HEADERS([pthread_np.h],,, [ #include ]) +AC_CHECK_FUNCS([pthread_setname_np pthread_set_name_np]) dnl Utility macro to avoid retyping includes all the time m4_define([FRR_INCLUDES], diff --git a/lib/frr_pthread.c b/lib/frr_pthread.c index 7cae889ca9..d48b23f38a 100644 --- a/lib/frr_pthread.c +++ b/lib/frr_pthread.c @@ -166,10 +166,14 @@ int frr_pthread_set_name(struct frr_pthread *fpt, const char *name, pthread_mutex_lock(&fpt->mtx); snprintf(fpt->os_name, OS_THREAD_NAMELEN, "%s", os_name); pthread_mutex_unlock(&fpt->mtx); -#ifdef GNU_LINUX +#ifdef HAVE_PTHREAD_SETNAME_NP +# ifdef GNU_LINUX ret = pthread_setname_np(fpt->thread, fpt->os_name); -#elif defined(OPEN_BSD) - ret = pthread_set_name_np(fpt->thread, fpt->os_name); +# else /* NetBSD */ + ret = pthread_setname_np(fpt->thread, fpt->os_name, NULL); +# endif +#elif defined(HAVE_PTHREAD_SET_NAME_NP) + pthread_set_name_np(fpt->thread, fpt->os_name); #endif } From 3009394b3cb659b3df74637b0d27314913f18230 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Tue, 4 Sep 2018 12:27:46 +0200 Subject: [PATCH 10/12] *: fix some random warnings Signed-off-by: David Lamparter --- isisd/isis_bpf.c | 4 ++-- lib/stream.c | 8 ++++---- pimd/pim_igmp_mtrace.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/isisd/isis_bpf.c b/isisd/isis_bpf.c index 7e8a4a4eda..28750278b0 100644 --- a/isisd/isis_bpf.c +++ b/isisd/isis_bpf.c @@ -213,7 +213,7 @@ int isis_sock_init(struct isis_circuit *circuit) int isis_recv_pdu_bcast(struct isis_circuit *circuit, uint8_t *ssnpa) { - int bytesread = 0, bytestoread, offset, one = 1, err = ISIS_OK; + int bytesread = 0, bytestoread, offset, one = 1; uint8_t *buff_ptr; struct bpf_hdr *bpf_hdr; @@ -249,7 +249,7 @@ int isis_recv_pdu_bcast(struct isis_circuit *circuit, uint8_t *ssnpa) memcpy(ssnpa, buff_ptr + bpf_hdr->bh_hdrlen + ETHER_ADDR_LEN, ETHER_ADDR_LEN); - err = isis_handle_pdu(circuit, ssnpa); + isis_handle_pdu(circuit, ssnpa); stream_reset(circuit->rcv_stream); buff_ptr += BPF_WORDALIGN(bpf_hdr->bh_hdrlen + bpf_hdr->bh_datalen); diff --git a/lib/stream.c b/lib/stream.c index 55e7f64358..589a229256 100644 --- a/lib/stream.c +++ b/lib/stream.c @@ -270,7 +270,7 @@ void stream_forward_endp(struct stream *s, size_t size) } /* Copy from stream to destination. */ -inline bool stream_get2(void *dst, struct stream *s, size_t size) +bool stream_get2(void *dst, struct stream *s, size_t size) { STREAM_VERIFY_SANE(s); @@ -299,7 +299,7 @@ void stream_get(void *dst, struct stream *s, size_t size) } /* Get next character from the stream. */ -inline bool stream_getc2(struct stream *s, uint8_t *byte) +bool stream_getc2(struct stream *s, uint8_t *byte) { STREAM_VERIFY_SANE(s); @@ -344,7 +344,7 @@ uint8_t stream_getc_from(struct stream *s, size_t from) return c; } -inline bool stream_getw2(struct stream *s, uint16_t *word) +bool stream_getw2(struct stream *s, uint16_t *word) { STREAM_VERIFY_SANE(s); @@ -465,7 +465,7 @@ void stream_get_from(void *dst, struct stream *s, size_t from, size_t size) memcpy(dst, s->data + from, size); } -inline bool stream_getl2(struct stream *s, uint32_t *l) +bool stream_getl2(struct stream *s, uint32_t *l) { STREAM_VERIFY_SANE(s); diff --git a/pimd/pim_igmp_mtrace.c b/pimd/pim_igmp_mtrace.c index 95d0278a34..1fb624a6a0 100644 --- a/pimd/pim_igmp_mtrace.c +++ b/pimd/pim_igmp_mtrace.c @@ -615,7 +615,7 @@ int igmp_mtrace_recv_qry_req(struct igmp_sock *igmp, struct ip *ip_hdr, static uint32_t qry_id, qry_src; char mtrace_buf[MTRACE_HDR_SIZE + MTRACE_MAX_HOPS * MTRACE_RSP_SIZE]; struct interface *ifp; - struct interface *out_ifp; + struct interface *out_ifp = NULL; struct pim_interface *pim_ifp; struct pim_instance *pim; struct igmp_mtrace *mtracep; From 01db90cd83edbcd2f806ece2c2d1620478f51c8f Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Tue, 4 Sep 2018 12:55:19 +0200 Subject: [PATCH 11/12] ospf6d: remove extra struct in ospf6_lsa_handler This serves no other purpose than to generate stupid warnings for overwritten initializers on old gcc versions. Signed-off-by: David Lamparter --- ospf6d/ospf6_lsa.c | 27 ++++++++++++++------------- ospf6d/ospf6_lsa.h | 23 ++++++++--------------- ospf6d/ospf6_neighbor.c | 2 +- 3 files changed, 23 insertions(+), 29 deletions(-) diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 8b720b6d84..40b3522c3d 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -130,7 +130,7 @@ uint8_t ospf6_lstype_debug(uint16_t type) { const struct ospf6_lsa_handler *handler; handler = ospf6_get_lsa_handler(type); - return handler->debug; + return handler->lh_debug; } /* RFC2328: Section 13.2 */ @@ -844,13 +844,13 @@ DEFUN (debug_ospf6_lsa_type, if (argc == 5) { if (strmatch(argv[idx_type]->text, "originate")) - SET_FLAG(handler->debug, OSPF6_LSA_DEBUG_ORIGINATE); + SET_FLAG(handler->lh_debug, OSPF6_LSA_DEBUG_ORIGINATE); else if (strmatch(argv[idx_type]->text, "examine")) - SET_FLAG(handler->debug, OSPF6_LSA_DEBUG_EXAMIN); + SET_FLAG(handler->lh_debug, OSPF6_LSA_DEBUG_EXAMIN); else if (strmatch(argv[idx_type]->text, "flooding")) - SET_FLAG(handler->debug, OSPF6_LSA_DEBUG_FLOOD); + SET_FLAG(handler->lh_debug, OSPF6_LSA_DEBUG_FLOOD); } else - SET_FLAG(handler->debug, OSPF6_LSA_DEBUG); + SET_FLAG(handler->lh_debug, OSPF6_LSA_DEBUG); return CMD_SUCCESS; } @@ -896,13 +896,14 @@ DEFUN (no_debug_ospf6_lsa_type, if (argc == 6) { if (strmatch(argv[idx_type]->text, "originate")) - UNSET_FLAG(handler->debug, OSPF6_LSA_DEBUG_ORIGINATE); + UNSET_FLAG(handler->lh_debug, + OSPF6_LSA_DEBUG_ORIGINATE); if (strmatch(argv[idx_type]->text, "examine")) - UNSET_FLAG(handler->debug, OSPF6_LSA_DEBUG_EXAMIN); + UNSET_FLAG(handler->lh_debug, OSPF6_LSA_DEBUG_EXAMIN); if (strmatch(argv[idx_type]->text, "flooding")) - UNSET_FLAG(handler->debug, OSPF6_LSA_DEBUG_FLOOD); + UNSET_FLAG(handler->lh_debug, OSPF6_LSA_DEBUG_FLOOD); } else - UNSET_FLAG(handler->debug, OSPF6_LSA_DEBUG); + UNSET_FLAG(handler->lh_debug, OSPF6_LSA_DEBUG); return CMD_SUCCESS; } @@ -924,16 +925,16 @@ int config_write_ospf6_debug_lsa(struct vty *vty) handler = vector_slot(ospf6_lsa_handler_vector, i); if (handler == NULL) continue; - if (CHECK_FLAG(handler->debug, OSPF6_LSA_DEBUG)) + if (CHECK_FLAG(handler->lh_debug, OSPF6_LSA_DEBUG)) vty_out(vty, "debug ospf6 lsa %s\n", ospf6_lsa_handler_name(handler)); - if (CHECK_FLAG(handler->debug, OSPF6_LSA_DEBUG_ORIGINATE)) + if (CHECK_FLAG(handler->lh_debug, OSPF6_LSA_DEBUG_ORIGINATE)) vty_out(vty, "debug ospf6 lsa %s originate\n", ospf6_lsa_handler_name(handler)); - if (CHECK_FLAG(handler->debug, OSPF6_LSA_DEBUG_EXAMIN)) + if (CHECK_FLAG(handler->lh_debug, OSPF6_LSA_DEBUG_EXAMIN)) vty_out(vty, "debug ospf6 lsa %s examine\n", ospf6_lsa_handler_name(handler)); - if (CHECK_FLAG(handler->debug, OSPF6_LSA_DEBUG_FLOOD)) + if (CHECK_FLAG(handler->lh_debug, OSPF6_LSA_DEBUG_FLOOD)) vty_out(vty, "debug ospf6 lsa %s flooding\n", ospf6_lsa_handler_name(handler)); } diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h index e88d10ad7e..d871a8842e 100644 --- a/ospf6d/ospf6_lsa.h +++ b/ospf6d/ospf6_lsa.h @@ -137,21 +137,14 @@ struct ospf6_lsa { #define OSPF6_LSA_SEQWRAPPED 0x20 struct ospf6_lsa_handler { - const struct { - uint16_t type; /* host byte order */ - const char *name; - const char *short_name; - int (*show)(struct vty *, struct ospf6_lsa *); - char *(*get_prefix_str)(struct ospf6_lsa *, char *buf, - int buflen, int pos); - } s; -#define lh_type s.type -#define lh_name s.name -#define lh_short_name s.short_name -#define lh_show s.show -#define lh_get_prefix_str s.get_prefix_str - uint8_t debug; -#define lh_debug debug + uint16_t lh_type; /* host byte order */ + const char *lh_name; + const char *lh_short_name; + int (*lh_show)(struct vty *, struct ospf6_lsa *); + char *(*lh_get_prefix_str)(struct ospf6_lsa *, char *buf, + int buflen, int pos); + + uint8_t lh_debug; }; #define OSPF6_LSA_IS_KNOWN(t) \ diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index 0cc7294d67..4c24f47131 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -921,7 +921,7 @@ DEFUN (no_debug_ospf6, handler = vector_slot(ospf6_lsa_handler_vector, i); if (handler != NULL) { - UNSET_FLAG(handler->debug, OSPF6_LSA_DEBUG); + UNSET_FLAG(handler->lh_debug, OSPF6_LSA_DEBUG); } } From 7b34167d7dac6e898c49c675cfc80ae68c64bc98 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Sun, 9 Sep 2018 01:00:42 +0200 Subject: [PATCH 12/12] lib: early-include "config.h" in flex lexers This is neccessary to get _FILE_OFFSET_BITS right. Signed-off-by: David Lamparter --- lib/command_lex.l | 5 +++++ lib/defun_lex.l | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/command_lex.l b/lib/command_lex.l index 0d6e6ee7e5..3b18b58a2e 100644 --- a/lib/command_lex.l +++ b/lib/command_lex.l @@ -22,6 +22,11 @@ * 02111-1307, USA. */ +%top{ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +} %{ /* ignore flex generated code in static analyzer */ #ifndef __clang_analyzer__ diff --git a/lib/defun_lex.l b/lib/defun_lex.l index d901c26a2e..6c0805a4fa 100644 --- a/lib/defun_lex.l +++ b/lib/defun_lex.l @@ -1,4 +1,3 @@ -%{ /* * clippy (CLI preparator in python) C pseudo-lexer * Copyright (C) 2016-2017 David Lamparter for NetDEF, Inc. @@ -34,6 +33,12 @@ * code documentation in it. */ +%top{ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +} +%{ /* ignore harmless bugs in old versions of flex */ #pragma GCC diagnostic ignored "-Wsign-compare" #pragma GCC diagnostic ignored "-Wunused-value"