smcroute-2.5.5/0000755000175100001710000000000014146403363010366 500000000000000smcroute-2.5.5/m4/0000755000175100001710000000000014146403363010706 500000000000000smcroute-2.5.5/m4/misc.m40000644000175100001710000000142614146403320012017 00000000000000# Misc. helper macros AC_DEFUN([AC_CHECK_SUN_LEN],[ AC_MSG_CHECKING(for sun_len member in struct sockaddr_un) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[ #include ]],[[ struct sockaddr_un dummy; dummy.sun_len = 0; ]])],[ AC_DEFINE(HAVE_SOCKADDR_UN_SUN_LEN, 1, [Define if the struct sockaddr_un has a member sun_len on your OS]) AC_MSG_RESULT(yes)],[ AC_MSG_RESULT(no)]) ]) AC_DEFUN([AC_CHECK_SIN_LEN],[ AC_MSG_CHECKING(for sin_len member in struct sockaddr_in) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[ #include ]],[[ struct sockaddr_in dummy; dummy.sin_len = 0; ]])],[ AC_DEFINE(HAVE_SOCKADDR_IN_SIN_LEN, 1, [Define if the struct sockaddr_in has a member sin_len on your OS]) AC_MSG_RESULT(yes)],[ AC_MSG_RESULT(no)]) ]) smcroute-2.5.5/m4/mroute.m40000644000175100001710000000632214146403320012377 00000000000000# Macros to probe for multicast headers and IPv4/IPv6 support AC_DEFUN([AC_CHECK_MROUTE_HEADERS],[ AC_CHECK_HEADERS([linux/mroute.h linux/filter.h], [], [],[ #ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_NETINET_IN_H # include #endif #define _LINUX_IN_H /* For Linux <= 2.6.25 */ #include ]) AC_CHECK_HEADERS([netinet/ip_mroute.h], [], [],[ #ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_NETINET_IN_H # include #endif #ifdef HAVE_NET_ROUTE_H # include #endif ]) ]) AC_DEFUN([AC_CHECK_MROUTE],[ AC_CHECK_MROUTE_HEADERS() ]) AC_DEFUN([AC_CHECK_MROUTE6_HEADERS],[ AC_CHECK_HEADERS([linux/mroute6.h], [], [],[ #ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_NETINET_IN_H # include #endif ]) AC_CHECK_HEADERS([netinet6/ip6_mroute.h], [], [],[ #ifdef HAVE_NETINET_IN_H # include #endif #ifdef HAVE_SYS_PARAM_H # include #endif ]) ]) AC_DEFUN([AC_CHECK_MROUTE6],[ AC_CHECK_MROUTE6_HEADERS() AC_MSG_CHECKING(for IPv6 multicast host support) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[ #ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_NETINET_IN_H # include #endif ]],[[ struct ipv6_mreq mreq; ]])],[ AC_DEFINE(HAVE_IPV6_MULTICAST_HOST, 1, [Define if your OS supports acting as an IPv6 multicast host]) AC_MSG_RESULT(yes)],[ AC_MSG_RESULT(no)]) AC_MSG_CHECKING(for IPv6 multicast routing support) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[ #ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_NETINET_IN_H # include #endif #ifdef HAVE_LINUX_MROUTE6_H # include #endif #ifdef HAVE_SYS_PARAM_H # include #endif #ifdef HAVE_NETINET6_IP6_MROUTE_H # include #endif ]],[[ int dummy = MRT6_INIT; ]])],[ AC_DEFINE(HAVE_IPV6_MULTICAST_ROUTING, 1, [Define if your OS supports IPv6 multicast routing]) AC_MSG_RESULT(yes) enable_ipv6=yes],[ AC_MSG_RESULT(no) enable_ipv6=no]) AC_MSG_CHECKING(for vifc_rate_limit member in struct mif6ctl) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[ #ifdef HAVE_LINUX_MROUTE6_H # include #endif #ifdef HAVE_NETINET6_IP6_MROUTE_H # include #endif ]],[[ struct mif6ctl dummy; dummy.vifc_rate_limit = 1; ]])],[ AC_DEFINE(HAVE_MIF6CTL_VIFC_RATE_LIMIT, 1, [Define if the struct mif6ctl has a member vifc_rate_limit on your OS]) AC_MSG_RESULT(yes)],[ AC_MSG_RESULT(no)]) AC_MSG_CHECKING(for vifc_threshold member in struct mif6ctl) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[ #ifdef HAVE_LINUX_MROUTE6_H #include #endif #ifdef HAVE_NETINET6_IP6_MROUTE_H #include #endif ]],[[ struct mif6ctl dummy; dummy.vifc_threshold = 1; ]])],[ AC_DEFINE(HAVE_MIF6CTL_VIFC_THRESHOLD, 1, [Define if the struct mif6ctl has a member vifc_threshold on your OS]) AC_MSG_RESULT(yes)],[ AC_MSG_RESULT(no)]) ]) smcroute-2.5.5/smcroute.default0000755000175100001710000000003014146403320013502 00000000000000SMCROUTED_OPTS=-l debug smcroute-2.5.5/aclocal.m40000644000175100001710000014565214146403356012165 00000000000000# generated automatically by aclocal 1.16.1 -*- Autoconf -*- # Copyright (C) 1996-2018 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- dnl serial 11 (pkg-config-0.29.1) dnl dnl Copyright © 2004 Scott James Remnant . dnl Copyright © 2012-2015 Dan Nicholson dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA dnl 02111-1307, USA. dnl dnl As a special exception to the GNU General Public License, if you dnl distribute this file as part of a program that contains a dnl configuration script generated by Autoconf, you may include it under dnl the same distribution terms that you use for the rest of that dnl program. dnl PKG_PREREQ(MIN-VERSION) dnl ----------------------- dnl Since: 0.29 dnl dnl Verify that the version of the pkg-config macros are at least dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's dnl installed version of pkg-config, this checks the developer's version dnl of pkg.m4 when generating configure. dnl dnl To ensure that this macro is defined, also add: dnl m4_ifndef([PKG_PREREQ], dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) dnl dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], [m4_define([PKG_MACROS_VERSION], [0.29.1]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) dnl ---------------------------------- dnl Since: 0.16 dnl dnl Search for the pkg-config tool and set the PKG_CONFIG variable to dnl first found in the path. Checks that the version of pkg-config found dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is dnl used since that's the first version where most current features of dnl pkg-config existed. AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])dnl PKG_PROG_PKG_CONFIG dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------------------------------- dnl Since: 0.18 dnl dnl Check to see whether a particular set of modules exists. Similar to dnl PKG_CHECK_MODULES(), but does not set variables or print errors. dnl dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) dnl only at the first occurence in configure.ac, so if the first place dnl it's called might be skipped (such as if it is within an "if", you dnl have to call PKG_CHECK_EXISTS manually AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) dnl --------------------------------------------- dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting dnl pkg_failed based on the result. m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])dnl _PKG_CONFIG dnl _PKG_SHORT_ERRORS_SUPPORTED dnl --------------------------- dnl Internal check to see if pkg-config supports short errors. AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])dnl _PKG_SHORT_ERRORS_SUPPORTED dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl -------------------------------------------------------------- dnl Since: 0.4.0 dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES might not happen, you should be sure to include an dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 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]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])dnl PKG_CHECK_MODULES dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl --------------------------------------------------------------------- dnl Since: 0.29 dnl dnl Checks for existence of MODULES and gathers its build flags with dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags dnl and VARIABLE-PREFIX_LIBS from --libs. dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to dnl include an explicit call to PKG_PROG_PKG_CONFIG in your dnl configure.ac. AC_DEFUN([PKG_CHECK_MODULES_STATIC], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl _save_PKG_CONFIG=$PKG_CONFIG PKG_CONFIG="$PKG_CONFIG --static" PKG_CHECK_MODULES($@) PKG_CONFIG=$_save_PKG_CONFIG[]dnl ])dnl PKG_CHECK_MODULES_STATIC dnl PKG_INSTALLDIR([DIRECTORY]) dnl ------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable pkgconfigdir as the location where a module dnl should install pkg-config .pc files. By default the directory is dnl $libdir/pkgconfig, but the default can be changed by passing dnl DIRECTORY. The user can override through the --with-pkgconfigdir dnl parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, [with_pkgconfigdir=]pkg_default) AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_INSTALLDIR dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) dnl -------------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable noarch_pkgconfigdir as the location where a dnl module should install arch-independent pkg-config .pc files. By dnl default the directory is $datadir/pkgconfig, but the default can be dnl changed by passing DIRECTORY. The user can override through the dnl --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([noarch-pkgconfigdir], [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, [with_noarch_pkgconfigdir=]pkg_default) AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_NOARCH_INSTALLDIR dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------- dnl Since: 0.28 dnl dnl Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl _PKG_CONFIG([$1], [variable="][$3]["], [$2]) AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])dnl PKG_CHECK_VAR # Copyright (C) 2002-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.16.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.16.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. Try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking is enabled. # This creates each '.Po' and '.Plo' makefile fragment that we'll need in # order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR smcroute-2.5.5/config.h.in0000644000175100001710000001623114146403357012337 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to enable support for libcap. */ #undef ENABLE_LIBCAP /* Enable IPv4 multicast router discovery protocol */ #undef ENABLE_MRDISC /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H /* Define to 1 if you have the `asprintf' function. */ #undef HAVE_ASPRINTF /* Define to 1 if you have the `atexit' function. */ #undef HAVE_ATEXIT /* Define to 1 if you have the `dup2' function. */ #undef HAVE_DUP2 /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK /* Define to 1 if you have the header file. */ #undef HAVE_GLOB_H /* Define to 1 if you have the header file. */ #undef HAVE_IFADDRS_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define if your OS supports acting as an IPv6 multicast host */ #undef HAVE_IPV6_MULTICAST_HOST /* Define if your OS supports IPv6 multicast routing */ #undef HAVE_IPV6_MULTICAST_ROUTING /* Define to 1 if you have libsystemd-dev */ #undef HAVE_LIBSYSTEMD /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_FILTER_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_MROUTE6_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_MROUTE_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_SOCKIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Define if the struct mif6ctl has a member vifc_rate_limit on your OS */ #undef HAVE_MIF6CTL_VIFC_RATE_LIMIT /* Define if the struct mif6ctl has a member vifc_threshold on your OS */ #undef HAVE_MIF6CTL_VIFC_THRESHOLD /* Define to 1 if you have the header file. */ #undef HAVE_NETINET6_IP6_MROUTE_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_VAR_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IP_MROUTE_H /* Define to 1 if you have the header file. */ #undef HAVE_NET_IF_H /* Define to 1 if you have the header file. */ #undef HAVE_NET_ROUTE_H /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define if the struct sockaddr_in has a member sin_len on your OS */ #undef HAVE_SOCKADDR_IN_SIN_LEN /* Define if the struct sockaddr_un has a member sun_len on your OS */ #undef HAVE_SOCKADDR_UN_SUN_LEN /* Define to 1 if you have the `socket' function. */ #undef HAVE_SOCKET /* Define if the SOCK_CLOEXEC flag is supported */ #undef HAVE_SOCK_CLOEXEC /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strlcat' function. */ #undef HAVE_STRLCAT /* Define to 1 if you have the `strlcpy' function. */ #undef HAVE_STRLCPY /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR /* Define to 1 if you have RFC 3678 struct group_req */ #undef HAVE_STRUCT_GROUP_REQ /* Define to 1 if you have a Linux-style struct ip_mreqn */ #undef HAVE_STRUCT_IP_MREQN /* Define to 1 if you have the header file. */ #undef HAVE_SYSLOG_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_CAPABILITY_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PRCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the `tempfile' function. */ #undef HAVE_TEMPFILE /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `utimensat' function. */ #undef HAVE_UTIMENSAT /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK /* Define to 1 if you have the header file. */ #undef HAVE_VFORK_H /* Define to 1 if `fork' works. */ #undef HAVE_WORKING_FORK /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Version number of package */ #undef VERSION /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE /* Define for Solaris 2.5.1 so the uint32_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ #undef _UINT32_T /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to `int' if does not define. */ #undef pid_t /* Define to the type of an unsigned integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ #undef uint32_t /* Define as `fork' if `vfork' does not work. */ #undef vfork smcroute-2.5.5/ChangeLog.md0000644000175100001710000006321014146403320012452 00000000000000ChangeLog ========= All notable changes to the project are documented in this file. [v2.5.5][] - 2021-11-21 ----------------------- ### Changes - Revert extraction of version from GIT tag. Incompatible with systems that do `autoreconf` on a dist. tarball ### Fixes - Fix #175: Parse error in `/etc/smcroute.conf`. SMCRoute fails to start on interfaces with `mrdisc` disabled, when built with mrdisc support and `-N` passed on command line [v2.5.4][] - 2021-11-13 ----------------------- ### Changes - Automatically extract new version from GIT tag ### Fixes - Avoid trying to delete inactive VIFs. Fixing an annoying bogus error: *"Failed deleting VIF for iface lo: Resource temporarily unavailable"* - Fix #171: too small string buffer for IPv6 address causing garbled output in periodic expiry callback - Fix too small buffer for IPv6 address in mroute display functions [v2.5.3][] - 2021-09-23 ----------------------- ### Changes - New tests to verify add/del of IPv4/IPv6 routes in kernel MFC ### Fixes - Fix #166: build warning with gcc 10.2.1: "comparison is always true due to limited range of data type" - Fix build warning with `--disable-mrdisc` configure option - Fix #167: cannot remove routes added with `smcroutectl add`, only affects add/del at runtime with smcroutectl, not .conf reload - Fix #168: build problem on Debian/kFreeBSD, used wrong queue.h [v2.5.2][] - 2021-08-27 ----------------------- ### Changes - Allow installing routes with no outbound interfaces - Reinitialize VIFs on reload in case of new interfaces - Handle cases when interfaces change ifindex, i.e. they've first been removed and then re-added with the same name ### Fixes - Fix VIF leak when deleting interfaces with MRDISC enabled - Fix handling when an (S,G) moves to another IIF. This fixes issues where the SMCRoute kernel cache was out of sync with the kernel MFC - Fix handling of lost/disabled interfaces at reload. This fixes a couple of issues where routes were not updated properly at runtime - Update interface flags on reload, this fixes issues when SMCRoute failed to detect interfaces that had their MULTICAST flag set or cleared at runtime . Skip `setsockopt()` for IPC sockets. This fixes warnings in syslog about failing to disable `MULTICAST_LOOP` and `MULTICAST_ALL` [v2.5.1][] - 2021-08-22 ----------------------- ### Changes - Add .sha256 checksum to dist files, useful for packagers ### Fixes - Fix #155: systemd Notify integration, restore `NotifyAccess=main` - Fix #165: ftbfs on older compilers, e.g. gcc 4.8.3, use -std=gnu99 - Fix Documentation refs in systemd unit file, new man pages [v2.5.0][] - 2021-08-19 ----------------------- **Highlights:** native `/etc/smcroute.d/*.conf` support and seamless update/removal of routes and groups by reloading `.conf` files or using `smcroutectl`. Tested on Linux 5.11 and FreeBSD 12.2 ### Changes - Fully automated test suite with 15 tests covering many use cases - Support for `/etc/smcroute.d/*.conf`, issue #103 - Support for applying changes to `.conf` files without disturbing established flows -- i.e., seamless addition or removal of outbound interfaces in existing rules, or add/remove routes, without ever affecting other routes, issue #103 - Support for route replacement/update `smcroutectl`, issue #115 - Full `(*,G)` wildcard route matching, for IPv4 and IPv6, issue #31 - Variant wildcard route matching with source and group range matching. This may of course waste a lot of resources, so handle with care: - `(*,G/LEN)`, issue #135 (IPv4), and issue #162 (IPv6) - `(S/LEN,G)`, issue #81 - `(S/LEN,G/LEN)` - Full SSM/ASM group join support, for both IPv4 and IPv6. Including joining group ranges from both `smcroutectl` and `.conf`, issue #118 Please note, no SSM support on FreeBSD, only Linux - New command line option, `-F file.conf` to verify file syntax, issue #100 - The `-I NAME` command line option has changed to `-i NAME`, compat support for the previous option remains - The `mrdisc` flag to the `phyint` directive is now what solely controls the functionality per interface. Previously a mechanism to enable/disable the functionality (if enabled) if active routes were in place. However, this did not cover `(*,G)` routes so that has been removed to simplify and guarantee full function - Output format from `smcroutectl` has been extensively changed. E.g, new `/LEN` support means wider columns, but heading have also changed - The `.tar.xz` archive has been has been dropped as distribution format, keeping only `tar.gz` ### Fixes - Fix #120: failed ASM/SSM IGMP join if interface has no address - Fix #130: dynamic IPv6 routes are not flushed (like IPv4 `(*,G)`) - Fix #149: `(*,G)` cache timeout callback stops, or never starts - Fix #151: same log entries - Fix #156: `smcruotectl show` does not show IPv6 routes - Fix stochastic timer behavior, e.g. mrdisc announcements experienced interference with the `(*,G)` cache timer [v2.4.4][] - 2019-02-11 ----------------------- ### Changes - Allow same outbound interface as inbound for routes, only warn user - systemd unit file hardening, recommended by Debian - Discontinued GPG signing, unused and signed with only one dev key ### Fixes - Fix #104: IGMP header checksum missing from mrdisc frames - Fix #105: Unblock *all* matching, and currently blocked, (S,G) to a newly installed (*,G) route, only the first know was unblocked - Fix #106: Timer nanosecond bug causing loss of address refresh on DHCP interfaces. Interface monitoring feature introduced in v2.4.3 - Fix #108: Calling init script with `stop` does not stop `smcrouted` - Fix #109: ifindex in UNIX/POSIX is an interger, not unsigned short [v2.4.3][] - 2018-11-06 ----------------------- The Lyon release. ### Changes - Add `strlcat()` replacement from OpenBSD, use instead of `strcat()` - `smcrouted` should never log to system console, proposed by Westermo ### Fixes - `smcrouted` fails to join multicast groups on interfaces that do not yet have an IP address when `smcrouted` starts up, or when it receives `SIGHUP`, e.g. DHCP client interfaces. This patch release adds a timer refresh of interface addresses that retries multicast group joins until an address is set. This is similar to issue #55, but does not handle interfaces that do not exist yet - Make sure Linux alias interfaces (baseif:num) are registered as baseif. Westermo found that use of alias interfaces cause multiple VIFs to be registered for the same base interface causing multicast routes to use the wrong inbound or outbound VIF. Alias interfaces use the same underlying physical interface so only one VIF needed - Fix display of route counters and column alignment - Minor spelling fixes, found by Debian - Add missing status command to SysV init script, found by Debian - Simplify `utimensat()` replacement, `AT_SYMLINK_NOFOLLOW` unused [v2.4.2][] - 2018-09-09 ----------------------- ### Changes - Add wrapper script `smcroute` for use with old style startup scripts - Add symlinks to man pages for `smcrouted.8 and` `smcroutectl.8` - Update SysV init script, daemon now called `smcrouted` ### Fixes - Fix #96: A `.conf` line may be missing final newline, this is fine - Spellcheck `smcroute.conf` example - Fix Lintian warning (Debian) for unbreakable line in man page [v2.4.1][] - 2018-06-16 ----------------------- ### Changes - Update and spellecheck documentation and example `.conf` file ### Fixes - Fix #91: Allow re-configuration of unprivileged `smcrouted`. Courtesy of Marcel Patzlaff [v2.4.0][] - 2018-02-11 ----------------------- ### Changes - Interface wildcard support, Linux `iptables` like syntax, `eth+` matches `eth0`, `eth1`, `eth32`. It can be used where an interface name is used: `phyint`, `mroute`, `mgroup`, and even on the command line to `smcroutectl`. Contributed by Martin Buck - Disable IPv4 [mrdisc][] by default, enable per `phyint` in the `.conf` file instead. When *not* started with `smcrouted -N` mrdisc would otherwise be enabled on *all* interfaces found at startup - Minor doc updates, e.g. clarify need for root or `CAP_NET_ADMIN` including some minor man page fixes ### Fixes - Fix #75: Not possible to remove (*,G) routes using `smcroutectl` - Fix #76: When removing a kernel route, also remove from internal lists otherwise route is shown in `smcroutectl show`. Conversely, adding a route to internal list shall only be done after successful kernel add - Fix #77: Counter overflow due to wrong type used in `smcroutectl show` - Fix #78: Document interface wildcard feature - Fix #80: `smcroutectl` argument parser fixes by Pawel Rozlach - Fix #84: Check return value of `sigaction()` - Fix #85: Signal handling is async-signal-unsafe - Fix #86: Document how to use `iptables` on Linux to modify TTL - Fix #87: Possible buffer overrun in `ipc_receive()` - Fix #89: Adding similar (S,G) route should replace existing one if inbound interface differs [v2.3.1][] - 2017-06-13 ----------------------- Bug fix release courtesy of the Westermo WeOS automated testing framework. Many thanks to Johan Askerin at Westermo for working on integrating SMCRoute v2.3 into WeOS v4.22! ### Changes - Add `utimensat()` replacement for systems that don't have it - Ignore error messages from `send()` on interface link down ### Fixes - Fix build error(s) on FreeBSD 9/9.3-RELEASE - Fix possible invalid interface name reference in new mrdisc support - Fix log macro bug in the .conf parser - Fix buggy interface and VIF re-initialization on `SIGHUP` [v2.3.0][] - 2017-05-28 ----------------------- ### Changes - Support GROUP/LEN matching for IPv4 (*,G) routes - Support for IPv4 [mrdisc][], [RFC4286][] - Support for multiple routing tables on Linux, `-t ID` - `ssmgroup` code folded into general code, now with optional source - Separation of daemon and client into `smcrouted` and `smcroutectl` - Complete new client user interface, `smcroutectl` - Support for disabling IPC and client, `--disable-client` - Support for disabling `.conf` file support, `--disable-config` - Show multicast routes and joined groups in client, including stats: `smcroutectl show [groups|routes]` - Support for `-d SEC` startup delay in `smcrouted` - Unknown (*,G) multicast now blocked by default - Flush timer, `-c SEC`, for (*,G) routes now enabled by default, 60 sec - Build ID removed from `configure` script - Massive code cleanup, refactor and separation into stand-alone modules - Default system paths are no longer taken from `/usr/include/paths.h`, instead the settings from `configure --prefix` are used - Use of `libcap` for privilige separation is now auto-detected ### Fixes - Allow use of loopback interface for multicast routes - Fix IPv4-only build, by Martin Buck - Fix IPv4 network interface address identification, by Martin Buck - Support unlimited number of network interfaces, by Martin Buck [v2.2.2][] - 2017-02-02 ----------------------- ### Changes - New client command, `-F`, for immediately flushing dynamically learned (*,G) routes from the cache. ### Fixes - Fix issue #51: New cache flush timeout option causes endless `select()` loop. Reported by Ramon Fried, @mellowcandle [v2.2.1][] - 2017-01-09 ----------------------- ### Changes - Add support for a new command line option, `-c SEC`, for timing out dynamically learned (*,G) routes. Issue #17 ### Fixes - Portability, replace use of non-std `__progname` with small function - Issue #49: systemd unit file missing `-d` to start daemon [v2.2.0][] - 2016-12-03 ----------------------- ### Changes - Support for dropping root privileges after opening the multicast routing socket and creating the PID file - Support for Source Specific Multicast group subscription (only IPv4) - Support for systemd, service file included and installed by default ### Fixes - Remove GNUisms to be able to build and run on Alpine Linux (musl libc) - Add OpenBSD `queue.h` for systems that do not have any *BSD `sys/queue.h` - Coding style cleanup and minor refactor [v2.1.1][] - 2016-08-19 ----------------------- ### Changes - When `SIGHUP` is received SMCRoute now touches its PID file as an acknowledgement. This is used by some process supervision daemons, like [Finit](https://github.com/troglobit/finit), on system configuration changes to detect when a daemon is done. The mtime is set using the `utimensat()` function to ensure nanosecond resolution. ### Fixes - Fix issue #38: Minor memory leak at exit. The Valgrind tool warns that all memory is not freed when smcroute exits. On most modern UNIX systems, on platforms with MMU, this is not a problem, but on older systems, or uClinux, memory is not freed at program exit. - Fix issue #39: Removing wildcard route at runtime does not work if no kernel routes have been set. - Fix issue #44: IPv6 disabled by default, despite what `configure` says in its help text. Enabling it disables it ... fixed by enabling IPv6 by default. [v2.1.0][] - 2016-02-17 ----------------------- ### Changes - Allow more interfaces to be used for multicast routing, in particular on Linux, where interfaces without an IP address can now be used! Making it possible to run SMCRoute on DHCP/PPP interaces, issue #13 - Add support for TTL scoping on interfaces, very useful for filtering multicast without a firewall: `phyint IFNAME ttl-threshold TTL` - On Linux a socket filter now filters out ALL traffic on the helper sockets where SMCRoute does IGMP/MLD join/leave on multicast groups. This should eliminate the extra overhad required to, not only route streams, but also send a copy of each packet to SMCRoute. - Add support for limiting the amount of multicast interfaces (VIFs) SMCRoute creates at startup. Two options are now available, by default all multicast capable interfaces are given a VIF and the user can selectively disable them one by one. However, if the `-N` command line option is given SMCRoute does *not* enable any VIFs by default, the user must then selectively enable interface one by one. The syntax in the config file is: phyint IFNAME Use `enable` per interface with `-N` option, or `disable` by default. - Make build ID optional. SMCRoute has always had the build date hard coded in the binary. This change makes this optional, and defaults to disabled, to facilitate reproducible builds. For more info, see https://wiki.debian.org/ReproducibleBuilds - Remove generated files from GIT. Files generated by GNU autotools are now only part of the distribution archive, not the GIT repository. Use `./autogen.sh` to create the required files when using GIT. - Updated man page and example `smcroute.conf` with limitations on the amount of mgroup rules. - Add support for executing an external script on config reload and when installing a multicast route. Issue #14 smcroute -e /path/to/cmd The script is called when SMCRoute has started up, or has received `SIGHUP` and just reloaded the configuration file, and when a new source-less rule have been installed. See the documentation for more information on set environment variables etc. Issue #14 - Add `--disable-ipv6` option to `configure` script. Disables IPv6 support in SMCRoute even though the kernel may support it - Replaced `-D` option with `-L LVL` to alter log level, issue #24 - The smcroute daemon now behaves more like a regular UNIX daemon. It defaults to using syslog when running in the background and stderr when running in the foreground. A new option `-s` can be used to enable syslog when running in the foreground, issue #25 - The smcroute client no longer use syslog, only stderr, issue #25 - When starting the smcroute daemon it is no longer possible to also send client commands on the same command line. - Remove the (unmaintained) in-tree `mcsender` tool. Both ping(8) and iperf(1) can be used in its stead. The omping(8) tool is another tool, engineered specifically for testing multicast. Issue #30 ### Fixes - Fix issue #10: `smcroute` client loops forever on command if no `smcroute` daemon is running - Install binaries to `/usr/sbin` rather than `/usr/bin`, regression introduced in [v2.0.0][]. Fixed by Micha Lenk - Cleanup fix for no-MMU systems. Multicast groups were not properly cleaned up in the `atexit()` handler -- *only* affects no-MMU systems. - Do not force automake v1.11, only require *at least* v.11 - SMCRoute operates fine without a config file, so use a less obtrusive warning message for missing `/etc/smcroute.conf` [v2.0.0][] - 2014-09-30 ----------------------- ### Changes - Migrate to full GNU Configure and Build system, add Makefile.am, GitHub issue #6 -- heads up, packagers! - Add standard SysV init script, from Debian. GitHub issue #9 ### Fixes - Multiple fixes of nasty bugs thanks to Coverity static code analysis! - Cleanup of Linux system anachronisms to make FreeBSD work again, GitHub issue #5 [v1.99.2][] - 2013-07-16 ------------------------ ### Fixes * Fix issue #2: Loop forever bug when deleting new (*,G) sourceless routes Bug report and patch by Jean-Baptiste Maillet [v1.99.1][] - 2013-07-11 ------------------------ ### Fixes - Fix possible memory leak on Linux - Fix missing #ifdefs when building on systems w/o IPv6 - Fix possible race in Makefile when building in (massive) parallel - Fix build problems on RedHat EL5/CentOS5, i.e., Linux <= 2.6.25 [v1.99.0][] - 2012-05-13 ------------------------- ### Changes - Feature: Experimental source-less `(*,G)` IPv4 multicast routing. Most UNIX kernels are (S,G) based, i.e., you need to supply the source address with the multicast group to setup a kernel routing rule. However, daemons like mrouted and pimd emulate `(*,G)` by listening for IGMPMSG_NOCACHE messages from the kernel. SMCRoute now also implements this, for IPv4 only atm, by placing all `(*,G)` routes in a list and adding matching (S,G) routes on-demand at runtime. All routes matching this (*,G) are removed when reloading the conf file on SIGHUP or when the user sends an IPC (-r) command to remove the (*,G) rule. ### Fixes - Bugfix: SMCRoute segfaults when starting on interface that is up but has no valid IPv4 address yet. Bug introduced in 1.98.3 - Improved error messages including some minor cleanup and readability improvements - Bugfix: Actually check if running as root at startup [v1.98.3][] - 2011-11-05 ------------------------ ### Changes - Check for existence of `asprintf()` to `pidfile()` and add `-D_GNU_SOURCE` to `CPPFLAGS` using `AC_GNU_SOURCE` in `configure.ac` - Cleanup IPv6 `#ifdefs` and replace `IN6_MULTICAST()` with standard `IN6_IS_ADDR_MULTICAST()`. This commit cleans up a lot of the IPv6 related `#ifdefs`, some minor function name refactoring and squash of some `_init` and `_enable` funcs into one for clarity and clearer error messages to the user ### Fixes - Fixes FTBFS when host lacks IPv6 support. [v1.98.1][] - 2011-11-05 ------------------------ ### Fixes - Bugfix: Client failed to send commands to daemon. - Bugfix: Several FTBFS fixed for GCC 4.6.x and -W -Wall [v1.98.0][] - 2011-11-04 ------------------------ SMCRoute2 Announced! ### Changes - Feature: Support for `smcroute.conf` configuration file for daemon. Add support for reading multicast routes and multicast groups from a configuration file. mgroup from IFNAME group MCGROUP mroute from IFNAME source ADDRESS group MCGROUP to IFNAME [IFNAME ...] Both IPv4 and IPv6 address formats are supported - Feature: Support for signals, reload conf file on `SIGHUP` - Feature: Add -n switch to support running smcroute in foreground. - Refactor: Insecure handling of pointers potentially outside array boundaries. - Refactor: Major cleanup, reindent to Linux C-style, for improved maintainability. ### Fixes - Bugfix: Invalid use of varargs in call to `snprintf()`, use `vsnprintf()` instead - Bugfix: Invalid `MRouterFD6` fd crashes smcroute, always check for valid fd - Bugfix: Several minor bugfixes; type mismatches and unused return values [v0.95][] - 2011-08-08 ---------------------- ### Changes - Feature request #313278: Added support for FreeBSD SMCRoute now builds and runs on FreeBSD kernels. This was successfully tested with the FreeBSD port of Debian using FreeBSD 8.1. Other BSD flavours or versions might work too. Any feedback is appreciated. https://alioth.debian.org/tracker/index.php?func=detail&aid=313278 - Feature request #313190: Debug logging is now disabled by default. If you want to enable debug logging again, start the daemon with parameter '-D'. https://alioth.debian.org/tracker/index.php?func=detail&aid=313190 [v0.94.1][] - 2010-01-13 ------------------------ ### Fixes - Bugfix: In case the kernel refuses write access to the file /proc/sys/net/ipv6/conf/all/mc_forwarding, don't let smcroute exit with an error, but proceed with normal operation without writing a "1" to this file. Apparently newer Linux kernels take care for the correct content of this file automatically whenever the IPv6 multicast routing API is initialized by a process. [v0.94][] - 2009-11-01 ---------------------- ### Changes - Added support for IPv6 multicast routing in smcroute. SMCRoute now supports addition and removal of IPv6 multicast routes. It will automatically detect which type of route to add or delete based on the type (IPv4/IPv6) of addresses provided for the add and remove commands. - Added support for joins and leaves ('j'/'l') to IPv6 multicast groups. - Added support for sending to IPv6 multicast addresses to mcsender tool. - Added command line option to mcsender tool to allow user to specify the outgoing interface for datagrams sent. - Added autoconf support for smcroute build. v0.93 - UNRELEASED ------------------ ### Fixes - Fixed the "smcroute looses output interfaces" bug. Carsten Schill, 0.93 unreleased v0.92 - July 2002 ----------------- ### Changes - Increased the number of supported interfaces The 16 interface limit of version 0.90 (interfaces as listed with ifconfig) was to small, especially when alias interfaces where defined. - up to 40 interfaces are no recognized by smcroute - this does not change the number of 'virtual interfaces' supported by the kernel (32) - not all interfaces recognized by smcroute (40) results in a 'virtual interface' of the kernel (32) ### Fixes - Fixed the 'mroute: pending queue full, dropping entries' error Smcroute 0.90 didn't care about the IGMP messages delivered to the UDP socket that establish the MC-Router API. After some time the queue for the sockets filled up and the 'pending queue full' message was send from the kernel. To my knowledge this didn't affect smcroute or the operating system. - version 0.92 reads the ICMP messages now from the UDP socket and logs them to syslog with daemon/debug - smcroute does no further processing of this messages v0.9 - September 2001 --------------------- ### Changes * Added MC group join (-j) and leave (-l) functionality - the options enable/disable the sending of IGMP join messages for a multicast group on a specific interface * Removed the ' [] ...' for the '-r' option - they are not used by the kernel to identify the route to remove - smcroute will not complain about extra arguments for the '-r' option to stay compatible with releases <= 0.80 * Improved error handling for some typical error situations * Added a test script (tst-smcroute.pl) * Added a man page ### Fixes * Fixed some minor bugs v0.8 - August 2001 ------------------ Initial public release by Carsten Schill. [mrdisc]: https://github.com/troglobit/mrdisc [RFC4286]: https://tools.ietf.org/html/rfc4286 [UNRELEASED]: https://github.com/troglobit/smcroute/compare/2.5.5...HEAD [v2.5.5]: https://github.com/troglobit/smcroute/compare/2.5.4...2.5.5 [v2.5.4]: https://github.com/troglobit/smcroute/compare/2.5.3...2.5.4 [v2.5.3]: https://github.com/troglobit/smcroute/compare/2.5.2...2.5.3 [v2.5.2]: https://github.com/troglobit/smcroute/compare/2.5.1...2.5.2 [v2.5.1]: https://github.com/troglobit/smcroute/compare/2.5.0...2.5.1 [v2.5.0]: https://github.com/troglobit/smcroute/compare/2.4.4...2.5.0 [v2.4.4]: https://github.com/troglobit/smcroute/compare/2.4.3...2.4.4 [v2.4.3]: https://github.com/troglobit/smcroute/compare/2.4.2...2.4.3 [v2.4.2]: https://github.com/troglobit/smcroute/compare/2.4.1...2.4.2 [v2.4.1]: https://github.com/troglobit/smcroute/compare/2.4.1...2.4.1 [v2.4.0]: https://github.com/troglobit/smcroute/compare/2.3.1...2.4.0 [v2.3.1]: https://github.com/troglobit/smcroute/compare/2.3.0...2.3.1 [v2.3.0]: https://github.com/troglobit/smcroute/compare/2.2.2...2.3.0 [v2.2.2]: https://github.com/troglobit/smcroute/compare/2.2.1...2.2.2 [v2.2.1]: https://github.com/troglobit/smcroute/compare/2.2.0...2.2.1 [v2.2.0]: https://github.com/troglobit/smcroute/compare/2.1.1...2.2.0 [v2.1.1]: https://github.com/troglobit/smcroute/compare/2.1.0...2.1.1 [v2.1.0]: https://github.com/troglobit/smcroute/compare/2.0.0...2.1.0 [v2.0.0]: https://github.com/troglobit/smcroute/compare/1.99.2...2.0.0 [v1.99.2]: https://github.com/troglobit/smcroute/compare/1.99.1...1.99.2 [v1.99.1]: https://github.com/troglobit/smcroute/compare/1.99.0...1.99.1 [v1.99.0]: https://github.com/troglobit/smcroute/compare/1.98.3...1.99.0 [v1.98.3]: https://github.com/troglobit/smcroute/compare/1.98.2...1.98.3 [v1.98.2]: https://github.com/troglobit/smcroute/compare/1.98.1...1.98.2 [v1.98.1]: https://github.com/troglobit/smcroute/compare/1.98.0...1.98.1 [v1.98.0]: https://github.com/troglobit/smcroute/compare/0.95...1.98.0 [v0.95]: https://github.com/troglobit/smcroute/compare/0.94.1...0.95 [v0.94.1]: https://github.com/troglobit/smcroute/compare/0.94...0.94.1 [v0.94]: https://github.com/troglobit/smcroute/compare/0.94.1...0.95 smcroute-2.5.5/configure0000755000175100001710000066160414146403356012234 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for SMCRoute 2.5.5. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: https://github.com/troglobit/smcroute/issues about your $0: system, including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='SMCRoute' PACKAGE_TARNAME='smcroute' PACKAGE_VERSION='2.5.5' PACKAGE_STRING='SMCRoute 2.5.5' PACKAGE_BUGREPORT='https://github.com/troglobit/smcroute/issues' PACKAGE_URL='https://troglobit.com/smcroute.html' ac_unique_file="src/smcrouted.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_config_libobj_dir=lib ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS DOCDIR SBINDIR LIB_PTHREAD LIB_RT ENABLE_TEST_FALSE ENABLE_TEST_TRUE USE_LIBCAP_FALSE USE_LIBCAP_TRUE HAVE_LIBSYSTEMD_FALSE HAVE_LIBSYSTEMD_TRUE DAEMON_TYPE HAVE_SYSTEMD_FALSE HAVE_SYSTEMD_TRUE systemddir libsystemd_LIBS libsystemd_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG USE_MRDISC_FALSE USE_MRDISC_TRUE LIBOBJS EGREP GREP CPP LN_S am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking enable_mrdisc enable_test enable_ipv6 with_libcap with_systemd ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR libsystemd_CFLAGS libsystemd_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures SMCRoute 2.5.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/smcroute] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of SMCRoute 2.5.5:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-mrdisc enable IPv4 multicast router discovery --enable-test enable tests, requries unshare, tshark, etc. --disable-ipv6 disable IPv6 support Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --without-libcap disable libcap, -p USER:GROUP drop-privs support --with-systemd=DIR Directory for systemd service files Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path libsystemd_CFLAGS C compiler flags for libsystemd, overriding pkg-config libsystemd_LIBS linker flags for libsystemd, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . SMCRoute home page: . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF SMCRoute configure 2.5.5 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## ----------------------------------------------------------- ## ## Report this to https://github.com/troglobit/smcroute/issues ## ## ----------------------------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_find_uintX_t LINENO BITS VAR # ------------------------------------ # Finds an unsigned integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by SMCRoute $as_me 2.5.5, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in aux "$srcdir"/aux; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in aux \"$srcdir\"/aux" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. am__api_version='1.16' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='smcroute' VERSION='2.5.5' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' ac_config_headers="$ac_config_headers config.h" ac_config_files="$ac_config_files Makefile man/Makefile src/Makefile test/Makefile smcroute.service" # Older versions of autoconf (<2.58) do not have AC_CONFIG_MACRO_DIR() # Misc. helper macros # Macros to probe for multicast headers and IPv4/IPv6 support # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 $as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 $as_echo "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # The pidfile() code needs asprintf(), which relies on -D_GNU_SOURCE ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= fi if test "$MINIX" = yes; then $as_echo "#define _POSIX_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h $as_echo "#define _MINIX 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_safe_to_define___extensions__=yes else ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h $as_echo "#define _ALL_SOURCE 1" >>confdefs.h $as_echo "#define _GNU_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) $as_echo "#define _UINT32_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint32_t $ac_cv_c_uint32_t _ACEOF ;; esac # Checks for library functions. ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi for ac_header in vfork.h do : ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" if test "x$ac_cv_header_vfork_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VFORK_H 1 _ACEOF fi done for ac_func in fork vfork do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_func_fork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 $as_echo_n "checking for working fork... " >&6; } if ${ac_cv_func_fork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_fork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* By Ruediger Kuhlmann. */ return fork () < 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_fork_works=yes else ac_cv_func_fork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 $as_echo "$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 $as_echo_n "checking for working vfork... " >&6; } if ${ac_cv_func_vfork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_vfork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include #ifdef HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; return ( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_vfork_works=yes else ac_cv_func_vfork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 $as_echo "$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then $as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h else $as_echo "#define vfork fork" >>confdefs.h fi if test "x$ac_cv_func_fork_works" = xyes; then $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h fi for ac_func in atexit dup2 memset select socket strchr strerror strrchr asprintf do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # Check for usually missing API's ac_fn_c_check_func "$LINENO" "strlcpy" "ac_cv_func_strlcpy" if test "x$ac_cv_func_strlcpy" = xyes; then : $as_echo "#define HAVE_STRLCPY 1" >>confdefs.h else case " $LIBOBJS " in *" strlcpy.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS strlcpy.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "strlcat" "ac_cv_func_strlcat" if test "x$ac_cv_func_strlcat" = xyes; then : $as_echo "#define HAVE_STRLCAT 1" >>confdefs.h else case " $LIBOBJS " in *" strlcat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS strlcat.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "tempfile" "ac_cv_func_tempfile" if test "x$ac_cv_func_tempfile" = xyes; then : $as_echo "#define HAVE_TEMPFILE 1" >>confdefs.h else case " $LIBOBJS " in *" tempfile.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS tempfile.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "utimensat" "ac_cv_func_utimensat" if test "x$ac_cv_func_utimensat" = xyes; then : $as_echo "#define HAVE_UTIMENSAT 1" >>confdefs.h else case " $LIBOBJS " in *" utimensat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS utimensat.$ac_objext" ;; esac fi # Check for sun_len in struct sockaddr_un and sin_len in sockaddr_in # These are used on *BSD UNIX and don't exist on Linux { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sun_len member in struct sockaddr_un" >&5 $as_echo_n "checking for sun_len member in struct sockaddr_un... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { struct sockaddr_un dummy; dummy.sun_len = 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : $as_echo "#define HAVE_SOCKADDR_UN_SUN_LEN 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sin_len member in struct sockaddr_in" >&5 $as_echo_n "checking for sin_len member in struct sockaddr_in... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { struct sockaddr_in dummy; dummy.sin_len = 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : $as_echo "#define HAVE_SOCKADDR_IN_SIN_LEN 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Check user options # Check whether --enable-mrdisc was given. if test "${enable_mrdisc+set}" = set; then : enableval=$enable_mrdisc; fi # Check whether --enable-test was given. if test "${enable_test+set}" = set; then : enableval=$enable_test; ac_enable_test="$enableval" else ac_enable_test="no" fi # Check whether --enable-ipv6 was given. if test "${enable_ipv6+set}" = set; then : enableval=$enable_ipv6; fi # Check whether --with-libcap was given. if test "${with_libcap+set}" = set; then : withval=$with_libcap; else with_libcap=auto fi # Check whether --with-systemd was given. if test "${with_systemd+set}" = set; then : withval=$with_systemd; else with_systemd=auto fi # Checks for header files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi for ac_header in arpa/inet.h fcntl.h glob.h ifaddrs.h linux/sockios.h net/if.h \ netinet/in.h netinet/in_var.h net/route.h sys/capability.h \ sys/ioctl.h sys/param.h sys/prctl.h sys/socket.h sys/stat.h \ sys/time.h sys/types.h syslog.h termios.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " #ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_NET_IF_H # include #endif #ifdef HAVE_NETINET_IN_H # include #endif " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Build w/ mrdisc support? if test "x$enable_mrdisc" = "xyes"; then : $as_echo "#define ENABLE_MRDISC 1" >>confdefs.h else enable_mrdisc=no fi if test "x$enable_mrdisc" = "xyes"; then USE_MRDISC_TRUE= USE_MRDISC_FALSE='#' else USE_MRDISC_TRUE='#' USE_MRDISC_FALSE= fi # Required to check for libsystemd-dev if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi # Check where to install the systemd .service file if test "x$PKG_CONFIG" = "x"; then : with_systemd=no { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find pkg-config tool, disabling systemd check." >&5 $as_echo "$as_me: WARNING: Cannot find pkg-config tool, disabling systemd check." >&2;} fi with_libsystemd=no if test "x$with_systemd" = "xyes" -o "x$with_systemd" = "xauto"; then : def_systemd=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) if test "x$def_systemd" = "x"; then : if test "x$with_systemd" = "xyes"; then : as_fn_error $? "systemd support requested but pkg-config unable to query systemd package" "$LINENO" 5 fi with_systemd=no else with_systemd="$def_systemd" fi fi if test "x$with_systemd" != "xno"; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libsystemd" >&5 $as_echo_n "checking for libsystemd... " >&6; } if test -n "$libsystemd_CFLAGS"; then pkg_cv_libsystemd_CFLAGS="$libsystemd_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd\""; } >&5 ($PKG_CONFIG --exists --print-errors "libsystemd") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_libsystemd_CFLAGS=`$PKG_CONFIG --cflags "libsystemd" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$libsystemd_LIBS"; then pkg_cv_libsystemd_LIBS="$libsystemd_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd\""; } >&5 ($PKG_CONFIG --exists --print-errors "libsystemd") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_libsystemd_LIBS=`$PKG_CONFIG --libs "libsystemd" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then libsystemd_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsystemd" 2>&1` else libsystemd_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsystemd" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$libsystemd_PKG_ERRORS" >&5 true elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } true else libsystemd_CFLAGS=$pkg_cv_libsystemd_CFLAGS libsystemd_LIBS=$pkg_cv_libsystemd_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } with_libsystemd=yes fi systemddir=$with_systemd fi if test "x$with_systemd" != "xno"; then HAVE_SYSTEMD_TRUE= HAVE_SYSTEMD_FALSE='#' else HAVE_SYSTEMD_TRUE='#' HAVE_SYSTEMD_FALSE= fi if test "x$with_libsystemd" != "xno"; then : $as_echo "#define HAVE_LIBSYSTEMD 1" >>confdefs.h DAEMON_TYPE="Notify" else DAEMON_TYPE="Simple" fi if test "x$with_libsystemd" != "xno"; then HAVE_LIBSYSTEMD_TRUE= HAVE_LIBSYSTEMD_FALSE='#' else HAVE_LIBSYSTEMD_TRUE='#' HAVE_LIBSYSTEMD_FALSE= fi # Check if we need -lpthread (building statically) and -lrt (older GLIBC) # Unset cached values when retrying with -lpthread and reset LIBS for each API need_librt=no need_pthread=no old_LIBS=$LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 $as_echo_n "checking for library containing clock_gettime... " >&6; } if ${ac_cv_search_clock_gettime+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char clock_gettime (); int main () { return clock_gettime (); ; return 0; } _ACEOF for ac_lib in '' rt; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_clock_gettime=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_clock_gettime+:} false; then : break fi done if ${ac_cv_search_clock_gettime+:} false; then : else ac_cv_search_clock_gettime=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 $as_echo "$ac_cv_search_clock_gettime" >&6; } ac_res=$ac_cv_search_clock_gettime if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" need_librt=yes fi LIBS=$old_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing timer_create" >&5 $as_echo_n "checking for library containing timer_create... " >&6; } if ${ac_cv_search_timer_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char timer_create (); int main () { return timer_create (); ; return 0; } _ACEOF for ac_lib in '' rt; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_timer_create=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_timer_create+:} false; then : break fi done if ${ac_cv_search_timer_create+:} false; then : else ac_cv_search_timer_create=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_timer_create" >&5 $as_echo "$ac_cv_search_timer_create" >&6; } ac_res=$ac_cv_search_timer_create if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" need_librt=yes else unset ac_cv_search_timer_create { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing timer_create" >&5 $as_echo_n "checking for library containing timer_create... " >&6; } if ${ac_cv_search_timer_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char timer_create (); int main () { return timer_create (); ; return 0; } _ACEOF for ac_lib in '' rt; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib -lpthread $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_timer_create=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_timer_create+:} false; then : break fi done if ${ac_cv_search_timer_create+:} false; then : else ac_cv_search_timer_create=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_timer_create" >&5 $as_echo "$ac_cv_search_timer_create" >&6; } ac_res=$ac_cv_search_timer_create if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" need_pthread=yes fi fi LIBS=$old_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing timer_settime" >&5 $as_echo_n "checking for library containing timer_settime... " >&6; } if ${ac_cv_search_timer_settime+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char timer_settime (); int main () { return timer_settime (); ; return 0; } _ACEOF for ac_lib in '' rt; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_timer_settime=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_timer_settime+:} false; then : break fi done if ${ac_cv_search_timer_settime+:} false; then : else ac_cv_search_timer_settime=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_timer_settime" >&5 $as_echo "$ac_cv_search_timer_settime" >&6; } ac_res=$ac_cv_search_timer_settime if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" need_librt=yes else unset ac_cv_search_timer_settime { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing timer_settime" >&5 $as_echo_n "checking for library containing timer_settime... " >&6; } if ${ac_cv_search_timer_settime+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char timer_settime (); int main () { return timer_settime (); ; return 0; } _ACEOF for ac_lib in '' rt; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib -lpthread $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_timer_settime=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_timer_settime+:} false; then : break fi done if ${ac_cv_search_timer_settime+:} false; then : else ac_cv_search_timer_settime=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_timer_settime" >&5 $as_echo "$ac_cv_search_timer_settime" >&6; } ac_res=$ac_cv_search_timer_settime if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" need_pthread=yes fi fi # Check for libcap to not trigger false positives on FreeBSD et al LIBS=$old_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing cap_set_flag" >&5 $as_echo_n "checking for library containing cap_set_flag... " >&6; } if ${ac_cv_search_cap_set_flag+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char cap_set_flag (); int main () { return cap_set_flag (); ; return 0; } _ACEOF for ac_lib in '' cap; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_cap_set_flag=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_cap_set_flag+:} false; then : break fi done if ${ac_cv_search_cap_set_flag+:} false; then : else ac_cv_search_cap_set_flag=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_cap_set_flag" >&5 $as_echo "$ac_cv_search_cap_set_flag" >&6; } ac_res=$ac_cv_search_cap_set_flag if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" else ac_cv_header_sys_capability_h=no fi LIBS=$old_LIBS # Check for RFC 3678-style struct group_req (Linux, FreeBSD, Solaris, macOS, AIX) ac_fn_c_check_member "$LINENO" "struct group_req" "gr_interface" "ac_cv_member_struct_group_req_gr_interface" "#include " if test "x$ac_cv_member_struct_group_req_gr_interface" = xyes; then : $as_echo "#define HAVE_STRUCT_GROUP_REQ 1" >>confdefs.h fi # Check for Linux-style extension struct ip_mreqn (Linux, FreeBSD) ac_fn_c_check_member "$LINENO" "struct ip_mreqn" "imr_ifindex" "ac_cv_member_struct_ip_mreqn_imr_ifindex" "#include " if test "x$ac_cv_member_struct_ip_mreqn_imr_ifindex" = xyes; then : $as_echo "#define HAVE_STRUCT_IP_MREQN 1" >>confdefs.h fi # Check for IPv4 support for ac_header in linux/mroute.h linux/filter.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " #ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_NETINET_IN_H # include #endif #define _LINUX_IN_H /* For Linux <= 2.6.25 */ #include " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in netinet/ip_mroute.h do : ac_fn_c_check_header_compile "$LINENO" "netinet/ip_mroute.h" "ac_cv_header_netinet_ip_mroute_h" " #ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_NETINET_IN_H # include #endif #ifdef HAVE_NET_ROUTE_H # include #endif " if test "x$ac_cv_header_netinet_ip_mroute_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NETINET_IP_MROUTE_H 1 _ACEOF fi done # If IPv6 is enabled we must probe the system some more if test "x$enable_ipv6" != "xno"; then : for ac_header in linux/mroute6.h do : ac_fn_c_check_header_compile "$LINENO" "linux/mroute6.h" "ac_cv_header_linux_mroute6_h" " #ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_NETINET_IN_H # include #endif " if test "x$ac_cv_header_linux_mroute6_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LINUX_MROUTE6_H 1 _ACEOF fi done for ac_header in netinet6/ip6_mroute.h do : ac_fn_c_check_header_compile "$LINENO" "netinet6/ip6_mroute.h" "ac_cv_header_netinet6_ip6_mroute_h" " #ifdef HAVE_NETINET_IN_H # include #endif #ifdef HAVE_SYS_PARAM_H # include #endif " if test "x$ac_cv_header_netinet6_ip6_mroute_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NETINET6_IP6_MROUTE_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IPv6 multicast host support" >&5 $as_echo_n "checking for IPv6 multicast host support... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_NETINET_IN_H # include #endif int main () { struct ipv6_mreq mreq; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : $as_echo "#define HAVE_IPV6_MULTICAST_HOST 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IPv6 multicast routing support" >&5 $as_echo_n "checking for IPv6 multicast routing support... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_NETINET_IN_H # include #endif #ifdef HAVE_LINUX_MROUTE6_H # include #endif #ifdef HAVE_SYS_PARAM_H # include #endif #ifdef HAVE_NETINET6_IP6_MROUTE_H # include #endif int main () { int dummy = MRT6_INIT; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : $as_echo "#define HAVE_IPV6_MULTICAST_ROUTING 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } enable_ipv6=yes else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } enable_ipv6=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for vifc_rate_limit member in struct mif6ctl" >&5 $as_echo_n "checking for vifc_rate_limit member in struct mif6ctl... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_LINUX_MROUTE6_H # include #endif #ifdef HAVE_NETINET6_IP6_MROUTE_H # include #endif int main () { struct mif6ctl dummy; dummy.vifc_rate_limit = 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : $as_echo "#define HAVE_MIF6CTL_VIFC_RATE_LIMIT 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for vifc_threshold member in struct mif6ctl" >&5 $as_echo_n "checking for vifc_threshold member in struct mif6ctl... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_LINUX_MROUTE6_H #include #endif #ifdef HAVE_NETINET6_IP6_MROUTE_H #include #endif int main () { struct mif6ctl dummy; dummy.vifc_threshold = 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : $as_echo "#define HAVE_MIF6CTL_VIFC_THRESHOLD 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi # Only enable support for dropping root privileges if auto/yes && header exists if test "x$with_libcap" != "xno" -a "x$ac_cv_header_sys_capability_h" = "xyes"; then : with_libcap=yes $as_echo "#define ENABLE_LIBCAP /**/" >>confdefs.h fi if test "x$with_libcap" != "xno" -a "x$ac_cv_header_sys_capability_h" = "xyes"; then USE_LIBCAP_TRUE= USE_LIBCAP_FALSE='#' else USE_LIBCAP_TRUE='#' USE_LIBCAP_FALSE= fi if test "x$ac_enable_test" != "xno"; then ENABLE_TEST_TRUE= ENABLE_TEST_FALSE='#' else ENABLE_TEST_TRUE='#' ENABLE_TEST_FALSE= fi # Mac OS does not (yet) support SOCK_CLOEXEC { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SOCK_CLOEXEC support" >&5 $as_echo_n "checking for SOCK_CLOEXEC support... " >&6; } if ${ac_cv_sock_cloexec+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_sock_cloexec=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main() { return socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, 0) == -1; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_sock_cloexec=yes else ac_cv_sock_cloexec=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sock_cloexec" >&5 $as_echo "$ac_cv_sock_cloexec" >&6; } if test "$ac_cv_sock_cloexec" = "yes" ; then : $as_echo "#define HAVE_SOCK_CLOEXEC 1" >>confdefs.h fi if test "$need_librt" != "no"; then : LIB_RT=-lrt fi if test "$need_pthread" != "no"; then : LIB_PTHREAD=-lpthread fi # Expand $sbindir early, into $SBINDIR, for systemd unit file # NOTE: This does *not* take prefix/exec_prefix override at "make # install" into account, unfortunately. test "x$prefix" = xNONE && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' SBINDIR=`eval echo $sbindir` SBINDIR=`eval echo $SBINDIR` DOCDIR=`eval echo $docdir` DOCDIR=`eval echo $DOCDIR` if test "x$ac_cv_header_sys_capability_h" = "xno"; then : if test "x$with_libcap" = "xyes"; then : as_fn_error $? "Cannot find libcap or its headers, install libcap-dev first. CentOS/RHEL 6: libcap is broken, recommended to disable it. Use --without-libcap to disable this feature." "$LINENO" 5 fi if test "x$with_libcap" = "xauto"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: As a safety measure, SMCRoute use libcap to drop root privs after startup. Install libcap and headers from libcap-dev, or similar, to enable this feature." >&5 $as_echo "$as_me: WARNING: As a safety measure, SMCRoute use libcap to drop root privs after startup. Install libcap and headers from libcap-dev, or similar, to enable this feature." >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: Use --without-libcap to disable this message." >&5 $as_echo "$as_me: Use --without-libcap to disable this message." >&6;} fi with_libcap=no fi # Workaround for as-of-yet unreleased runstatedir support, planned for # autoconf 2.70, which some major distros have backported. if test -z "$runstatedir"; then : runstatedir="$localstatedir/run" fi cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_MRDISC_TRUE}" && test -z "${USE_MRDISC_FALSE}"; then as_fn_error $? "conditional \"USE_MRDISC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_SYSTEMD_TRUE}" && test -z "${HAVE_SYSTEMD_FALSE}"; then as_fn_error $? "conditional \"HAVE_SYSTEMD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_LIBSYSTEMD_TRUE}" && test -z "${HAVE_LIBSYSTEMD_FALSE}"; then as_fn_error $? "conditional \"HAVE_LIBSYSTEMD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_LIBCAP_TRUE}" && test -z "${USE_LIBCAP_FALSE}"; then as_fn_error $? "conditional \"USE_LIBCAP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_TEST_TRUE}" && test -z "${ENABLE_TEST_FALSE}"; then as_fn_error $? "conditional \"ENABLE_TEST\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by SMCRoute $as_me 2.5.5, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to . SMCRoute home page: ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ SMCRoute config.status 2.5.5 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; "smcroute.service") CONFIG_FILES="$CONFIG_FILES smcroute.service" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. Try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi # Expand directories for configuration summary, unexpanded defaults: # sysconfdir => ${prefix}/etc # runstatedir => ${localstatedir}/run SYSCONFDIR=`eval echo $sysconfdir` RUNSTATEDIR=`eval echo $runstatedir` RUNSTATEDIR=`eval echo $RUNSTATEDIR` cat < [mrdisc] [ttl-threshold <1-255>] # mgroup from IIF [source ADDR[/LEN]] group GROUP[/LEN] # mroute from IIF [source ADDR[/LEN]] group GROUP[/LEN] to OIF [OIF ...] # include /path/to/*.conf # Assuming smcrouted was started with the `-N` flag. Enable interfaces # required for inbound and outbound traffic. TTL scoping is enabled on # all interfaces, e.g., to use eth0 as n outbound interface (OIF), all # multicast frames must have a TTL of 12 or greater when ingressing. phyint eth0 enable ttl-threshold 11 phyint eth1 enable ttl-threshold 3 phyint eth2 enable ttl-threshold 5 phyint virbr0 enable ttl-threshold 5 # Instruct the kernel to join the multicast group 225.1.2.3 on interface # eth0. Then add an mroute of the same multicast stream, from the host # 192.168.1.42 on interface eth0 and forward to eth1 and eth2. mgroup from eth0 group 225.1.2.3 mroute from eth0 source 192.168.1.42 group 225.1.2.3 to eth1 eth2 # Similarly, but using source-specific group join mgroup from virbr0 source 192.168.123.110 group 225.1.2.4 mroute from virbr0 source 192.168.123.110 group 225.1.2.4 to eth0 # Allow multicast for group 225.3.2.1, from ANY source, ingressing on # interface eth0 to be forwarded to eth1 and eth2. When the kernel # receives a frame from unknown multicast sender, it asks smcrouted who # use this "template" to match against, if the ingressing interface and # group matches, smcrouted installs an (S,G) route in the kernel MFC. mgroup from eth0 group 225.3.2.1 mroute from eth0 group 225.3.2.1 to eth1 eth2 # The previous is an example of the (*,G) support. It is also possible # to specify a range of such rules. mgroup from eth0 group 225.0.0.0/24 mroute from eth0 group 225.0.0.0/24 to eth1 eth2 # Include any snippet in /etc/smcroute.d/, but please remember that # all phyint statements must be read first. include /etc/smcroute.d/*.conf .Ed .Sh CAVEATS The source address is optional for both IPv4 and IPv6 multicast routes, this is called (*,G) routing. When omitted, .Nm smcrouted dynamically installs (S,G) routes, matching the group and inbound interface, to the kernel when it learns of new inbound multicast. This feature was inherited from .Xr mrouted 8 , and may not work as intended in all use-cases. Also, depending on kernel and CPU load, account for the setup time to detect and install the route, expect at least one initial frame to be lost when using (*,G) rules. .Sh FILES .Pa /etc/smcroute.conf , .Pa /etc/smcroute.d/*.conf .Sh SEE ALSO .Xr smcrouted 8 , .Xr smcroute.conf 5 .Sh AUTHORS .An -nosplit SMCRoute was originally created by .An Carsten Schill Aq Mt carsten@cschill.de . Initial IPv6 support by .An Todd Hayton Aq Mt todd.hayton@gmail.com . Initial FreeBSD support by .An Micha Lenk Aq Mt micha@debian.org . .Pp SMCRoute is currently maintained by .An Joachim Wiberg Aq Mt troglobit@gmail.com , and .An Micha Lenk Aq Mt micha@debian.org at .Lk https://github.com/troglobit/smcroute "GitHub" . smcroute-2.5.5/man/smcroutectl.80000644000175100001710000001454414146403320013517 00000000000000.\" -*- nroff -*- .Dd August 15, 2021 .Dt SMCROUTECTL 8 SMM .Os .Sh NAME .Nm smcroutectl .Nd Control and status tool for .Xr smcrouted 8 .Sh SYNOPSIS .Nm smcroutectl .Op Fl dptv .Op Fl i Ar NAME .Op Fl u Ar FILE .Op Ar COMMAND .Pp .Nm smcroutectl .Ao help | flush | kill | reload | version Ac .Nm smcroutectl .Ao show Ac .Op groups | routes .Nm smcroutectl .Ao add \ | \ \ rem Ac IIF Oo SOURCE Oc Ar GROUP[/LEN] OIF Op OIF ... .Nm smcroutectl .Ao join | leave Ac IIF Oo SOURCE Oc Ar GROUP[/LEN] .Sh DESCRIPTION .Nm is the control tool for .Xr smcrouted 8 . It can be used to query status, debug, modify the kernel multicast forwarding cache (MFC), manage group interface memberships, reload .Nm smcroute.conf , and kill a running .Nm smcrouted . .Sh OPTIONS The following .Nm options are available: .Bl -tag -width Ds .It Fl d Enable detailed output in show commands. .It Fl i Ar NAME Connect to an .Nm smcrouted instance that runs with another identity, .Ar NAME . .Pp This option is required for both .Nm smcrouted and .Nm smcroutectl when running multiple .Nm smcrouted instances, e.g., when using multiple routing tables, on Linux. .It Fl p Use plain table headings in .Cm show command output. No ANSI control characters are used, not even for probing screen width. .It Fl u Ar FILE UNIX domain socket path, used for the IPC between .Nm smcrouted and .Nm . Use this to override the default socket path, otherwise derived from the identity, .Fl i Ar NAME . This option can be useful when overriding the identity is not sufficient, e.g. for testing. The default depends on how .Nm is configured at build time, see .Sx FILES . .It Fl t Skip table headings entirely in .Cm show command output. .El .Sh OPERATION The .Ar IIF and .Ar OIF arguments in the below .Nm smcroutectl commands are the interface names, or interface wildcards of the form .Ar eth+ , which matches .Ar eth0 , eth10 , etc. Wildcards are available for both inbound and outbound interfaces. .Pp A multicast route is defined by an input interface .Ar IIF , the sender's unicast IP address .Ar SOURCE , which is optional, the multicast group .Ar GROUP and a list of, at least one, output interface .Ar OIF [OIF ...] . .Pp Please refer to .Xr smcrouted 8 for more details on the operation and how ASM/SSM multicast works. .Sh COMMANDS Commands can be abbreviated to the minimum unambiguous prefix; for example, .Cm s g for .Cm show groups . The following commands are available: .Bl -tag -width Ds .It Nm add Ar IIF [SOURCE[/LEN]] GROUP[/LEN] OIF [OIF ...] Add a new multicast route the the kernel MFC, or modify the outbound interfaces (OIF) an existing route. .Pp The arguments are, in order: .Ar IIF the inbound interface, .Ar SOURCE originating IP address (may need to be reachable in the unicast routing table to be allowed by the kernel reverse-path check), .Ar GROUP the multicast group address, and .Ar OIF Oo Ar OIF ... Oc the outbound network interface(s). .Pp The interfaces provided as .Ar IIF and .Ar OIF can be any multicast capable network interface as listed by .Ql Cm ifconfig or .Ql Cm ip link list , including tunnel interfaces and loopback. Provided .Nm smcrouted has "enumerated" them. See .Xr smcrouted 8 , in particular the command line option .Fl N , and the .Xr smcroute.conf 5 .Ql Cm phyint directive. .Pp To add a (*,G) route, either omit the .Ar SOURCE argument completely, or set it to .Ar 0.0.0.0 for IPv4, and if you want to specify a range of groups, use the .Ql GROUP/LEN modifier, e.g. .Ql 225.0.0.0/24 . .It Nm remove Ar IIF [SOURCE[/LEN]] GROUP[/LEN] [OIF [OIF ...]] Remove or modify the outbound interfaces of a multicast route in the kernel MFC. .Pp When no .Ar OIF argument is given, this command removes the entire route. With one or more .Ar OIF arguments, each outbound interface listed is removed. Skipping any unmatched or invalid interface names. When no more outbound interfaces exist, the route will have been transformed into a "stop filter". To remove the route entirely, the command must be given with no .Ar OIF arguments. .It Nm flush Flush dynamic (*,G) multicast routes now. Similar to how .Fl c Ar SEC works in .Nm smcrouted , this command initiates an immediate flush of all dynamically installed (*,G) multicast routes. Useful when a topology change has been detected and need to be propagated to .Nm smcrouted. .It Nm join Ar IIF [SOURCE[/LEN]] GROUP[/LEN] Join a multicast group, with an optional prefix length, on the given (inbound) interface. The source address is optional, but if given a source specific (SSM) join is performed. Note, joining groups is only ever necessary on the inbound interface, never on the outbound. Unless, two-way routing the same group. .Pp Note, as mentioned in .Xr smcrouted 8 , joining a group to open up traffic in layer-2 network switches is only a workaround to direct multicast towards SMCRoute. When routing lots of traffic it is advised to avoid this mechanism. Instead, use multicast router ports, or similar settings on the switches, or if they support multicast router discovery (MRDISC), see RFC4286. .It Nm leave Ar IIF [SOURCE[/LEN]] GROUP[/LEN] Leave a multicast group, with optional prefix length, on a given (inbound) interface. As with the join command, above, the source address is optional, but if the group was subscribed to with source it must be unsubscribed with source as well. .It Nm help [cmd] Print a usage information message. .It Nm kill Tell a running .Nm smcrouted to exit gracefully, same as .Ar SIGTERM . .It Nm reload Tell .Nm smcrouted to reload its configuration and activate the changes. Same as .Ar SIGHUP . Note, any routes or groups added or removed with .Nm smcroutectl will be lost. Only the configuration set in the file .Pa smcroute.conf is activated. .It Nm show [groups|routes] Show joined multicast groups or multicast routes, defaults to show routes. Can be combined with the .Fl d option to get details for each multicast route. .It Nm version Show program version and support information. .El .Sh SEE ALSO .Xr smcrouted 8 , .Xr smcroute.conf 5 .Sh AUTHORS .An -nosplit SMCRoute was originally created by .An Carsten Schill Aq Mt carsten@cschill.de . Initial IPv6 support by .An Todd Hayton Aq Mt todd.hayton@gmail.com . Initial FreeBSD support by .An Micha Lenk Aq Mt micha@debian.org . .Pp SMCRoute is currently maintained by .An Joachim Wiberg Aq Mt troglobit@gmail.com , and .An Micha Lenk Aq Mt micha@debian.org at .Lk https://github.com/troglobit/smcroute "GitHub" . smcroute-2.5.5/man/Makefile.in0000644000175100001710000003767014146403357013146 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = man ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/misc.m4 \ $(top_srcdir)/m4/mroute.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man5dir = $(mandir)/man5 am__installdirs = "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)" man8dir = $(mandir)/man8 NROFF = nroff MANS = $(dist_man5_MANS) $(dist_man8_MANS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(dist_man5_MANS) $(dist_man8_MANS) \ $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAEMON_TYPE = @DAEMON_TYPE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DOCDIR = @DOCDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PTHREAD = @LIB_PTHREAD@ LIB_RT = @LIB_RT@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ SBINDIR = @SBINDIR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libsystemd_CFLAGS = @libsystemd_CFLAGS@ libsystemd_LIBS = @libsystemd_LIBS@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ systemddir = @systemddir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ dist_man5_MANS = smcroute.conf.5 dist_man8_MANS = smcrouted.8 smcroutectl.8 all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign man/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-man5: $(dist_man5_MANS) @$(NORMAL_INSTALL) @list1='$(dist_man5_MANS)'; \ list2=''; \ test -n "$(man5dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man5dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man5dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.5[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \ done; } uninstall-man5: @$(NORMAL_UNINSTALL) @list='$(dist_man5_MANS)'; test -n "$(man5dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir) install-man8: $(dist_man8_MANS) @$(NORMAL_INSTALL) @list1='$(dist_man8_MANS)'; \ list2=''; \ test -n "$(man8dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man8dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man8dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.8[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ done; } uninstall-man8: @$(NORMAL_UNINSTALL) @list='$(dist_man8_MANS)'; test -n "$(man8dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) installdirs: for dir in "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man5 install-man8 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man5 uninstall-man8 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am distclean distclean-generic distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-man5 install-man8 \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am tags-am uninstall \ uninstall-am uninstall-man uninstall-man5 uninstall-man8 .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: smcroute-2.5.5/man/smcrouted.80000644000175100001710000004325314146403320013157 00000000000000.\" -*- nroff -*- .Dd August 15, 2021 .Dt SMCROUTED 8 SMM .Os .Sh NAME .Nm smcrouted .Nd SMCRoute, a static multicast router .Sh SYNOPSIS .Nm smcrouted .Op Fl nNhsv .Op Fl c Ar SEC .Op Fl d Ar SEC .Op Fl e Ar CMD .Op Fl f Ar FILE .Op Fl F Ar FILE .Op Fl i Ar NAME .Op Fl l Ar LVL .Op Fl m Ar SEC .Op Fl p Ar USER:GROUP .Op Fl P Ar FILE .Op Fl t Ar ID .Op Fl u Ar FILE .Sh DESCRIPTION .Nm is a static multicast routing daemon providing fine grained control over the multicast forwarding cache (MFC) in the UNIX kernel. Both IPv4 and IPv6 are fully supported. .Pp .Nm can be used as an alternative to dynamic multicast daemons like .Xr mrouted 8 , .Xr pimd 8 or .Xr pim6sd 8 in situations where static multicast routes should be maintained and/or no proper IGMP or MLD signaling exists. .Pp Multicast routes exist in the UNIX kernel only as long as a multicast routing daemon is running. On Linux, multiple multicast routers can run simultaneously using different multicast routing tables. To run .Nm and, .Nm mrouted at the same time, set the former to use a routing table other than the default (0). .Pp .Nm modifies the kernel routing table and needs either full .Ar superuser rights , or .Cm CAP_NET_ADMIN on Linux. This also applies to the friendly control tool .Xr smcroutectl 8 . .Ss Warning Be careful when creating multicast routes. You can easily flood your networks by inadvertently creating routing loops. Either direct loops listing an inbound interface also as an outbound, or indirect loops by going through other routers. .Sh OPTIONS The following command line options are available: .Bl -tag -width Ds .It Fl n Run daemon in foreground, do not detach from controlling terminal .It Fl N By default .Nm enables multicast routing on all available, and multicast capable, interfaces in the system. These interfaces are enumerated as VIFs, virtual interfaces, of which most UNIX systems have a very limited amount, usually 32. This daemon option inverts the behavior so no interfaces are enabled by default. Useful on systems with many interfaces, where multicast routing only makes use of a few. .Pp The config file setting .Ar phyint IFNAME enable is required to enable the required interfaces. .It Fl f Ar FILE Alternate configuration file, default .Pa /etc/smcroute.conf .It Fl F Ar FILE Check configuration file syntax, use .Fl l Ar LEVEL to increase verbosity. Returns non-zero on error. .It Fl c Ar SEC Flush unused dynamic (*,G) multicast routes every .Ar SEC seconds. .Pp This option is intended for systems with topology changes, i.e., when inbound multicast may change both interface and source IP address. E.g. in a setup with at least two VRRP routers. If there is no way of detecting such a topology change this option makes sure to periodically flush all dynamically learned multicast routes so that traffic may resume. Flushing of a specific route only occurs if it was unused during the last flush interval, i.e. there was no traffic matching it. This avoids toggling between different inbound interfaces if traffic arrives on several interfaces simultaneously. In this case, the first selected inbound interface is retained until traffic on it ceases. .Pp Default is 60 sec, set to 0 to disable. See also the .Cm smcroutectl flush command, which can be called manually on topology changes. .It Fl d Ar SEC Daemon startup delay. Delays the probe of interfaces and parsing of the configuration file. Note, the PID file is also not created, since the daemon is not ready yet. .Pp This command line option, although useful in some use-cases, is fragile. It is almost always better to rely on an init or process supervisor that handles dependencies properly, like .Xr finit 8 , which can wait for interfaces to come up and files to be created before starting a service. .It Fl e Ar CMD Specify external script or command to be called when .Nm has loaded/reloaded all static multicast routes from the configuration file, or when a source-less (ANY) rule has been installed. .It Fl i Ar NAME Set daemon identity. Used to create unique PID, IPC socket, and configuration file names, as well as set the syslog identity. E.g., .Fl I Ar foo would make .Nm look for .Cm /etc/foo.conf , write its PID to .Cm /var/run/foo.pid and create an IPC socket for .Nm smcroutectl in .Cm /var/run/foo.sock . .Pp For .Nm smcroutectl the same option can be used to select the proper .Nm instance to send IPC to. .Pp This option is required for both daemon and client when running multiple .Nm instances, using multiple routing tables, on Linux. .It Fl l Ar LEVEL Set log level: none, err, notice, info, debug. Default is notice. .It Fl m Ar SEC Modify Multicast Router Discovery (mrdisc) announcement interval. Default 20 sec. This option is only available when .Nm is built with mrdisc support (Linux, and IPv4, only). RFC4286. .It Fl p Ar USER Op :GROUP Drop root privileges to USER:GROUP after start and retain CAP_NET_ADMIN capabilities only. The :GROUP is optional. This option is only available when .Nm is built with libcap support. .It Fl P Ar FILE Set PID file name, and optionally full path, in case you need to override the default identity, or the identity set with .Fl i Ar NAME . Regardless, setting this option overrides all others, but it is recommended to use the ident option instead. .It Fl s Let daemon log to syslog, default unless running in foreground. .It Fl t Ar ID Set multicast routing table ID. Remember to also create routing rules directing packets to the table. This example uses routing table ID 123: .Bd -unfilled -offset left ip mrule add iif eth0 lookup 123 ip mrule add oif eth0 lookup 123 .Ed .Pp .Nm Note: Only available on Linux. .It Fl u Ar FILE UNIX domain socket path, used for the IPC between .Nm and .Nm smcroutectl . Use this to override the default socket path, derived from the daemon identity, .Fl i Ar NAME . This option can be useful when overriding the identity is not sufficient, e.g. for testing. The default depends on how .Nm is configured at build time, see .Sx FILES . .It Fl v Show program version and support information. .El .Pp The .Fl e Ar CMD option is useful if you want to trigger other processes to start when .Nm has completed installing dynamic multicast routes from (*,G) rules in .Pa /etc/smcroute.conf , or when a source-less (ANY) route, a.k.a (*,G) multicast rule, from .Pa /etc/smcroute.conf . is matched and installed. For instance, calling .Ar conntrack on Linux to flush firewall connection tracking when NAT:ing multicast. .Pp The script .Ar CMD is called with an argument .Ar reload or .Ar install to let the script know if it is called on SIGHUP/startup, or when a (*,G) rule is matched and installed. In the latter case .Nm also sets two environment variables: .Nm source , and .Nm group . Beware that these environment variables are unconditionally overwritten by .Nm and can thus not be used to pass information to the script from outside of .Nm . .Sh OPERATION .Ss Introduction When .Nm starts up it scans for available network interfaces that have the .Cm MULTICAST flag set. Provided the .Fl N flag is not set, each interface is enumerated as a virtual interface (VIF) which is what the kernel's multicast routing stack uses. The enumeration process on some operating systems also require each interface to have an IP address, but Linux and FreeBSD systems only require the ifindex and the MULTICAST flag. If the interface does not yet exist when .Nm starts, the .Fl d Ar SEC flag can be used to delay startup. Otherwise .Nm needs to be reloaded (e.g., using SIGHUP) when a new interface has been added to the system. .Pp Since VIFs are a limited resource, most operating systems only support 32 in total, the administrator may need to declare which interfaces to use for multicast routing using the .Pa /etc/smcroute.conf .Cm phyint directive. It is recommended to always start .Nm with the .Fl N flag, disabling VIF creation by default, and then selectively enable each of the interfaces you are going to route between. See .Xr smcroute.conf 5 for more information. .Ss Multicast Scoping Because multicast inherently is broadcast there is an obvious need to limit. On a LAN this is usually managed automatically by bridges (switches) with built-in multicast snooping (IGMP and MLD). Between LANs there is also the need to scope multicast, often the same multicast groups are used for different purposes on different LANs. This must be managed by administrators, at least three options exist: .Bl -tag -offset indent .It Cm TTL scoping The traditional way of "raising walls" between zones. The outbound interfaces of routers are given a TTL threshold greater than the hop it represents. The default TTL threshold is 1. Managing the routers is a lot easier than adjusting the TTL value of each multicast sender. The only real downside to this is that it scales poorly with the number of routers and it affects all multicast traversing the router's interfaces. .It Cm Administrative scoping (RFC2365) This is one of the current best practices, defining boundaries for sets of multicast groups instead of limiting all multicast (as TTL scoping does). In the case of .Nm this is left to the administrator to manage. See .Xr mrouted 8 , and .Xr mrouted.conf 5 , for more details. .It Cm Filtering Some sort of filtering mechanism, e.g., firewall (Linux netfilter) or low-level filter (Linux tc or eBPF) that may even have some hardware offloading support (TCAM). The firewall is likely the most common since it is also often used to set up SNAT or 1:1 NAT (Linux netmap). .El .Ss Multicast Routes .Pp A multicast route is defined by an input interface .Ar IFNAME , the sender's unicast IP address .Ar SOURCE , which is optional, the multicast group .Ar GROUP and a list of, at least one, output interface .Ar IFNAME [IFNAME ...] . .Pp .Bd -unfilled -offset indent mroute from eth0 group 225.1.2.3 to eth1 eth2 mroute from eth0 source 1.2.3.4 group 225.3.2.1 to eth1 eth2 mroute from eth0 group ff2e::42 to eth1 eth2 mroute from eth0 source 2001:3::1 group ff2e::43 to eth1 eth2 .Ed .Pp The sender address and multicast group must both be either IPv4 or IPv6 addresses. .Pp The output interfaces are not needed when removing routes using the .Cm smcroutectl remove command. The first three parameters are sufficient to identify the source of the multicast route. .Pp The intended purpose of .Nm is to aid in situations where dynamic multicast routing does not work properly. However, a dynamic multicast routing protocol is in nearly all cases the preferred solution. The reason for this is their ability to translate Layer-3 signaling to Layer-2 and vice versa (IGMP or MLD). .Pp .Sy Note: the optional source address multicast routes are not installed in the kernel multicast forwarding cache (MFC) by .Nm . Instead, it dynamically installs new routes to the kernel MFC, matching the group and inbound interface, when the kernel notifies .Nm using "upcalls" called .Cm NOCACHE messages. This feature was grafted onto .Nm from .Xr mrouted 8 , and may not work as intended in all use-cases. .Pp .Ss Multicast Groups .Nm is capable of simple group join and leave by sending commands to the kernel. The kernel then handles sending Layer-2 IGMP/MLD join and leave frames as needed. This can be used for testing but is also useful sometimes to open up multicast from the sender if located on a LAN with switches equipped with IGMP/MLD Snooping. Such devices will prevent forwarding of multicast unless an IGMP/MLD capable router or multicast client is located on the same physical port as you run .Nm on. However, this feature of .Nm is only intended as a workaround. Some platforms impose a limit on the maximum number of groups that can be joined, some of these systems can be tuned to increase this limit. For bigger installations it is strongly recommended to instead address the root cause, e.g. enable multicast router ports on intermediate switches, either statically or by enabling the multicast router discovery feature of .Nm . .Pp To emulate a multicast client using .Nm you use the .Nm join and .Nm leave commands to issue join and leave commands for a given multicast group on a given interface .Ar IFNAME . The .Ar GROUP may be given in an IPv4 or IPv6 address format. .Pp The command is passed to the daemon that passes it to the kernel. The kernel then tries to join the multicast group .Ar GROUP on interface .Ar IFNAME by starting IGMP, or MLD for IPv6 group address, signaling on the given interface. This signaling may be received by routers/switches connected on that network supporting IGMP/MLD multicast signaling and, in turn, start forwarding the requested multicast stream eventually reach your desired interface. .Pp .Ss Multiple Daemon Instances When running multiple .Nm instances, using the .Fl t Ar ID command line flag, one per routing table on Linux, it is required to use the .Fl i Ar NAME option to both daemon and client. This because the name of the IPC socket used for communicating is composed from the identity. .Sh DEBUGGING The most common problem when attempting to route multicast is the TTL. Always start by verifying that the TTL of your multicast stream is not set to 1, because the router decrements the TTL of an IP frame before routing it. Test your setup using .Xr ping 8 or .Xr iperf 1 . Either of which is capable of creating multicast traffic with an adjustable TTL. Iperf in particular is useful since it can act both as a multicast source (sender) and a multicast sink (receiver). For more advanced IP multicast testing the .Xr mcjoin 1 tool can be used. .Pp .Ss Note A lot of extra information is sent under the daemon facility and the debug priority to the syslog daemon. Use .Ql smcrouted -s -l debug to enable. .Sh SIGNALS For convenience in sending signals, .Nm writes its process ID to .Pa /var/run/smcroute.pid upon startup, unless the .Fl p Ar FILE or .Fl i Ar NAME options are used to change the identity or file name used. The following signals are supported: .Pp .Bl -tag -width TERM -compact .It Cm HUP Tell .Nm to reload its configuration file and activate the changes. .It Cm INT Terminates execution gracefully. .It Cm TERM The same as INT. .El .Sh FILES .Bl -tag -width /proc/net/ip6_mr_cache -compact .It Pa /etc/smcroute.conf Optional configuration file for .Nm . Defined interfaces to use, groups to join, and routes to set when starting, or reloading .Nm on .Ar SIGHUP . Like the PID file, the name of the configuration file may be different depending on command line options given to the daemon. Most notably, .Fl I Ar IDENT defines the full suite of files used by the .Nm daemon. See .Xr smcroute.conf 5 for details. .It Pa /etc/smcroute.d/*.conf Optional configuration directory, path defined by convention only, actual configuration directory, or file(s) to include, defined by .Pa /etc/smcroute.conf . See .Xr smcroute.conf 5 for details. .It Pa /var/run/smcroute.pid Default PID file (re)created by .Nm when it has started up and is ready to receive commands. See also the .Fl i Ar NAME or .Fl P Ar FILE options which can change the default name. .It Pa /var/run/smcroute.sock IPC socket created by .Nm for use by .Nm smcroutectl . Same caveats apply to this file as the previous two, command line options .Fl i Ar NAME and .Fl S Ar FILE to the daemon can be used to change the socket file name. .It Pa /proc/net/ip_mr_cache Linux specific, holds active IPv4 multicast routes. .It Pa /proc/net/ip_mr_vif Linux specific, holds the IPv4 virtual interfaces used by the active multicast routing daemon. .It Pa /proc/net/ip6_mr_cache Linux specific, holds active IPv6 multicast routes. .It Pa /proc/net/ip6_mr_vif Linux specific, holds the IPv6 virtual interfaces used by the active multicast routing daemon. .It Pa /proc/net/igmp Linux specific, holds active IGMP ASM (*,G) joins. .It Pa /proc/net/igmp6 Linux specific, holds active MLD ASM (*,G) joins. .It Pa /proc/net/mcfilter Linux specific, holds active IGMP SSM (S,G) joins. .It Pa /proc/net/mcfilter6 Linux specific, holds active MLD SSM (S,G) joins. .It Pa /proc/sys/net/ipv4/igmp_max_memberships Linux specific tuning of max IGMP ASM (*,G) per socket, default 20. .It Pa /proc/sys/net/ipv4/igmp_max_msf Linux specific tuning of max IGMP SSM (S,G) per socket, default 10. .El .Pp BSD systems may consult the .Xr netstat 1 tool for stats on virtual multicast interface tables and multicast forwarding caches, and VIF/MIF allocation, as well as the .Xr ifmcstat 8 tool for querying group membership. .Xr .Sh EXIT STATUS .Nm leverages BSD .Pa sysexits.h exit codes (64-78), which process supervisors like .Xr systemd 1 and .Xr finit 8 understands. The following table details what codes are used for and how to interpret them. .Bl -column "Status" "Symbolic Name" "Description" -offset indent .It Sy Status Ta Sy Symbolic Name Ta Sy Description .It 0 Ta EX_OK Ta Success .It 64 Ta EX_USAGE Ta Invalid command line option, or missing argument .It 69 Ta EX_UNAVAILABLE Ta Multicast routing socket (or table) already in use .It 79 Ta EX_SOFTWARE Ta Internal error, bug in .Nm .It 71 Ta EX_OSERR Ta Failed .Fn fork , .Fn daemon , .Fn getifaddrs , .Fn malloc , etc. .It 76 Ta EX_PROTOCOL Ta Kernel does not seem to support multicast routing .It 77 Ta EX_NOPERM Ta Not enough permissions to run .It 78 Ta EX_CONFIG Ta Parse error in configuration file .El .Sh SEE ALSO .Xr smcroute.conf 5 , .Xr smcroutectl 8 , .Xr mrouted 8 , .Xr pimd 8 , .Xr pim6sd 8 , .Xr ping 8 , .Xr mcjoin 1 , .Xr iperf 1 .Sh AUTHORS .An -nosplit SMCRoute was originally created by .An Carsten Schill Aq Mt carsten@cschill.de . Initial IPv6 support by .An Todd Hayton Aq Mt todd.hayton@gmail.com . Initial FreeBSD support by .An Micha Lenk Aq Mt micha@debian.org . .Pp SMCRoute is currently maintained by .An Joachim Wiberg Aq Mt troglobit@gmail.com , and .An Micha Lenk Aq Mt micha@debian.org at .Lk https://github.com/troglobit/smcroute "GitHub" . smcroute-2.5.5/man/Makefile.am0000644000175100001710000000011414146403320013102 00000000000000dist_man5_MANS = smcroute.conf.5 dist_man8_MANS = smcrouted.8 smcroutectl.8 smcroute-2.5.5/configure.ac0000644000175100001710000002060114146403320012564 00000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) AC_INIT(SMCRoute, 2.5.5, https://github.com/troglobit/smcroute/issues, smcroute, https://troglobit.com/smcroute.html) AC_CONFIG_AUX_DIR(aux) AM_INIT_AUTOMAKE([1.11 foreign]) AM_SILENT_RULES([yes]) AC_CONFIG_SRCDIR([src/smcrouted.c]) AC_CONFIG_HEADER([config.h]) AC_CONFIG_FILES([Makefile man/Makefile src/Makefile test/Makefile smcroute.service]) # Older versions of autoconf (<2.58) do not have AC_CONFIG_MACRO_DIR() m4_include([m4/misc.m4]) m4_include([m4/mroute.m4]) AC_CONFIG_MACRO_DIR([m4]) # Checks for programs. AC_PROG_CC AC_PROG_LN_S AC_PROG_INSTALL # The pidfile() code needs asprintf(), which relies on -D_GNU_SOURCE AC_GNU_SOURCE # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_TYPE_UINT32_T # Checks for library functions. AC_FUNC_FORK AC_CHECK_FUNCS([atexit dup2 memset select socket strchr strerror strrchr asprintf]) # Check for usually missing API's AC_REPLACE_FUNCS([strlcpy strlcat tempfile utimensat]) AC_CONFIG_LIBOBJ_DIR([lib]) # Check for sun_len in struct sockaddr_un and sin_len in sockaddr_in # These are used on *BSD UNIX and don't exist on Linux AC_CHECK_SUN_LEN() AC_CHECK_SIN_LEN() # Check user options AC_ARG_ENABLE([mrdisc], AS_HELP_STRING([--enable-mrdisc], [enable IPv4 multicast router discovery])) AC_ARG_ENABLE(test, [AS_HELP_STRING([--enable-test], [enable tests, requries unshare, tshark, etc.])], [ac_enable_test="$enableval"], [ac_enable_test="no"]) AC_ARG_ENABLE([ipv6], AS_HELP_STRING([--disable-ipv6], [disable IPv6 support])) AC_ARG_WITH([libcap], AS_HELP_STRING([--without-libcap], [disable libcap, -p USER:GROUP drop-privs support]),, [with_libcap=auto]) AC_ARG_WITH([systemd], [AS_HELP_STRING([--with-systemd=DIR], [Directory for systemd service files])],, [with_systemd=auto]) # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([arpa/inet.h fcntl.h glob.h ifaddrs.h linux/sockios.h net/if.h \ netinet/in.h netinet/in_var.h net/route.h sys/capability.h \ sys/ioctl.h sys/param.h sys/prctl.h sys/socket.h sys/stat.h \ sys/time.h sys/types.h syslog.h termios.h unistd.h], [], [],[ #ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_NET_IF_H # include #endif #ifdef HAVE_NETINET_IN_H # include #endif ]) # Build w/ mrdisc support? AS_IF([test "x$enable_mrdisc" = "xyes"], AC_DEFINE([ENABLE_MRDISC], 1, [Enable IPv4 multicast router discovery protocol]), enable_mrdisc=no) AM_CONDITIONAL([USE_MRDISC], [test "x$enable_mrdisc" = "xyes"]) # Required to check for libsystemd-dev PKG_PROG_PKG_CONFIG # Check where to install the systemd .service file AS_IF([test "x$PKG_CONFIG" = "x"], [ with_systemd=no AC_MSG_WARN([Cannot find pkg-config tool, disabling systemd check.])]) with_libsystemd=no AS_IF([test "x$with_systemd" = "xyes" -o "x$with_systemd" = "xauto"], [ def_systemd=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) AS_IF([test "x$def_systemd" = "x"], [ AS_IF([test "x$with_systemd" = "xyes"],[ AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]) with_systemd=no], [with_systemd="$def_systemd"])]) AS_IF([test "x$with_systemd" != "xno"], [ PKG_CHECK_MODULES([libsystemd], [libsystemd], [with_libsystemd=yes], [true]) AC_SUBST([systemddir], [$with_systemd])]) AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemd" != "xno"]) AS_IF([test "x$with_libsystemd" != "xno"], [ AC_DEFINE([HAVE_LIBSYSTEMD], [1], [Define to 1 if you have libsystemd-dev]) AC_SUBST([DAEMON_TYPE], "Notify")], [ AC_SUBST([DAEMON_TYPE], "Simple")]) AM_CONDITIONAL([HAVE_LIBSYSTEMD], [test "x$with_libsystemd" != "xno"]) # Check if we need -lpthread (building statically) and -lrt (older GLIBC) # Unset cached values when retrying with -lpthread and reset LIBS for each API need_librt=no need_pthread=no old_LIBS=$LIBS AC_SEARCH_LIBS([clock_gettime], [rt], need_librt=yes) LIBS=$old_LIBS AC_SEARCH_LIBS([timer_create], [rt], need_librt=yes, [ unset ac_cv_search_timer_create AC_SEARCH_LIBS([timer_create], [rt], need_pthread=yes,,[-lpthread])]) LIBS=$old_LIBS AC_SEARCH_LIBS([timer_settime], [rt], need_librt=yes, [ unset ac_cv_search_timer_settime AC_SEARCH_LIBS([timer_settime], [rt], need_pthread=yes,,[-lpthread])]) # Check for libcap to not trigger false positives on FreeBSD et al LIBS=$old_LIBS AC_SEARCH_LIBS([cap_set_flag], [cap],, ac_cv_header_sys_capability_h=no) LIBS=$old_LIBS # Check for RFC 3678-style struct group_req (Linux, FreeBSD, Solaris, macOS, AIX) AC_CHECK_MEMBER([struct group_req.gr_interface], AC_DEFINE([HAVE_STRUCT_GROUP_REQ], [1], [Define to 1 if you have RFC 3678 struct group_req]), [], [[#include ]]) # Check for Linux-style extension struct ip_mreqn (Linux, FreeBSD) AC_CHECK_MEMBER([struct ip_mreqn.imr_ifindex], AC_DEFINE([HAVE_STRUCT_IP_MREQN], [1], [Define to 1 if you have a Linux-style struct ip_mreqn]), [], [[#include ]]) # Check for IPv4 support AC_CHECK_MROUTE() # If IPv6 is enabled we must probe the system some more AS_IF([test "x$enable_ipv6" != "xno"], AC_CHECK_MROUTE6()) # Only enable support for dropping root privileges if auto/yes && header exists AS_IF([test "x$with_libcap" != "xno" -a "x$ac_cv_header_sys_capability_h" = "xyes"], [ with_libcap=yes AC_DEFINE([ENABLE_LIBCAP], [], [Define to enable support for libcap.])]) AM_CONDITIONAL(USE_LIBCAP, [test "x$with_libcap" != "xno" -a "x$ac_cv_header_sys_capability_h" = "xyes"]) AM_CONDITIONAL([ENABLE_TEST], [test "x$ac_enable_test" != "xno"]) # Mac OS does not (yet) support SOCK_CLOEXEC AC_CACHE_CHECK([for SOCK_CLOEXEC support], [ac_cv_sock_cloexec], [AC_TRY_RUN([ #include #include int main() { return socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, 0) == -1; }], [ac_cv_sock_cloexec=yes], [ac_cv_sock_cloexec=no], [ac_cv_sock_cloexec=no])]) AS_IF([test "$ac_cv_sock_cloexec" = "yes" ], AC_DEFINE([HAVE_SOCK_CLOEXEC], 1, [Define if the SOCK_CLOEXEC flag is supported])) AS_IF([test "$need_librt" != "no"], LIB_RT=-lrt) AC_SUBST([LIB_RT]) AS_IF([test "$need_pthread" != "no"], LIB_PTHREAD=-lpthread) AC_SUBST([LIB_PTHREAD]) # Expand $sbindir early, into $SBINDIR, for systemd unit file # NOTE: This does *not* take prefix/exec_prefix override at "make # install" into account, unfortunately. test "x$prefix" = xNONE && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' SBINDIR=`eval echo $sbindir` SBINDIR=`eval echo $SBINDIR` AC_SUBST(SBINDIR) DOCDIR=`eval echo $docdir` DOCDIR=`eval echo $DOCDIR` AC_SUBST(DOCDIR) AS_IF([test "x$ac_cv_header_sys_capability_h" = "xno"], [ AS_IF([test "x$with_libcap" = "xyes"], [ dnl configure: error: ... AC_MSG_ERROR( [Cannot find libcap or its headers, install libcap-dev first.] [CentOS/RHEL 6: libcap is broken, recommended to disable it.] [Use --without-libcap to disable this feature.]) ]) AS_IF([test "x$with_libcap" = "xauto"], [ dnl configure: WARNING: ... AC_MSG_WARN( [As a safety measure, SMCRoute use libcap to drop root privs] [after startup. Install libcap and headers from libcap-dev,] [or similar, to enable this feature.]) AC_MSG_NOTICE([Use --without-libcap to disable this message.]) ]) with_libcap=no]) # Workaround for as-of-yet unreleased runstatedir support, planned for # autoconf 2.70, which some major distros have backported. AS_IF([test -z "$runstatedir"], runstatedir="$localstatedir/run") AC_SUBST(runstatedir) AC_OUTPUT # Expand directories for configuration summary, unexpanded defaults: # sysconfdir => ${prefix}/etc # runstatedir => ${localstatedir}/run SYSCONFDIR=`eval echo $sysconfdir` RUNSTATEDIR=`eval echo $runstatedir` RUNSTATEDIR=`eval echo $RUNSTATEDIR` cat < [mrdisc] [ttl-threshold <1-255>] # mgroup from IIF [source ADDR[/LEN]] group GROUP[/LEN] # mroute from IIF [source ADDR[/LEN]] group GROUP[/LEN] to OIF [OIF ...] # include /path/to/*.conf # This example assumes smcrouted was started with the `-N` flag. # Only enable interfaces required for inbound and outbound traffic. phyint eth0 enable ttl-threshold 11 phyint eth1 enable ttl-threshold 3 phyint eth2 enable ttl-threshold 5 phyint virbr0 enable ttl-threshold 5 # Instruct the kernel to join the multicast group 225.1.2.3 on interface # eth0. Then add an mroute of the same multicast stream, from the host # 192.168.1.42 on interface eth0 and forward to eth1 and eth2. mgroup from eth0 group 225.1.2.3 mroute from eth0 source 192.168.1.42 group 225.1.2.3 to eth1 eth2 # Similar example, but using source-specific group join mgroup from virbr0 source 192.168.123.110 group 225.1.2.4 mroute from virbr0 source 192.168.123.110 group 225.1.2.4 to eth0 # Allow multicast for group 225.3.2.1, from ANY source, ingressing on # interface eth0 to be forwarded to eth1 and eth2. When the kernel # receives a frame from unknown multicast sender, it asks smcrouted who # use this "template" to match against, if the ingressing interface and # group matches, smcrouted installs an (S,G) route in the kernel MFC. mgroup from eth0 group 225.3.2.1 mroute from eth0 group 225.3.2.1 to eth1 eth2 # The previous is an example of the (*,G) support. It is also possible # to specify a range of such rules. mgroup from eth0 group 225.0.0.0/24 mroute from eth0 group 225.0.0.0/24 to eth1 eth2 # Include any snippet in /etc/smcroute.d/, but please remember that # all phyint statements must be read first. include /etc/smcroute.d/*.conf smcroute-2.5.5/aux/0000755000175100001710000000000014146403363011163 500000000000000smcroute-2.5.5/aux/compile0000777000175100001710000001632713616550647012507 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2018 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: smcroute-2.5.5/aux/test-driver0000777000175100001710000001104213616550647013314 00000000000000#! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2018-03-07.03; # UTC # Copyright (C) 2011-2018 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <$log_file 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then tweaked_estatus=1 else tweaked_estatus=$estatus fi case $tweaked_estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report the test outcome and exit status in the logs, so that one can # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). echo "$res $test_name (exit status: $estatus)" >>$log_file # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: smcroute-2.5.5/aux/missing0000777000175100001710000001533613616550647012527 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2018 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: smcroute-2.5.5/aux/install-sh0000777000175100001710000003601013616550647013124 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2018-03-11.20; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) # Note that $RANDOM variable is not portable (e.g. dash); Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p' feature. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: smcroute-2.5.5/aux/depcomp0000777000175100001710000005602013616550647012500 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2018 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: smcroute-2.5.5/COPYING0000644000175100001710000004310314146403320011333 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. smcroute-2.5.5/Makefile.in0000644000175100001710000007540714146403357012373 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : @ENABLE_TEST_TRUE@am__append_1 = test subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/misc.m4 \ $(top_srcdir)/m4/mroute.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(dist_sbin_SCRIPTS) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = smcroute.service CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(docdir)" \ "$(DESTDIR)$(systemddir)" SCRIPTS = $(dist_sbin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DATA = $(doc_DATA) $(systemd_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir distdir-am dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = man src test am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/smcroute.service.in $(top_srcdir)/aux/compile \ $(top_srcdir)/aux/install-sh $(top_srcdir)/aux/missing COPYING \ aux/compile aux/install-sh aux/missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAEMON_TYPE = @DAEMON_TYPE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DOCDIR = @DOCDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PTHREAD = @LIB_PTHREAD@ LIB_RT = @LIB_RT@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ SBINDIR = @SBINDIR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libsystemd_CFLAGS = @libsystemd_CFLAGS@ libsystemd_LIBS = @libsystemd_LIBS@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ systemddir = @systemddir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = man src $(am__append_1) DISTCLEANFILES = *~ DEADJOE semantic.cache *.gdb *.elf core core.* *.d dist_sbin_SCRIPTS = smcroute doc_DATA = README.md COPYING smcroute.conf EXTRA_DIST = README.md ChangeLog.md autogen.sh smcroute.conf smcroute.default smcroute.init @HAVE_SYSTEMD_TRUE@systemd_DATA = smcroute.service # Workaround for systemd unit file duing distcheck DISTCHECK_CONFIGURE_FLAGS = --with-systemd=$$dc_install_base/$(systemd) --enable-mrdisc --enable-test all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 smcroute.service: $(top_builddir)/config.status $(srcdir)/smcroute.service.in cd $(top_builddir) && $(SHELL) ./config.status $@ install-dist_sbinSCRIPTS: $(dist_sbin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(dist_sbin_SCRIPTS)'; test -n "$(sbindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ } \ ; done uninstall-dist_sbinSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(dist_sbin_SCRIPTS)'; test -n "$(sbindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(sbindir)'; $(am__uninstall_files_from_dir) install-docDATA: $(doc_DATA) @$(NORMAL_INSTALL) @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \ done uninstall-docDATA: @$(NORMAL_UNINSTALL) @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir) install-systemdDATA: $(systemd_DATA) @$(NORMAL_INSTALL) @list='$(systemd_DATA)'; test -n "$(systemddir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(systemddir)'"; \ $(MKDIR_P) "$(DESTDIR)$(systemddir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(systemddir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(systemddir)" || exit $$?; \ done uninstall-systemdDATA: @$(NORMAL_UNINSTALL) @list='$(systemd_DATA)'; test -n "$(systemddir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(systemddir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(SCRIPTS) $(DATA) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(systemddir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-docDATA install-systemdDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-dist_sbinSCRIPTS install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-dist_sbinSCRIPTS uninstall-docDATA \ uninstall-systemdDATA .MAKE: $(am__recursive_targets) all install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ distcheck distclean distclean-generic distclean-hdr \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dist_sbinSCRIPTS \ install-docDATA install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip install-systemdDATA \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-dist_sbinSCRIPTS uninstall-docDATA \ uninstall-systemdDATA .PRECIOUS: Makefile release-hook: @if [ ! `git tag -l $(PACKAGE_VERSION) | grep $(PACKAGE_VERSION)` ]; then \ echo; \ printf "\e[1m\e[41mCannot find release tag $(PACKAGE_VERSION)\e[0m\n"; \ printf "\e[1m\e[5mDo release anyway?\e[0m "; read yorn; \ if [ "$$yorn" != "y" -a "$$yorn" != "Y" ]; then \ printf "OK, aborting release.\n"; \ exit 1; \ fi; \ echo; \ else \ echo; \ printf "\e[1m\e[42mFound GIT release tag $(PACKAGE_VERSION)\e[0m\n"; \ printf "\e[1m\e[44m>>Remember to push tags!\e[0m\n"; \ echo; \ fi release: release-hook distcheck @for file in $(DIST_ARCHIVES); do \ md5sum $$file > ../$$file.md5; \ sha256sum $$file > ../$$file.sha256; \ done @mv $(DIST_ARCHIVES) ../ @echo @echo "Resulting release files =======================================================================" @for file in $(DIST_ARCHIVES); do \ printf "%-30s Distribution tarball\n" $$file; \ printf "%-30s " $$file.md5; cat ../$$file.md5 | cut -f1 -d' '; \ printf "%-30s " $$file.sha256; cat ../$$file.sha256 | cut -f1 -d' '; \ done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: smcroute-2.5.5/smcroute.service.in0000644000175100001710000000114114146403320014124 00000000000000[Unit] Description=Static multicast routing daemon Documentation=man:smcrouted Documentation=man:smcroute.conf Documentation=man:smcroutectl Documentation=file:@DOCDIR@/README.md # ConditionPathExists=/etc/smcroute.conf After=network-online.target Requires=network-online.target [Service] Type=@DAEMON_TYPE@ EnvironmentFile=-@sysconfdir@/default/smcroute ExecStart=@SBINDIR@/smcrouted -n -s $SMCROUTED_OPTS ExecReload=@SBINDIR@/smcroutectl reload NotifyAccess=main # Hardening settings NoNewPrivileges=true ProtectControlGroups=true ProtectSystem=full ProtectHome=true [Install] WantedBy=multi-user.target smcroute-2.5.5/smcroute.init0000755000175100001710000000376614146403320013044 00000000000000#!/bin/sh # ### BEGIN INIT INFO # Provides: smcroute # Required-Start: $syslog $local_fs $network $remote_fs # Required-Stop: $syslog $local_fs $network $remote_fs # Should-Start: # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Static multicast router daemon # Description: SMCRoute is a daemon and command line tool to manipulate # the multicast routing table of a UNIX kernel. It can be # used as an alternative to dynamic multicast routers like # pimd or mrouted in situations where static routes should # be maintained and/or no proper IGMP signaling exists. ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/smcrouted DAEMONCTL=/usr/sbin/smcroutectl DAEMON_OPTS= NAME=smcrouted DESC="static multicast router daemon" test -x $DAEMON || exit 0 # Include smcroute defaults if available if [ -f /etc/default/smcroute ] ; then . /etc/default/smcroute fi . /lib/lsb/init-functions start() { local error local result log_begin_msg "Starting $DESC: $NAME" error=$(start-stop-daemon --start --quiet \ --exec $DAEMON -- $DAEMON_OPTS 2>&1) result=$? if [ "$result" = "0" -a -x /etc/smcroute/startup.sh ]; then /etc/smcroute/startup.sh else log_progress_msg ${error#ERRO: } fi log_end_msg $result } stop() { local error local result log_begin_msg "Stopping $DESC: $NAME" error=$($DAEMONCTL kill 2>&1) result=$? log_progress_msg ${error#ERRO: } log_end_msg $result } case "$1" in start) start ;; stop) stop ;; restart|force-reload) # # If the "reload" option is implemented, move the "force-reload" # option to the "reload" entry above. If not, "force-reload" is # just the same as "restart". # stop start ;; status) status_of_proc "$DAEMON" "$DESC" && exit 0 || exit $? ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0 smcroute-2.5.5/test/0000755000175100001710000000000014146403363011345 500000000000000smcroute-2.5.5/test/include.sh0000755000175100001710000000444214146403320013244 00000000000000#!/bin/sh # Verifies .conf include statement #set -x activate() { if [ -f /tmp/$NM/pid ]; then ../src/smcroutectl -u "/tmp/$NM/sock" reload else ../src/smcrouted -c 8 -f "/tmp/$NM/conf" -n -N -P "/tmp/$NM/pid" -l debug -u "/tmp/$NM/sock" & fi sleep 1 } get_routes() { ip -6 mroute ip mroute } check_output() { show_mroute get_routes | grep -q "$2" [ "$?" = "$1" ] || FAIL "$3" } # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" print "Creating world ..." topo basic # IP world ... ip addr add 10.0.0.1/24 dev a1 ip addr add 2001:1::1/64 dev a1 ip addr add fc00::1/64 dev a1 ip addr add 20.0.0.1/24 dev a1 ip addr add 2001:2::1/64 dev a2 ip -br a ######################################################### Plain conf, no include print "Creating /tmp/$NM/conf ..." cat < "/tmp/$NM/conf" phyint a1 enable phyint a2 enable mroute from a1 source 10.0.0.10 group 225.3.2.1 to a2 EOF cat "/tmp/$NM/conf" print "Starting smcrouted ..." activate check_output 0 "(10.0.0.10,225.3.2.1)" "Failed reading initial .conf file" ######################################################## Include files from conf print "Creating /tmp/$NM/conf2 ..." echo "include /tmp/$NM/conf2" >> "/tmp/$NM/conf" cat <"/tmp/$NM/conf2" mroute from a1 source fc00::1 group ff04:0:0:0:0:0:0:114 to a2 include /tmp/$NM/*.foo EOF echo ">> /tmp/$NM/conf" cat "/tmp/$NM/conf" echo ">> /tmp/$NM/conf2" cat "/tmp/$NM/conf2" activate check_output 0 "(fc00::1,ff04::114)" "Failed reading conf2" ######################################################### Creating a.foo & b.foo print "Creating /tmp/$NM/{a,b}.foo ..." cat <"/tmp/$NM/a.foo" mroute from a1 source 10.0.0.1 group 225.1.2.3 to a2 EOF echo ">> /tmp/$NM/a.foo" cat "/tmp/$NM/a.foo" cat <"/tmp/$NM/b.foo" mroute from a1 source 10.0.0.2 group 225.1.2.1 to a2 EOF echo ">> /tmp/$NM/b.foo" cat "/tmp/$NM/b.foo" activate check_output 0 "(10.0.0.1,225.1.2.3)" "Failed reading a.foo" check_output 0 "(10.0.0.2,225.1.2.1)" "Failed reading b.foo" ################################################################# Removing b.foo print "Removing b.foo ..." rm "/tmp/$NM/b.foo" activate check_output 1 "(10.0.0.2,225.1.2.1)" "Failed removing old route from b.foo" ########################################################################### DONE OK smcroute-2.5.5/test/multi.sh0000755000175100001710000001036314146403320012752 00000000000000#!/bin/sh # Verify interop between multiple routers and 1:1 NAT. Same subnet and # source IP of multicast emitters. # # netns: R1 netns: R2 # .-------------. .-------------. # | smcrouted | | smcrouted | # | / \ | br0 | / \ | # MC --> eth1 eth0 | / \ | eth0 eth1 <-- MC # | `------' '-------' | # '-------------' 192.168.0.0/24 '-------------' # 10.0.0.0/24 10.0.0.0/24 # # Since we use tshark (because tcpdump doesn't work in an unshare), and # it doesn't seem to be able to dump the Ethernet header, we set the TTL # of the two ping's to different values to be able to separate the two # when inspecting the pcap from br0. # # Note: modern versions of iptables have introduced the xtables.lock file # the default path for it can be overridden from v1.8.7 and later, # a workaround is to `chmod a+rw /var/run/xtables.lock` #set -x # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" print "Checking dependencies ..." lsb_release -a uname -a XTABLES_LOCK=$(mktemp -p "/tmp/$NM") export XTABLES_LOCK check_dep unshare -mrun iptables -L 2>/dev/null print "Creating world ..." topo multi R1 R2 # IP world ... nsenter --net=R1 -- ip addr add 192.168.0.10/24 dev eth0 nsenter --net=R1 -- ip addr add 10.0.0.1/24 dev eth1 nsenter --net=R1 -- ip route add 192.168.20.0/24 via 192.168.0.20 nsenter --net=R1 -- iptables -t nat -A PREROUTING -d 192.168.10.0/24 -j NETMAP --to 10.0.0.0/24 nsenter --net=R1 -- iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -j NETMAP --to 192.168.10.0/24 nsenter --net=R1 -- ip -br l nsenter --net=R1 -- ip -br a nsenter --net=R2 -- ip addr add 192.168.0.20/24 dev eth0 nsenter --net=R2 -- ip addr add 10.0.0.1/24 dev eth1 nsenter --net=R2 -- ip route add 192.168.10.0/24 via 192.168.0.10 nsenter --net=R2 -- iptables -t nat -A PREROUTING -d 192.168.20.0/24 -j NETMAP --to 10.0.0.0/24 nsenter --net=R2 -- iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -j NETMAP --to 192.168.20.0/24 nsenter --net=R2 -- ip -br l nsenter --net=R2 -- ip -br a print "Verifying connectivity ..." printf "R1 (192.168.0.10) " if ! nsenter --net=R1 -- ping -c 3 192.168.20.1; then FAIL "R1: cannot reach ED2 via R2" fi print "Creating config ..." cat <"/tmp/$NM/shared.conf" # shared.conf for both netns phyint eth0 enable phyint eth1 enable mgroup from eth1 group 225.1.2.3 mroute from eth1 group 225.1.2.3 to eth0 # Disable for now, maybe use in another test. With this # disabled we get WRONGVIF messages from the kernel that # can extend this test to verify. #mgroup from eth0 group 225.1.2.3 #mroute from eth0 group 225.1.2.3 to eth1 EOF cat "/tmp/$NM/shared.conf" print "Starting smcrouted instances ..." nsenter --net=R1 -- ../src/smcrouted -f "/tmp/$NM/shared.conf" -n -N -i R1 -l debug -u "/tmp/$NM/R1.sock" & echo $! >> "/tmp/$NM/PIDs" nsenter --net=R2 -- ../src/smcrouted -f "/tmp/$NM/shared.conf" -n -N -i R2 -l debug -u "/tmp/$NM/R2.sock" & echo $! >> "/tmp/$NM/PIDs" sleep 1 collect br0 -c10 'dst 225.1.2.3' print "Starting emitters ..." nsenter --net=R1 -- ping -c 5 -W 1 -I eth1 -t 11 225.1.2.3 > /dev/null & sleep 1 nsenter --net=R2 -- ping -c 5 -W 1 -I eth1 -t 21 225.1.2.3 > /dev/null & sleep 5 print "R1 multicast routes and 1:1 NAT ..." nsenter --net=R1 -- ip mroute nsenter --net=R1 -- ../src/smcroutectl -d -u "/tmp/$NM/R1.sock" nsenter --net=R1 -- iptables -v -L -t nat print "R2 multicast routes and 1:1 NAT ..." nsenter --net=R2 -- ip mroute nsenter --net=R2 -- ../src/smcroutectl -d -u "/tmp/$NM/R2.sock" nsenter --net=R2 -- iptables -v -L -t nat print "Analyzing br0 pcap, data from R1 and R2 ..." lines1=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 225.1.2.3 | grep 'ttl=10' | tee "/tmp/$NM/result" | wc -l) lines2=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 225.1.2.3 | grep 'ttl=20' | tee -a "/tmp/$NM/result" | wc -l) cat "/tmp/$NM/result" echo " => $lines1 for group 225.1.2.3 from R1, expected >= 4" echo " => $lines2 for group 225.1.2.3 from R2, expected >= 4" # Expect one frame loss due to initial (*,G) -> (S,G) route setup # shellcheck disable=SC2086 disable=SC2166 [ $lines1 -ge 4 -a $lines2 -ge 4 ] && OK FAIL smcroute-2.5.5/test/mem.sh0000755000175100001710000000313114146403320012371 00000000000000#!/bin/sh # Check for memory leaks with valgrind, should cover the basic use-cases # with a .conf file, reloading said .conf file, and IPC. # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" print "Checking dependencies ..." lsb_release -a uname -a check_dep valgrind print "Creating world ..." topo plus ip addr add 10.0.0.1/24 dev a1 ip addr add 20.0.0.1/24 dev a2 ip addr add 20.0.0.1/24 dev a3 ip -br l print "Creating config ..." cat < "/tmp/$NM/conf" # basic (*,G) multicast routing phyint a1 enable phyint a3 enable phyint foo0 enable phyint mgroup from a1 source 10.0.0.1 group 225.3.2.1 mroute from a1 source 10.0.0.1 group 225.3.2.1 to a2 foo0 mgroup from a1 group 225.1.2.3 mroute from a1 group 225.1.2.3 to a2 mroute from a3 group 225.1.2.3 to a1 mgroup from b4 group 225.1.2.3 EOF cat "/tmp/$NM/conf" print "Creating background ops ..." cat < "/tmp/$NM/ops.sh" #!/bin/sh sleep 2 ../src/smcroutectl -dpS "/tmp/$NM/sock" reload sleep 1 ../src/smcroutectl -dpS "/tmp/$NM/sock" add a1 225.1.2.4 a3 ../src/smcroutectl -dpS "/tmp/$NM/sock" add a1 10.0.0.1 225.1.2.5 a3 echo ../src/smcroutectl -dpS "/tmp/$NM/sock" show int echo ../src/smcroutectl -dpS "/tmp/$NM/sock" show gr echo ../src/smcroutectl -dpS "/tmp/$NM/sock" show ro echo EOF cat "/tmp/$NM/ops.sh" chmod +x "/tmp/$NM/ops.sh" "/tmp/$NM/ops.sh" & print "Checking for memory leaks ..." valgrind -s --leak-check=full --show-leak-kinds=all ../src/smcrouted -f "/tmp/$NM/conf" -n -N -l debug -P "/tmp/$NM/pid" -u "/tmp/$NM/sock" -D 5 2>&1 | tee "/tmp/$NM/log" if grep "no leaks are possible" "/tmp/$NM/log"; then OK fi FAIL smcroute-2.5.5/test/vlan.sh0000755000175100001710000000430014146403320012552 00000000000000#!/bin/sh # Verify IPv4 (*,G) routing on top of VLAN interfaces #set -x # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" print "Creating world ..." topo basic vlan 100 110 ip addr add 10.100.0.1/24 dev a1.100 ip addr add 10.110.0.1/24 dev a1.110 ip addr add 20.100.0.1/24 dev a2.100 ip addr add 20.110.0.1/24 dev a2.110 ip -br a print "Creating config ..." cat < "/tmp/$NM/conf" # vlan (*,G) multicast routing phyint a1.100 enable phyint a1.110 enable phyint a2.110 enable mroute from a1.100 group 225.1.2.3 to a1.110 a2.110 mroute from a2.110 group 225.3.2.1 to a1.110 a1.100 EOF cat "/tmp/$NM/conf" print "Starting smcrouted ..." ../src/smcrouted -f "/tmp/$NM/conf" -n -N -P "/tmp/$NM/pid" -l debug -u "/tmp/$NM/sock" & sleep 1 print "Starting collectors ..." tshark -c 6 -lni a1.110 -w "/tmp/$NM/pcap1" 'icmp and (dst 225.1.2.3 or dst 225.3.2.1)' 2>/dev/null & echo $! >> "/tmp/$NM/PIDs" tshark -c 3 -lni a2.110 -w "/tmp/$NM/pcap2" 'icmp and dst 225.1.2.3' 2>/dev/null & echo $! >> "/tmp/$NM/PIDs" tshark -c 3 -lni a1.100 -w "/tmp/$NM/pcap3" 'icmp and dst 225.3.2.1' 2>/dev/null & echo $! >> "/tmp/$NM/PIDs" sleep 1 print "Starting emitters ..." ping -c 3 -W 1 -I a1.100 -t 2 225.1.2.3 >/dev/null ping -c 3 -W 1 -I a2.110 -t 2 225.3.2.1 >/dev/null show_mroute print "Analyzing ..." lines1=$(tshark -r "/tmp/$NM/pcap1" 2>/dev/null | grep 225.1.2.3 | tee "/tmp/$NM/result1" | wc -l) lines2=$(tshark -r "/tmp/$NM/pcap1" 2>/dev/null | grep 225.3.2.1 | tee -a "/tmp/$NM/result1" | wc -l) lines3=$(tshark -r "/tmp/$NM/pcap2" 2>/dev/null | grep 225.1.2.3 | tee "/tmp/$NM/result2" | wc -l) lines4=$(tshark -r "/tmp/$NM/pcap3" 2>/dev/null | grep 225.3.2.1 | tee "/tmp/$NM/result3" | wc -l) echo "Receieved on a1.110, expected >=2 pkt of 225.1.2.3 and >=2 pkt 225.3.2.1:" cat "/tmp/$NM/result1" echo "Receieved on a2.110, expected >=2 pkt of 225.1.2.3:" cat "/tmp/$NM/result2" echo "Receieved on a1.100, expected >=2 pkt of 225.3.2.1:" cat "/tmp/$NM/result3" ########################################################################### DONE # one frame lost due to initial (*,G) -> (S,G) setup # shellcheck disable=SC2086 disable=SC2166 [ $lines1 -ge 2 -a $lines2 -ge 2 -a $lines3 -ge 2 -a $lines4 -ge 2 ] && OK FAIL smcroute-2.5.5/test/mrdisc.sh0000755000175100001710000000156414146403320013104 00000000000000#!/bin/sh # Verifies IPv4 mrdisc messages on all interfaces it is enabled on # Runs for two intervals to ensure interval timer works properly. #set -x # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" print "Creating world ..." topo basic ip addr add 10.0.0.1/24 dev a1 ip addr add 20.0.0.1/24 dev a2 ip -br a print "Creating config ..." cat < "/tmp/$NM/conf" phyint a1 enable mrdisc phyint a2 enable mrdisc EOF cat "/tmp/$NM/conf" print "Starting smcrouted ..." ../src/smcrouted -f "/tmp/$NM/conf" -n -N -P "/tmp/$NM/pid" -l debug -u "/tmp/$NM/sock" -m 4 & sleep 1 collect a2 -c3 'dst 224.0.0.106' sleep 10 print "Analyzing ..." lines=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 224.0.0.106 | tee "/tmp/$NM/result" | wc -l) cat "/tmp/$NM/result" echo " => $lines for 224.0.0.106 (MRDISC), expected >= 2" # shellcheck disable=SC2086 [ $lines -ge 2 ] && OK FAIL smcroute-2.5.5/test/join.sh0000755000175100001710000001255714146403320012566 00000000000000#!/bin/sh # Verify join/leave multicast groups for both IPv4 and IPv6 # a1 will be used to verify SSM and a2 to verify ASM # # Note: this test is really ugly and full of code duplcation # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" print "Creating world ..." topo basic # IP world ... ip addr add 10.0.0.1/24 dev a1 ip addr add 20.0.0.1/24 dev a2 ip addr add 2001:1::1/64 dev a1 ip addr add 2001:2::1/64 dev a2 ip -br a ################################################################## STATIC GROUPS print "Phase 1: Join groups (.conf)" cat < "/tmp/$NM/conf" # ASM + SSM join/leave multicast groups phyint a1 enable phyint a2 enable mgroup from a1 source fc00::1 group ff04:0:0:0:0:0:0:114 mgroup from a1 source 10.0.0.10 group 225.1.2.3 mgroup from a2 group ff2e::42 mgroup from a2 group 225.3.2.1 EOF cat "/tmp/$NM/conf" print "Starting smcrouted ..." ../src/smcrouted -f "/tmp/$NM/conf" -n -N -P "/tmp/$NM/pid" -l debug -u "/tmp/$NM/sock" & sleep 1 echo "-----------------------------------------------------------------------------------" ../src/smcroutectl -pu "/tmp/$NM/sock" show interfaces echo "-----------------------------------------------------------------------------------" ../src/smcroutectl -pu "/tmp/$NM/sock" show groups echo "-----------------------------------------------------------------------------------" grep "0xe1010203 0x0a00000a" /proc/net/mcfilter config_ssm=$? grep "ff040000000000000000000000000114 fc000000000000000000000000000001" /proc/net/mcfilter6 config_ssm6=$? ip maddr show dev a2 | grep 225.3.2.1 config_asm=$? ip -6 maddr show dev a2 | grep ff2e::42 config_asm6=$? # shellcheck disable=SC2166 if [ $config_ssm -eq 0 -a $config_ssm6 -eq 0 ]; then echo "Config SSM join OK" config_ssm=0 else echo "Config SSM join FAIL" config_ssm=1 fi # shellcheck disable=SC2166 if [ $config_asm -eq 0 -a $config_asm6 -eq 0 ]; then echo "Config ASM join OK" config_asm=0 else echo "Config ASM join FAIL" config_asm=1 fi # shellcheck disable=SC2166 if [ $config_ssm -eq 0 -a $config_asm -eq 0 ]; then echo "Config join OK" config=0 else echo "Config join FAIL" config=1 fi #################################################################### JOIN GROUPS print "Phase 2: Join groups (IPC)" ../src/smcroutectl -u "/tmp/$NM/sock" join a1 10.0.0.11 225.1.1.1 ../src/smcroutectl -u "/tmp/$NM/sock" join a2 225.2.2.2 ../src/smcroutectl -u "/tmp/$NM/sock" join a1 fc00::2 ff04::111 ../src/smcroutectl -u "/tmp/$NM/sock" join a2 ff2e::22 echo "-----------------------------------------------------------------------------------" ../src/smcroutectl -pu "/tmp/$NM/sock" show interfaces echo "-----------------------------------------------------------------------------------" ../src/smcroutectl -pu "/tmp/$NM/sock" show groups echo "-----------------------------------------------------------------------------------" grep "0xe1010101 0x0a00000b" /proc/net/mcfilter dynamic_ssm=$? grep "ff040000000000000000000000000111 fc000000000000000000000000000002" /proc/net/mcfilter6 dynamic_ssm6=$? ip maddr show dev a2 | grep 225.2.2.2 dynamic_asm=$? ip -6 maddr show dev a2 | grep ff2e::22 dynamic_asm6=$? # shellcheck disable=SC2166 if [ $dynamic_ssm -eq 0 -a $dynamic_ssm6 -eq 0 ]; then echo "Dynamic SSM join OK" dynamic_ssm=0 else echo "Dynamic SSM join FAIL" dynamic_ssm=1 fi # shellcheck disable=SC2166 if [ $dynamic_asm -eq 0 -a $dynamic_asm6 -eq 0 ]; then echo "Dynamic ASM join OK" dynamic_asm=0 else echo "Dynamic ASM join FAIL" dynamic_asm=1 fi # shellcheck disable=SC2166 if [ $dynamic_ssm -eq 0 -a $dynamic_asm -eq 0 ]; then echo "Dynamic join OK" dynamic=0 else echo "Dynamic join FAIL" dynamic=1 fi ################################################################### LEAVE GROUPS print "Phase 3: Leave groups (IPC)" ../src/smcroutectl -u "/tmp/$NM/sock" leave a1 10.0.0.10 225.1.2.3 ../src/smcroutectl -u "/tmp/$NM/sock" leave a2 225.3.2.1 ../src/smcroutectl -u "/tmp/$NM/sock" leave a1 fc00::1 ff04::114 ../src/smcroutectl -u "/tmp/$NM/sock" leave a2 ff2e::42 echo "-----------------------------------------------------------------------------------" ../src/smcroutectl -pu "/tmp/$NM/sock" show interfaces echo "-----------------------------------------------------------------------------------" ../src/smcroutectl -pu "/tmp/$NM/sock" show groups echo "-----------------------------------------------------------------------------------" grep "0xe1010203 0x0a00000a" /proc/net/mcfilter leave_ssm=$? grep "ff040000000000000000000000000114 fc000000000000000000000000000001" /proc/net/mcfilter6 leave_ssm6=$? ip maddr show dev a2 | grep 225.3.2.1 leave_asm=$? ip -6 maddr show dev a2 | grep ff2e::42 leave_asm6=$? # shellcheck disable=SC2166 if [ $leave_ssm -eq 1 -a $leave_ssm6 -eq 1 ]; then echo "Dynamic SSM leave OK" leave_ssm=0 else echo "Dynamic SSM leave FAIL" leave_ssm=1 fi # shellcheck disable=SC2166 if [ $leave_asm -eq 1 -a $leave_asm6 -eq 1 ]; then echo "Dynamic ASM leave OK" leave_asm=0 else echo "Dynamic ASM leave FAIL" leave_asm=1 fi # shellcheck disable=SC2166 if [ $leave_ssm -eq 0 -a $leave_asm -eq 0 ]; then echo "Dynamic leave OK" leave=0 else echo "Dynamic leave FAIL" leave=1 fi ########################################################################### DONE # shellcheck disable=SC2166 [ $config -eq 0 -a $dynamic -eq 0 -a $leave -eq 0 ] && OK FAIL smcroute-2.5.5/test/isolated.sh0000755000175100001710000000261114146403320013421 00000000000000#!/bin/sh # Verifies (*,G) routing between two emulated end devices. #set -x # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" LEFT=/tmp/$NM/left RIGHT=/tmp/$NM/right LIF=$(basename "$LEFT") RIF=$(basename "$RIGHT") print "Creating world ..." topo isolated "$LEFT" "$RIGHT" # IP World ip addr add 10.0.0.1/24 dev "$LIF" nsenter --net="$LEFT" -- ip addr add 10.0.0.10/24 dev eth0 ip addr add 20.0.0.1/24 dev "$RIF" nsenter --net="$RIGHT" -- ip addr add 20.0.0.10/24 dev eth0 ip -br l ip -br a print "Creating config ..." cat < "/tmp/$NM/conf" # vlan (*,G) multicast routing phyint $LIF enable phyint $RIF enable mroute from $LIF group 225.1.2.3 to $RIF EOF cat "/tmp/$NM/conf" print "Starting smcrouted ..." ../src/smcrouted -f "/tmp/$NM/conf" -n -N -P "/tmp/$NM/pid" -l debug -u "/tmp/$NM/sock" & sleep 1 print "Starting collector ..." nsenter --net="$RIGHT" -- tshark -c 2 -lni eth0 -w "/tmp/$NM/pcap" dst 225.1.2.3 & echo $! >> "/tmp/$NM/PIDs" sleep 1 print "Starting emitter ..." nsenter --net="$LEFT" -- ping -c 3 -W 1 -I eth0 -t 3 225.1.2.3 show_mroute print "Analyzing ..." lines=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 225.1.2.3 | tee "/tmp/$NM/result" | wc -l) cat "/tmp/$NM/result" echo " => $lines expected 2" ########################################################################### DONE # one frame lost due to initial (*,G) -> (S,G) setup [ "$lines" = "2" ] && OK FAIL smcroute-2.5.5/test/reload6.sh0000755000175100001710000000406114146403320013152 00000000000000#!/bin/sh # Verifies SIGHUP/reload functionality # XXX: add group verification as well #set -x check_output() { ip -6 mroute |tee "/tmp/$NM/result" | grep -q "$2" oif=$? grep -q "$1" "/tmp/$NM/result" iif=$? # shellcheck disable=SC2166 [ "$oif" = "0" -a "$iif" = "0" ] || FAIL } # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" print "Creating world ..." topo plus ip addr add 2001:1::1/64 dev a1 ip addr add 2001:2::1/64 dev a2 ip addr add 2001:3::1/64 dev a3 ip addr add 2001:4::1/64 dev a4 ip addr add 2001:5::1/64 dev b1 ip addr add 2001:6::1/64 dev b2 ip addr add 2001:7::1/64 dev b3 ip addr add 2001:8::1/64 dev b4 ip -br a print "Creating config #1 ..." cat < "/tmp/$NM/conf" phyint a1 enable ttl-threshold 1 phyint b1 enable ttl-threshold 1 phyint b3 enable ttl-threshold 3 mgroup from a1 source fc00::1 group ff2e::42 mroute from a1 source fc00::1 group ff2e::42 to b1 b3 mgroup from a1 group ff2e::43 mroute from a1 group ff2e::43 to b1 mroute from a1 group ff2e::44 to b1 EOF cat "/tmp/$NM/conf" print "Starting smcrouted ..." ../src/smcrouted -f "/tmp/$NM/conf" -N -n -P "/tmp/$NM/pid" -l debug -u "/tmp/$NM/sock" & sleep 1 ../src/smcroutectl -pu "/tmp/$NM/sock" show groups ip -6 maddr cat /proc/net/ip6_mr_vif show_mroute check_output "Iif: a1" "Oifs: b1 b3" print "Creating config #2 ..." cat < "/tmp/$NM/conf" phyint a1 enable ttl-threshold 1 phyint a3 enable ttl-threshold 3 phyint b2 enable ttl-threshold 2 phyint b3 enable ttl-threshold 3 phyint b4 enable ttl-threshold 4 mgroup from a1 source fc00::1 group ff2e::42 mroute from a1 source fc00::1 group ff2e::42 to b2 b3 mgroup from a3 group ff2e::44 mroute from a3 group ff2e::44 to b3 b4 EOF cat "/tmp/$NM/conf" ../src/smcroutectl -u "/tmp/$NM/sock" reload sleep 1 ../src/smcroutectl -pu "/tmp/$NM/sock" show groups ip -6 maddr cat /proc/net/ip6_mr_vif show_mroute check_output "Iif: a1" "Oifs: b3 b2" print "Updating route from smcroutectl ..." ../src/smcroutectl -u "/tmp/$NM/sock" add a1 fc00::1 ff2e::42 b4 show_mroute check_output "Iif: a1" "Oifs: b3 b2 b4" OK smcroute-2.5.5/test/joinlen.sh0000755000175100001710000000767314146403320013270 00000000000000#!/bin/sh # only checking for a sample in each range check_output() { print "Verifying ..." if [ -n "$1" ]; then ip maddr show dev a2 if ! ip maddr show dev a2 | grep -q "$1"; then FAIL "Cannot find (* $1)" fi fi if [ -n "$2" ]; then cat /proc/net/mcfilter if ! grep -q "$2" /proc/net/mcfilter; then FAIL "Cannot find ($2)" fi fi } check_output6() { print "Verifying ..." if [ -n "$1" ]; then ip -6 maddr show dev a2 if ! ip -6 maddr show dev a2 | grep -q "$1"; then FAIL "Cannot find (* $1)" fi fi if [ -n "$2" ]; then cat /proc/net/mcfilter6 if ! grep -q "$2" /proc/net/mcfilter6; then FAIL "Cannot find ($2)" fi fi } # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" print "Creating world ..." topo basic # IP world ... ip addr add 10.0.0.1/24 dev a1 ip addr add 20.0.0.1/24 dev a2 ip addr add 2001:1::1/64 dev a1 ip addr add 2001:2::1/64 dev a2 ip -br a ################################################################## STATIC GROUPS print "Phase 1: Join groups (.conf)" cat < "/tmp/$NM/conf" # ASM + SSM join/leave multicast groups phyint a1 enable phyint a2 enable mgroup from a1 source 10.0.0.10 group 225.1.2.40/24 mgroup from a2 group 225.3.2.250/24 EOF cat "/tmp/$NM/conf" print "Starting smcrouted ..." ../src/smcrouted -f "/tmp/$NM/conf" -n -N -P "/tmp/$NM/pid" -l debug -u "/tmp/$NM/sock" & sleep 1 check_output "225.3.2.249" "0xe101022a 0x0a00000a" ################################################################### LEAVE GROUPS ../src/smcroutectl -u "/tmp/$NM/sock" leave a1 10.0.0.10 225.1.2.40/24 ../src/smcroutectl -u "/tmp/$NM/sock" leave a2 225.3.2.250/24 cat /proc/net/mcfilter ip maddr show dev a2 #################################################################### JOIN GROUPS print "Phase 2: Join groups (IPC)" ../src/smcroutectl -u "/tmp/$NM/sock" join a1 10.0.0.10 225.1.1.1/30 ../src/smcroutectl -u "/tmp/$NM/sock" join a2 225.0.0.1/30 check_output "225.0.0.2" "0xe1010102 0x0a00000a" ################################################################### LEAVE GROUPS print "Debug 1 ..." ../src/smcroutectl -u "/tmp/$NM/sock" show group ../src/smcroutectl -u "/tmp/$NM/sock" leave a1 10.0.0.10 225.1.1.1/30 ../src/smcroutectl -u "/tmp/$NM/sock" leave a2 225.0.0.1/30 ################################################################### JOIN SOURCES print "Debug 2 ..." ../src/smcroutectl -u "/tmp/$NM/sock" show group print "Phase 3: Join group from multiple sources (IPC)" ../src/smcroutectl -u "/tmp/$NM/sock" join a1 10.0.0.1/26 225.1.2.3 check_output "" "0xe1010203 0x0a00003e" ################################################################### LEAVE GROUPS print "Debug 3 ..." ../src/smcroutectl -u "/tmp/$NM/sock" show group ../src/smcroutectl -u "/tmp/$NM/sock" leave a1 10.0.0.1/26 225.1.2.3 ######################################################## JOIN SOURCES AND GROUPS print "Phase 4: Join multiple groups from multiple sources (IPC)" ../src/smcroutectl -u "/tmp/$NM/sock" join a1 10.0.0.1/30 225.1.2.3/30 check_output "" "0xe1010201 0x0a000003" ############################################################## JOIN IPv6 SOURCES print "Phase 5: Join IPv6 group from multiple sources (IPC)" ../src/smcroutectl -u "/tmp/$NM/sock" join a1 2001:1::1/122 ff2e::42 check_output6 "" "ff2e0000000000000000000000000042 2001000100000000000000000000001c" ../src/smcroutectl -u "/tmp/$NM/sock" show group ../src/smcroutectl -u "/tmp/$NM/sock" leave a1 2001:1::1/122 ff2e::42 ################################################### JOIN IPv6 SOURCES AND GROUPS print "Phase 6: Join multiple IPv6 groups from multiple sources (IPC)" ../src/smcroutectl -u "/tmp/$NM/sock" join a1 2001:1::1/126 ff2e::42/126 check_output6 "" "ff2e0000000000000000000000000041 20010001000000000000000000000002" ../src/smcroutectl -u "/tmp/$NM/sock" show group ../src/smcroutectl -u "/tmp/$NM/sock" leave a1 2001:1::1/122 ff2e::42/126 ########################################################################### DONE OK smcroute-2.5.5/test/Makefile.in0000644000175100001710000006140114146403357013337 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/misc.m4 \ $(top_srcdir)/m4/mroute.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.sh.log=.log) SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/aux/test-driver SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/aux/test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAEMON_TYPE = @DAEMON_TYPE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DOCDIR = @DOCDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PTHREAD = @LIB_PTHREAD@ LIB_RT = @LIB_RT@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ SBINDIR = @SBINDIR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libsystemd_CFLAGS = @libsystemd_CFLAGS@ libsystemd_LIBS = @libsystemd_LIBS@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ systemddir = @systemddir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = adv.sh basic.sh bridge.sh dyn.sh expire.sh gre.sh ipv6.sh \ include.sh isolated.sh join.sh joinlen.sh lib.sh lost.sh \ multi.sh mem.sh mrcache.sh mrcache6.sh mrdisc.sh poison.sh \ reload.sh reload6.sh vlan.sh vrfy.sh CLEANFILES = *~ *.trs *.log TEST_EXTENSIONS = .sh TESTS_ENVIRONMENT = unshare -mrun TESTS = expire.sh adv.sh basic.sh bridge.sh dyn.sh gre.sh include.sh \ ipv6.sh isolated.sh join.sh joinlen.sh lost.sh mem.sh \ mrcache.sh mrcache6.sh mrdisc.sh multi.sh poison.sh reload.sh \ reload6.sh vlan.sh vrfy.sh all: all-am .SUFFIXES: .SUFFIXES: .log .sh .sh$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign test/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): tags TAGS: ctags CTAGS: cscope cscopelist: # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? .sh.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.sh$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-TESTS check-am clean clean-generic \ cscopelist-am ctags-am distclean distclean-generic distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am recheck tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: smcroute-2.5.5/test/mrcache6.sh0000755000175100001710000000245014146403320013306 00000000000000#!/bin/sh # Verifies IPv6 (S,G) add and remove route via IPC bites in kernel. # Twist: uses only one interface, inteded to mimic Debian test. #set -x # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" debug() { cat /proc/net/ip6_mr_cache ip -6 mroute echo "-----------------------------------------------------------------------------------" ../src/smcroutectl -pd -u "/tmp/$NM/sock" } print "Creating world ..." topo basic ip addr add fc01::1/64 dev a1 ip -br a print "Creating config ..." cat < "/tmp/$NM/conf" # empty EOF cat "/tmp/$NM/conf" print "Starting smcrouted ..." ../src/smcrouted -f "/tmp/$NM/conf" -n -P "/tmp/$NM/pid" -l debug -u "/tmp/$NM/sock" & sleep 1 print "Adding IPC route ..." ../src/smcroutectl -u "/tmp/$NM/sock" add a1 fc01::1 ff01:0:0:0:0:0:0:114 a1 sleep 1 print "Verifying kernel route ..." debug if ! grep "ff01:0000:0000:0000:0000:0000:0000:0114 fc01:0000:0000:0000:0000:0000:0000:0001 2 0 0 0 2:1" /proc/net/ip6_mr_cache; then FAIL fi print "Removing IPC route ..." ../src/smcroutectl -u "/tmp/$NM/sock" del a1 fc01::1 ff01:0:0:0:0:0:0:114 sleep 1 print "Verifying kernel route ..." debug if grep "ff01:0000:0000:0000:0000:0000:0000:0114 fc01:0000:0000:0000:0000:0000:0000:0001" /proc/net/ip_mr_cache; then FAIL fi OK smcroute-2.5.5/test/basic.sh0000755000175100001710000000521314146403320012677 00000000000000#!/bin/sh # Verifies IPv4 (S,G) and (*,G) rules by injecting frames on one # interface and verifying reception on another. #set -x # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" print "Creating world ..." topo basic ip addr add 10.0.0.1/24 dev a1 ip addr add 20.0.0.1/24 dev a2 ip -br a print "Creating config ..." cat < "/tmp/$NM/conf" # basic (*,G) multicast routing phyint a1 enable phyint a2 enable mgroup from a1 source 10.0.0.1 group 225.3.2.1 mroute from a1 source 10.0.0.1 group 225.3.2.1 to a2 mgroup from a1 group 225.1.2.3 mroute from a1 group 225.1.2.3 to a2 EOF cat "/tmp/$NM/conf" print "Starting smcrouted ..." ../src/smcrouted -f "/tmp/$NM/conf" -n -N -P "/tmp/$NM/pid" -l debug -u "/tmp/$NM/sock" & sleep 1 echo "-----------------------------------------------------------------------------------" ../src/smcroutectl -pu "/tmp/$NM/sock" show interfaces echo "-----------------------------------------------------------------------------------" ip maddress echo "-----------------------------------------------------------------------------------" cat /proc/net/mcfilter echo "-----------------------------------------------------------------------------------" ../src/smcroutectl -pu "/tmp/$NM/sock" show groups collect a2 -c12 'dst 225.3.2.1 or dst 225.1.2.3 or dst 225.1.2.4 or 225.1.2.5' print "Adding IPC routes ..." ../src/smcroutectl -u "/tmp/$NM/sock" add a1 225.1.2.4 a2 ../src/smcroutectl -u "/tmp/$NM/sock" add a1 10.0.0.1 225.1.2.5 a2 show_mroute print "Starting emitter ..." ping -c 3 -W 1 -I a1 -t 2 225.3.2.1 >/dev/null ping -c 3 -W 1 -I a1 -t 2 225.1.2.3 >/dev/null ping -c 3 -W 1 -I a1 -t 2 225.1.2.4 >/dev/null ping -c 3 -W 1 -I a1 -t 2 225.1.2.5 >/dev/null show_mroute print "Analyzing ..." lines1=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 225.1.2.3 | tee "/tmp/$NM/result" | wc -l) lines2=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 225.3.2.1 | tee -a "/tmp/$NM/result" | wc -l) lines3=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 225.1.2.4 | tee -a "/tmp/$NM/result" | wc -l) lines4=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 225.1.2.5 | tee -a "/tmp/$NM/result" | wc -l) cat "/tmp/$NM/result" echo " => $lines1 for 225.1.2.3, expected => 2" echo " => $lines2 for 225.3.2.1, expected => 3" echo " => $lines3 for 225.1.2.4, expected => 2" echo " => $lines4 for 225.1.2.5, expected => 3" ########################################################################### DONE # Expect one frame lost due to initial (*,G) -> (S,G) route setup, while # we don't expect any frame loss in pure (S,G) routes # shellcheck disable=SC2166 disable=SC2086 [ $lines1 -ge 2 -a $lines2 -eq 3 -a $lines3 -ge 2 -a $lines4 -eq 3 ] && OK FAIL smcroute-2.5.5/test/poison.sh0000755000175100001710000000421114146403320013122 00000000000000#!/bin/sh # Verify stop-filter, or "poison pill", routes for non-matching routes, # and that they do not affect flows from matching routes. check_output() { if ! ip $1 mroute | grep -q "$2"; then FAIL "Did not even register $2" fi if ip $1 mroute | grep -q "$2" | grep -q "$3"; then FAIL "No stop-filter route set for $2" fi } # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" print "Creating world ..." topo plus ip -d l ip addr add 10.0.0.1/24 dev a1 ip addr add 20.0.0.1/24 dev a2 ip addr add 30.0.0.1/24 dev b3 ip addr add 2001:1::1/64 dev a1 ip addr add fc00::42/64 dev a1 ip addr add 2001:2::1/64 dev a2 ip addr add 2001:3::1/64 dev b3 ip -br a print "Creating config ..." cat < "/tmp/$NM/conf" # basic (*,G/LEN) multicast routing phyint a1 enable phyint a2 enable phyint b3 enable mroute from a1 group 225.1.2.3/24 to b3 mroute from a2 group 225.1.2.3/24 to b3 mroute from a1 group ff2e::42/121 to b3 EOF cat "/tmp/$NM/conf" print "Starting smcrouted ..." ../src/smcrouted -f "/tmp/$NM/conf" -n -N -P "/tmp/$NM/pid" -l debug -u "/tmp/$NM/sock" & sleep 1 collect b3 -c15 'dst 225.1.2.1 or dst ff2e::42' ip -d l ip -br a print "Starting emitter ..." ping -c 3 -W 1 -I b3 -t 2 225.1.2.1 >/dev/null ping -c 3 -W 1 -I a2 -t 2 225.1.2.1 >/dev/null ping -c 3 -W 1 -I a1 -t 2 225.1.2.1 >/dev/null ping -6 -c 3 -W 1 -I b3 -t 2 ff2e::42 >/dev/null ping -6 -c 3 -W 1 -I fc00::42 -t 2 ff2e::42 >/dev/null show_mroute print "Analyzing ..." check_output -4 "(30.0.0.1,225.1.2.1)" "Oifs: b3" check_output -6 "(2001:3::1,ff2e::42)" "Oifs: b3" lines1=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 225.1.2.1 | tee "/tmp/$NM/result" | wc -l) lines2=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep ff2e::42 | tee -a "/tmp/$NM/result" | wc -l) cat "/tmp/$NM/result" echo " => $lines1 for 225.1.2.1, expected >= 7" echo " => $lines2 for ff2e::42, expected >= 5" ########################################################################### DONE # Expect one frame lost due to initial (*,G) -> (S,G) route setup # shellcheck disable=SC2166 disable=SC2086 [ $lines1 -ge 7 -a $lines2 -ge 5 ] && OK FAIL smcroute-2.5.5/test/bridge.sh0000755000175100001710000000305514146403320013054 00000000000000#!/bin/sh # Verifies (*,G) routing between VLANs on top of a VLAN filtering bridge # with bridge ports as VETH interfaces. The endpoints of the VETH pairs # are placed in isolated network namespaces to allow IP networking as # one expects. #set -x # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" LEFT=/tmp/$NM/b1 RIGHT=/tmp/$NM/b2 print "Creating world ..." topo isolated bridge "$LEFT" "$RIGHT" # IP World ip addr add 10.0.0.1/24 dev vlan1 nsenter --net="$LEFT" -- ip addr add 10.0.0.10/24 dev eth0 ip addr add 20.0.0.1/24 dev vlan2 nsenter --net="$RIGHT" -- ip addr add 20.0.0.10/24 dev eth0 bridge link bridge vlan ip -br a print "Creating config ..." cat < "/tmp/$NM/conf" # vlan (*,G) multicast routing phyint vlan1 enable phyint vlan2 enable mroute from vlan1 group 225.1.2.3 to vlan2 EOF cat "/tmp/$NM/conf" print "Starting smcrouted ..." ../src/smcrouted -f "/tmp/$NM/conf" -n -N -P "/tmp/$NM/pid" -u "/tmp/$NM/sock" & sleep 1 print "Starting collector ..." nsenter --net="$RIGHT" -- tshark -c 2 -lni eth0 -w "/tmp/$NM/pcap" 'dst 225.1.2.3' 2>/dev/null & echo $! >> "/tmp/$NM/PIDs" sleep 1 print "Starting emitter ..." nsenter --net="$LEFT" -- ping -c 3 -W 1 -I eth0 -t 3 225.1.2.3 show_mroute print "Analyzing ..." lines=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 225.1.2.3 | tee "/tmp/$NM/result" | wc -l) cat "/tmp/$NM/result" echo " => $lines for 225.1.2.3, expected => 2" ########################################################################### DONE # one frame lost due to initial (*,G) -> (S,G) setup [ "$lines" = "2" ] && OK FAIL smcroute-2.5.5/test/lib.sh0000755000175100001710000002067614146403320012376 00000000000000#!/bin/sh # Helper functions for testing SMCRoute # Test name, used everywhere as /tmp/$NM/foo NM=$(basename "$0" .sh) # Print heading for test phases print() { printf "\e[7m>> %-80s\e[0m\n" "$1" } SKIP() { print "TEST: SKIP" [ $# -gt 0 ] && echo "$*" exit 77 } FAIL() { print "TEST: FAIL" [ $# -gt 0 ] && echo "$*" exit 99 } OK() { print "TEST: OK" [ $# -gt 0 ] && echo "$*" exit 0 } check_dep() { if [ -n "$2" ]; then if ! $@; then SKIP "$* is not supported on this system." fi elif ! command -v "$1"; then SKIP "Cannot find $1, skipping test." fi } show_mroute() { # Show active routes (and counters) cat /proc/net/ip_mr_cache cat /proc/net/ip6_mr_cache echo "-----------------------------------------------------------------------------------" ip mroute ip -6 mroute echo "-----------------------------------------------------------------------------------" ../src/smcroutectl -pd -u "/tmp/$NM/sock" } emitter() { print "Starting emitter(s) on $1 ..." for i in $(seq 1 $2); do ping -I $1 -W 1 -t 3 225.1.2.$i >/dev/null & echo $! >> "/tmp/$NM/PIDs" done } collect() { print "Starting collector on $1 ..." tshark -w "/tmp/$NM/pcap" -lni "$@" 2>/dev/null & echo $! >> "/tmp/$NM/PIDs" sleep 2 } # Set up a basic bridge topology, two VETH pairs with one end in the # bridge and the other free. Each pair is also in a separate VLAN. # # No IP address assignment is done in topo files, only topology setup. # # Topology: ¦ # vlan1 ¦ vlan2 # \ ¦ / # a1 -------- br0 --------- a2 # ¦ # VLAN 1 ¦ VLAN 2 # # Note: in addition to VLAN filtering, the bridge has both IGMP and MLD # snooping disabled, because the main purpose of these tests is to # verify the IPv4 and IPv6 routing functionality of SMCRoute. # Future tests may include verifying join/leave of groups (TODO) topo_bridge() { cat << EOF > "$NM-topo.ip" link add br0 type bridge vlan_filtering 1 mcast_snooping 0 link add a1 type veth peer b1 link add a2 type veth peer b2 link set b1 master br0 link set b2 master br0 link set a1 up link set b1 up link set a2 up link set b2 up link set br0 up link add link br0 vlan1 type vlan id 1 link add link br0 vlan2 type vlan id 2 link set vlan1 up link set vlan2 up EOF # Move b2 to VLAN 2 # Set br0 as tagged member of both VLANs cat < "$NM-bridge.ip" vlan add vid 2 dev b2 pvid untagged vlan del vid 1 dev b2 vlan add vid 1 dev br0 self vlan add vid 2 dev br0 self EOF ip -force -batch "$NM-topo.ip" bridge -force -batch "$NM-bridge.ip" rm -f "$NM-topo.ip" "$NM-bridge.ip" } # Set up a basic dummy interface topology, # # No IP address assignment is done in topo files, only topology setup. topo_basic() { cat << EOF > "$NM-topo.ip" link add a1 type dummy link set a1 up link set a1 multicast on link add a2 type dummy link set a2 up link set a2 multicast on EOF ip -force -batch "$NM-topo.ip" rm -f "$NM-topo.ip" return 2 } # Same as basic topology, but with more inbound/outbound interfaces. # # No IP address assignment is done in topo files, only topology setup. topo_plus() { cat << EOF > "$NM-topo.ip" link add a1 type dummy link set a1 up link set a1 multicast on link add a2 type dummy link set a2 up link set a2 multicast on link add a3 type dummy link set a3 up link set a3 multicast on link add a4 type dummy link set a4 up link set a4 multicast on link add b1 type dummy link set b1 up link set b1 multicast on link add b2 type dummy link set b2 up link set b2 multicast on link add b3 type dummy link set b3 up link set b3 multicast on link add b4 type dummy link set b4 up link set b4 multicast on EOF ip -force -batch "$NM-topo.ip" rm -f "$NM-topo.ip" } # Set up VLAN interfaces on top of dummy interfaces # shellcheck disable=SC2048 topo_basic_vlan() { num=$1 shift i=1 while [ $i -le "$num" ]; do iface=a$i i=$((i + 1)) for vid in $*; do ip link add "$iface.$vid" link $iface type vlan id "$vid" ip link set "$iface.$vid" up ip link set "$iface.$vid" multicast on done done } topo_isolated() { left="$1" right="$2" lif=$(basename "$left") rif=$(basename "$right") touch "$left" "$right" PID=$$ echo "$left" > "/tmp/$NM/mounts" echo "$right" >> "/tmp/$NM/mounts" unshare --net="$left" -- ip link set lo up nsenter --net="$left" -- ip link add eth0 type veth peer "$lif" nsenter --net="$left" -- ip link set "$lif" netns $PID nsenter --net="$left" -- ip link set eth0 up ip link set "$lif" up unshare --net="$right" -- ip link set lo up nsenter --net="$right" -- ip link add eth0 type veth peer "$rif" nsenter --net="$right" -- ip link set "$rif" netns $PID nsenter --net="$right" -- ip link set eth0 up ip link set "$rif" up } # Same as bridge topology, but with the VETH endpoints constructed # by the isolated topology. We just rename the main namespace's # bridge ports to match. topo_isolated_bridge() { left="$1" right="$2" lif=$(basename "$left") rif=$(basename "$right") topo_isolated "$@" echo "Creating br0, adding $lif and $rif as bridge ports" ip link add br0 type bridge vlan_filtering 1 mcast_snooping 0 ip link set "$lif" master br0 ip link set "$rif" master br0 ip link set br0 up ip link add link br0 vlan1 type vlan id 1 ip link add link br0 vlan2 type vlan id 2 ip link set vlan1 up ip link set vlan2 up bridge vlan add vid 2 dev "$rif" pvid untagged bridge vlan del vid 1 dev "$rif" bridge vlan add vid 1 dev br0 self bridge vlan add vid 2 dev br0 self } # Variant of a variant ... this is the Multi Domain topology. It has # two isolated network namespaces and a shared segment connecting them. # The intention is to emulate network setups where the same base subnet # is reused in many places. So that when interconnecting them a string # of 1:1 NAT operations need to performed. These type of setups are # more common than one might think; factories, train cars, ... tanks. # # Note, the bridge is only used to connect the ends of the VETH pairs. topo_multi() { left="$1" right="$2" lif=$(basename "$left") rif=$(basename "$right") topo_isolated "$@" nsenter --net="$left" -- ip link add eth1 type dummy nsenter --net="$left" -- ip link set eth1 up nsenter --net="$left" -- ip link set eth1 multicast on nsenter --net="$right" -- ip link add eth1 type dummy nsenter --net="$right" -- ip link set eth1 up nsenter --net="$right" -- ip link set eth1 multicast on echo "Creating br0, adding $lif and $rif as bridge ports" ip link add br0 type bridge ip link set "$lif" master br0 ip link set "$rif" master br0 ip link set br0 up } topo_teardown() { if [ -z "$NM" ]; then echo "NM variable unset, skippnig teardown" exit 1 fi if [ -f "/tmp/$NM/pid" ]; then PID=$(cat "/tmp/$NM/pid") kill -9 "$PID" fi # shellcheck disable=SC2162 if [ -f "/tmp/$NM/mounts" ]; then while read ln; do umount "$ln"; rm "$ln"; done < "/tmp/$NM/mounts" fi # shellcheck disable=SC2162 if [ -f "/tmp/$NM/PIDs" ]; then while read ln; do kill "$ln" 2>/dev/null; done < "/tmp/$NM/PIDs" fi ip link del br0 2>/dev/null ip link del a1 2>/dev/null ip link del a2 2>/dev/null ip link del b1 2>/dev/null ip link del b2 2>/dev/null rm -rf "/tmp/$NM" } signal() { echo if [ "$1" != "EXIT" ]; then print "Got signal, cleaning up" fi topo_teardown } # props to https://stackoverflow.com/a/2183063/1708249 trapit() { func="$1" ; shift for sig ; do trap "$func $sig" "$sig" done } topo() { if [ $# -lt 1 ]; then print "Too few arguments to topo()" exit 1 fi t=$1 shift case "$t" in bridge) topo_bridge ;; basic) topo_basic num=$? case "$1" in vlan) shift topo_basic_vlan $num "$@" ;; esac ;; isolated) case "$1" in bridge) shift topo_isolated_bridge "$@" ;; *) topo_isolated "$@" ;; esac ;; multi) topo_multi "$@" ;; plus) topo_plus ;; teardown) topo_teardown ;; *) print "No such topology: $t" exit 1 ;; esac } # Runs once when including lib.sh mkdir "/tmp/$NM" touch "/tmp/$NM/PIDs" trapit signal INT TERM QUIT EXIT smcroute-2.5.5/test/lost.sh0000755000175100001710000000434714146403320012606 00000000000000#!/bin/sh # Verify handling when IIF for an (S,G) is changed or lost #set -x check_output() { echo "ip mroute:" ip mroute ip mroute |tee "/tmp/$NM/result" | grep -q "$2" oif=$? grep -q "$1" "/tmp/$NM/result" iif=$? # shellcheck disable=SC2166 [ "$oif" = "0" -a "$iif" = "0" ] || FAIL } # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" print "Creating world ..." topo basic ip addr add 10.0.0.1/24 dev a1 ip addr add 20.0.0.1/24 dev a2 ip -br a print "Creating config #1 ..." cat < "/tmp/$NM/conf" phyint a1 enable phyint a2 enable mgroup from a1 group 225.1.2.3 mroute from a1 group 225.1.2.3 to a2 mgroup from a2 group 225.1.2.4 mroute from a2 source 1.2.3.4 group 225.1.2.4 to a1 mgroup from a1 group 225.2.2.5 mroute from a1 group 225.2.2.5 to a1 mgroup from a2 group 225.1.2.6 mroute from a2 source 1.2.3.5 group 225.1.2.6 to a1 EOF cat "/tmp/$NM/conf" print "Starting smcrouted ..." ../src/smcrouted -f "/tmp/$NM/conf" -N -n -P "/tmp/$NM/pid" -l debug -u "/tmp/$NM/sock" & sleep 1 cat /proc/net/ip_mr_vif cat /proc/net/ip_mr_cache ../src/smcroutectl -pu "/tmp/$NM/sock" show groups show_mroute check_output "(1.2.3.4,225.1.2.4) Iif: a2 Oifs: a1" print "Creating config #2 ..." cat < "/tmp/$NM/conf" phyint a1 enable phyint a2 enable mgroup from a1 group 225.1.2.3 mroute from a1 group 225.1.2.3 to a2 mgroup from a1 group 225.1.2.4 mroute from a1 source 1.2.3.4 group 225.1.2.4 to a2 mgroup from a2 group 225.2.2.5 mroute from a2 group 225.2.2.5 to a1 mgroup from a2 group 225.1.2.6 mroute from a2 source 1.2.3.5 group 225.1.2.6 to a1 EOF cat "/tmp/$NM/conf" ../src/smcroutectl -u "/tmp/$NM/sock" reload sleep 1 check_output "(1.2.3.4,225.1.2.4) Iif: a1 Oifs: a2" print "Deleting and restoring interface a1 => new ifindex ..." ip link del a1 ip link add a1 type dummy ip link set a1 up ip link set a1 multicast on ip addr add 10.0.0.1/24 dev a1 ../src/smcroutectl -u "/tmp/$NM/sock" reload sleep 1 check_output "(1.2.3.4,225.1.2.4) Iif: a1 Oifs: a2" print "Deleting interface a1 ..." ip link del a1 ../src/smcroutectl -u "/tmp/$NM/sock" reload sleep 1 check_output "(1.2.3.5,225.1.2.6) Iif: a2 State: resolved" OK smcroute-2.5.5/test/reload.sh0000755000175100001710000000414614146403320013070 00000000000000#!/bin/sh # Verifies SIGHUP/reload functionality # XXX: add group verification as well #set -x check_output() { echo "ip mroute:" ip mroute ip mroute |tee "/tmp/$NM/result" | grep -q "$2" oif=$? grep -q "$1" "/tmp/$NM/result" iif=$? # shellcheck disable=SC2166 [ "$oif" = "0" -a "$iif" = "0" ] || FAIL } # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" print "Creating world ..." topo plus ip addr add 10.0.0.1/24 dev a1 ip addr add 20.0.0.1/24 dev a2 ip addr add 30.0.0.1/24 dev a3 ip addr add 40.0.0.1/24 dev a4 ip addr add 50.0.0.1/24 dev b1 ip addr add 60.0.0.1/24 dev b2 ip addr add 70.0.0.1/24 dev b3 ip addr add 80.0.0.1/24 dev b4 ip -br a print "Creating config #1 ..." cat < "/tmp/$NM/conf" phyint a1 enable phyint b1 enable phyint b3 enable mgroup from a1 source 10.0.0.1 group 225.3.2.1 mroute from a1 source 10.0.0.1 group 225.3.2.1 to b1 b3 mgroup from a1 group 225.1.2.3 mroute from a1 group 225.1.2.3 to b1 mroute from a1 group 225.1.2.4 to b1 EOF cat "/tmp/$NM/conf" print "Starting smcrouted ..." ../src/smcrouted -f "/tmp/$NM/conf" -N -n -P "/tmp/$NM/pid" -l debug -u "/tmp/$NM/sock" & sleep 1 cat /proc/net/ip_mr_vif cat /proc/net/ip_mr_cache ../src/smcroutectl -pu "/tmp/$NM/sock" show groups show_mroute check_output "Iif: a1" "Oifs: b1 b3" print "Creating config #2 ..." cat < "/tmp/$NM/conf" phyint a1 enable ttl-threshold 1 phyint a3 enable ttl-threshold 3 phyint b2 enable ttl-threshold 2 phyint b3 enable ttl-threshold 3 phyint b4 enable ttl-threshold 4 mgroup from a1 source 10.0.0.1 group 225.3.2.1 mroute from a1 source 10.0.0.1 group 225.3.2.1 to b2 b3 mgroup from a3 group 225.1.2.4 mroute from a3 group 225.1.2.4 to b3 b4 EOF cat "/tmp/$NM/conf" ../src/smcroutectl -u "/tmp/$NM/sock" reload sleep 1 cat /proc/net/ip_mr_vif cat /proc/net/ip_mr_cache ../src/smcroutectl -pu "/tmp/$NM/sock" show groups show_mroute check_output "Iif: a1" "Oifs: b3(ttl 3) b2(ttl 2)" print "Updating route from smcroutectl ..." ../src/smcroutectl -u "/tmp/$NM/sock" add a1 10.0.0.1 225.3.2.1 b4 show_mroute check_output "Iif: a1" "Oifs: b3(ttl 3) b2(ttl 2) b4(ttl 4)" OK smcroute-2.5.5/test/adv.sh0000755000175100001710000000435714146403320012400 00000000000000#!/bin/sh # Verify stop-filter to SSM transition by adding *,G/LEN routes #set -x # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" print "Creating world ..." topo basic ip addr add 10.0.0.1/24 dev a1 ip addr add 20.0.0.1/24 dev a2 ip -br a print "Creating config ..." cat < "/tmp/$NM/conf" phyint a1 enable phyint a2 enable mroute from a1 source 10.0.0.1 group 225.1.2.3 to a2 EOF cat "/tmp/$NM/conf" print "Starting smcrouted ..." ../src/smcrouted -f "/tmp/$NM/conf" -n -N -P "/tmp/$NM/pid" -l debug -u "/tmp/$NM/sock" & # Start emitters on a1 for 225.1.2.1 .. 225.1.2.10 emitter a1 10 show_mroute # Sanity check, the route from the conf file should work collect a2 -c3 'dst 225.1.2.3' sleep 3 lines1=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 225.1.2.3 | tee "/tmp/$NM/result" | wc -l) # shellcheck disable=SC2086 [ $lines1 -lt 3 ] && FAIL # Add (*,G) routes for 225.1.2.1 .. 225.1.2.7, overlapping with previous 225.1.2.3 print "Adding *,225.1.2.3/29 ASM routes ..." ../src/smcroutectl -u "/tmp/$NM/sock" add a1 225.1.2.3/29 a2 show_mroute # Check for a sample of the added routes collect a2 -c6 'dst 225.1.2.6 or dst 225.1.2.3' sleep 3 print "Analyzing ..." lines1=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 225.1.2.3 | tee "/tmp/$NM/result" | wc -l) lines2=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 225.1.2.6 | tee -a "/tmp/$NM/result" | wc -l) cat "/tmp/$NM/result" # shellcheck disable=SC2086 disable=SC2166 [ $lines1 -lt 3 -o $lines2 -lt 3 ] && FAIL # When removing (*,G) routes, the (S,G) route from the conf file should remain print "Removing *,225.1.2.3/29 ASM routes ..." ../src/smcroutectl -u "/tmp/$NM/sock" del a1 225.1.2.3/29 show_mroute # Check for same sample, now we should no longer see 225.1.2.6, only 225.1.2.3 collect a2 -c3 'dst 225.1.2.6 or dst 225.1.2.3' sleep 3 print "Analyzing ..." lines1=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 225.1.2.3 | tee "/tmp/$NM/result" | wc -l) lines2=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 225.1.2.6 | tee -a "/tmp/$NM/result" | wc -l) cat "/tmp/$NM/result" echo " => $lines1 for group 225.1.2.3 from R1, expected > 1" echo " => $lines2 for group 225.1.2.6 from R2, expected = 0" # shellcheck disable=SC2086 disable=SC2166 [ $lines1 -gt 1 -a $lines2 -eq 0 ] && OK FAIL smcroute-2.5.5/test/vrfy.sh0000755000175100001710000000137414146403320012610 00000000000000#!/bin/sh # Limited verifier of the smcrouted .conf file checker # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" print "Creating world ..." topo basic ip addr add 10.0.0.1/24 dev a1 ip addr add 20.0.0.1/24 dev a2 ip -br l print "Creating config ..." cat < "/tmp/$NM/conf" # basic (*,G) multicast routing phyint a1 enable phyint a3 enable phyint mgroup from a1 source 10.0.0.1 group 225.3.2.1 mroute from a1 source 10.0.0.1 group 225.3.2.1 to a2 a3 mgroup from a1 group 225.1.2.3 mroute from a1 group 225.1.2.3 to a2 mroute from a3 group 225.1.2.3 to a1 mgroup from b4 group 225.1.2.3 EOF cat "/tmp/$NM/conf" print "Verifying config ..." ../src/smcrouted -N -F "/tmp/$NM/conf" -l info rc=$? echo "Return code: $rc" [ $rc -eq 78 ] && OK FAIL smcroute-2.5.5/test/mrcache.sh0000755000175100001710000000222614146403320013221 00000000000000#!/bin/sh # Verifies IPv4 (S,G) add and remove route via IPC bites in kernel. # Twist: uses only one interface, inteded to mimic Debian test. #set -x # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" debug() { cat /proc/net/ip_mr_cache ip mroute echo "-----------------------------------------------------------------------------------" ../src/smcroutectl -pd -u "/tmp/$NM/sock" } print "Creating world ..." topo basic ip addr add 10.0.0.1/24 dev a1 ip -br a print "Creating config ..." cat < "/tmp/$NM/conf" # empty EOF cat "/tmp/$NM/conf" print "Starting smcrouted ..." ../src/smcrouted -f "/tmp/$NM/conf" -n -P "/tmp/$NM/pid" -l debug -u "/tmp/$NM/sock" & sleep 1 print "Adding IPC route ..." ../src/smcroutectl -u "/tmp/$NM/sock" add a1 10.0.0.1 224.0.1.20 a1 sleep 1 print "Verifying kernel route ..." debug if ! grep "140100E0 0100000A 2 0 0 0 2:1" /proc/net/ip_mr_cache; then FAIL fi print "Removing IPC route ..." ../src/smcroutectl -u "/tmp/$NM/sock" del a1 10.0.0.1 224.0.1.20 sleep 1 print "Verifying kernel route ..." debug if grep "140100E0 0100000A" /proc/net/ip_mr_cache; then FAIL fi OK smcroute-2.5.5/test/dyn.sh0000755000175100001710000000621714146403320012415 00000000000000#!/bin/sh # Verifies (*,G/LEN) and (S/LEN,G) routing by injecting frames on one # interface and verifying reception on another. #set -x # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" print "Creating world ..." topo basic ip addr add 10.0.0.1/24 dev a1 ip addr add 20.0.0.1/24 dev a2 ip addr add 2001:1::1/64 dev a1 ip addr add fc00::42/64 dev a1 ip addr add 2001:2::1/64 dev a2 ip -br a print "Creating config ..." cat < "/tmp/$NM/conf" # basic (*,G/LEN) multicast routing phyint a1 enable phyint a2 enable mroute from a1 group 225.1.2.3/24 to a2 mroute from a1 group ff2e::42/121 to a2 mroute from a1 source 10.0.0.1/24 group 225.3.2.1 to a2 mroute from a1 source fc00::1/64 group ff04::114 to a2 mroute from a1 source 10.0.0.1 group 225.3.3.3/24 to a2 EOF cat "/tmp/$NM/conf" print "Starting smcrouted ..." ../src/smcrouted -f "/tmp/$NM/conf" -n -N -P "/tmp/$NM/pid" -l debug -u "/tmp/$NM/sock" & sleep 1 echo "-----------------------------------------------------------------------------------" ../src/smcroutectl -pu "/tmp/$NM/sock" show interfaces echo "-----------------------------------------------------------------------------------" ../src/smcroutectl -pu "/tmp/$NM/sock" show routes collect a2 -c21 'dst 225.1.2.1 or dst 225.1.2.201 or dst ff2e::42 or dst ff2e::7f or dst 225.3.2.1 or dst ff04::114 or dst 225.3.3.1' print "Starting emitter ..." ping -c 3 -W 1 -I a1 -t 2 225.1.2.1 >/dev/null ping -c 3 -W 1 -I a1 -t 2 225.1.2.201 >/dev/null ping -6 -c 3 -W 1 -I fc00::42 -t 2 ff2e::42 >/dev/null ping -6 -c 3 -W 1 -I fc00::42 -t 2 ff2e::7f >/dev/null ping -c 3 -W 1 -I a1 -t 2 225.3.2.1 >/dev/null ping -6 -c 3 -W 1 -I fc00::42 -t 2 ff04::114 >/dev/null ping -c 3 -W 1 -I a1 -t 2 225.3.3.1 >/dev/null show_mroute print "Analyzing ..." lines1=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 225.1.2.1 | tee "/tmp/$NM/result" | wc -l) lines2=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 225.1.2.201 | tee "/tmp/$NM/result" | wc -l) lines3=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep ff2e::42 | tee "/tmp/$NM/result" | wc -l) lines4=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep ff2e::7f | tee "/tmp/$NM/result" | wc -l) lines5=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 225.3.2.1 | tee "/tmp/$NM/result" | wc -l) lines6=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep ff04::114 | tee "/tmp/$NM/result" | wc -l) lines7=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 225.3.3.1 | tee "/tmp/$NM/result" | wc -l) cat "/tmp/$NM/result" echo " => $lines1 for 225.1.2.1, expected >= 2" echo " => $lines2 for 225.1.2.201, expected >= 2" echo " => $lines3 for ff2e::42, expected >= 2" echo " => $lines4 for ff2e::7f, expected >= 2" echo " => $lines5 for 225.3.2.1, expected >= 2" echo " => $lines6 for ff04::114, expected >= 2" echo " => $lines7 for 225.3.3.1, expected >= 2" ########################################################################### DONE # Expect one frame lost due to initial (*,G) -> (S,G) route setup # shellcheck disable=SC2166 disable=SC2086 [ $lines1 -ge 2 -a $lines2 -ge 2 -a $lines3 -ge 2 -a $lines4 -ge 2 -a $lines5 -ge 2 -a $lines6 -ge 2 -a $lines7 -ge 2 ] && OK FAIL smcroute-2.5.5/test/expire.sh0000755000175100001710000000355114146403320013115 00000000000000#!/bin/sh # Verifies IPv4 and IPv6 (*,G) => learned (S,G) flushing #set -x # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" print "Creating world ..." topo basic # IP world ... ip addr add 10.0.0.1/24 dev a1 ip addr add 2001:1::1/64 dev a1 ip addr add fc00::1/64 dev a1 ip addr add 20.0.0.1/24 dev a1 ip addr add 2001:2::1/64 dev a2 ip -br a print "Creating config ..." cat < "/tmp/$NM/conf" # ipv4 and ipv6 (*,G) multicast routing phyint a1 enable phyint a2 enable mroute from a1 source 10.0.0.10 group 225.3.2.1 to a2 mroute from a1 group 225.1.2.3 to a2 mroute from a1 source fc00::1 group ff04:0:0:0:0:0:0:114 to a2 mroute from a1 group ff2e::42 to a2 EOF cat "/tmp/$NM/conf" print "Starting smcrouted ..." ../src/smcrouted -c 10 -f "/tmp/$NM/conf" -n -N -P "/tmp/$NM/pid" -l debug -u "/tmp/$NM/sock" & sleep 1 collect a2 -c12 'dst ff04::114 or dst ff2e::42 or dst ff2e::43 or dst ff2e::44' print "Starting emitter ..." ping -c 3 -W 1 -I a1 -t 3 225.1.2.3 >/dev/null ping -6 -c 3 -W 1 -I 2001:1::1 -t 3 ff2e::42 >/dev/null show_mroute ip mroute | grep -q "(10.0.0.1,225.1.2.3)" [ $? -eq 0 ] || FAIL "Failed learning IPv4 (*,G) route" ip -6 mroute | grep -q "(2001:1::1,ff2e::42)" [ $? -eq 0 ] || FAIL "Failed learning IPv6 (*,G) route" print "Verifying (*,G) flush, please wait ... " sleep 11 show_mroute ip mroute | grep -q "(10.0.0.1,225.1.2.3)" [ $? -eq 1 ] || FAIL "Failed flushing IPv4 (*,G) route" ip -6 mroute | grep -q "(2001:1::1,ff2e::42)" [ $? -eq 1 ] || FAIL "Failed flushing IPv6 (*,G) route" print "Analyzing ..." lines2=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep ff2e::42 | tee -a "/tmp/$NM/result" | wc -l) cat "/tmp/$NM/result" echo " => $lines2 frames for group ff2e::42, expected >= 2" ########################################################################### DONE # shellcheck disable=SC2086 [ $lines2 -ge 2 ] && OK FAIL smcroute-2.5.5/test/Makefile.am0000644000175100001710000000204214146403320013310 00000000000000EXTRA_DIST = adv.sh basic.sh bridge.sh dyn.sh expire.sh gre.sh ipv6.sh EXTRA_DIST += include.sh isolated.sh join.sh joinlen.sh lib.sh lost.sh EXTRA_DIST += multi.sh mem.sh mrcache.sh mrcache6.sh mrdisc.sh poison.sh EXTRA_DIST += reload.sh reload6.sh vlan.sh vrfy.sh CLEANFILES = *~ *.trs *.log TEST_EXTENSIONS = .sh TESTS_ENVIRONMENT = unshare -mrun TESTS = expire.sh TESTS += adv.sh TESTS += basic.sh TESTS += bridge.sh TESTS += dyn.sh TESTS += gre.sh TESTS += include.sh TESTS += ipv6.sh TESTS += isolated.sh TESTS += join.sh TESTS += joinlen.sh TESTS += lost.sh TESTS += mem.sh TESTS += mrcache.sh TESTS += mrcache6.sh TESTS += mrdisc.sh TESTS += multi.sh TESTS += poison.sh TESTS += reload.sh TESTS += reload6.sh TESTS += vlan.sh TESTS += vrfy.sh smcroute-2.5.5/test/gre.sh0000755000175100001710000000671614146403320012404 00000000000000#!/bin/sh # Verify multicast routing between two routers over a GRE tunnel # # netns: host1 netns: host2 # .-------------. .-------------. # | smcrouted | | smcrouted | # | / \ | br0 | / \ | # MC --> eth1 eth0 | / \ | eth0 eth1 <-- MC # | `------' '-------' | # '-------------' 192.168.0.0/24 '-------------' # 10.0.0.0/24 10.0.0.0/24 # # Note: you may have to `modprobe ip_gre` before the test. # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" print "Checking dependencies ..." lsb_release -a uname -a check_dep grep -q ip_gre /proc/modules print "Creating world ..." topo multi host1 host2 # IP world ... echo "Links, addresses, and routes for host1 =====================================" nsenter --net=host1 -- ip addr add 192.168.0.10/24 dev eth0 nsenter --net=host1 -- ip addr add 10.0.0.1/24 dev eth1 nsenter --net=host1 -- ip tunnel add tun0 mode gre remote 192.168.0.20 local 192.168.0.10 ttl 255 nsenter --net=host1 -- ip addr add 172.16.0.10/24 dev tun0 nsenter --net=host1 -- ip link set tun0 multicast on nsenter --net=host1 -- ip link set tun0 up nsenter --net=host1 -- ip route add 20.0.0.0/24 via 172.16.0.10 nsenter --net=host1 -- ip -br l nsenter --net=host1 -- ip -br a nsenter --net=host1 -- ip -br r echo "Links, addresses, and routes for host2 =====================================" nsenter --net=host2 -- ip addr add 192.168.0.20/24 dev eth0 nsenter --net=host2 -- ip addr add 20.0.0.1/24 dev eth1 nsenter --net=host2 -- ip tunnel add tun0 mode gre remote 192.168.0.10 local 192.168.0.20 ttl 255 nsenter --net=host2 -- ip addr add 172.16.0.20/24 dev tun0 nsenter --net=host2 -- ip link set tun0 multicast on nsenter --net=host2 -- ip link set tun0 up nsenter --net=host2 -- ip route add 10.0.0.0/24 via 172.16.0.20 nsenter --net=host2 -- ip -br l nsenter --net=host2 -- ip -br a nsenter --net=host2 -- ip -br r print "Verifying connectivity ..." printf "host1 (172.16.0.10) " if ! nsenter --net=host1 -- ping -c 3 172.16.0.20; then FAIL "host1: cannot reach host2 over GRE tunnel" fi print "Creating config ..." cat <"/tmp/$NM/shared.conf" # shared.conf for both netns phyint tun0 enable phyint eth1 enable mgroup from eth1 group 225.1.2.3 mroute from eth1 group 225.1.2.3 to tun0 mgroup from tun0 group 225.1.2.3 mroute from tun0 group 225.1.2.3 to eth1 EOF cat "/tmp/$NM/shared.conf" print "Starting smcrouted instances ..." nsenter --net=host1 -- ../src/smcrouted -f "/tmp/$NM/shared.conf" -n -N -i host1 -l debug -u "/tmp/$NM/host1.sock" & echo $! >> "/tmp/$NM/PIDs" nsenter --net=host2 -- ../src/smcrouted -f "/tmp/$NM/shared.conf" -n -N -i host2 -l debug -u "/tmp/$NM/host2.sock" & echo $! >> "/tmp/$NM/PIDs" sleep 1 print "Starting collector on eth1@host2 ..." nsenter --net=host2 -- tshark -w "/tmp/$NM/pcap" -lni eth1 -c5 'dst 225.1.2.3' 2>/dev/null & echo $! >> "/tmp/$NM/PIDs" print "Starting emitters ..." nsenter --net=host1 -- ping -c 5 -W 1 -I eth1 -t 10 225.1.2.3 > /dev/null & sleep 5 print "Analyzing pcap from eth1@host2 ..." lines1=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 225.1.2.3 | tee "/tmp/$NM/result" | wc -l) cat "/tmp/$NM/result" echo " => $lines1 for group 225.1.2.3 from host1, expected >= 4" # Expect one frame loss for each initial (*,G) -> (S,G) route setup # shellcheck disable=SC2086 [ $lines1 -ge 3 ] && OK FAIL smcroute-2.5.5/test/ipv6.sh0000755000175100001710000000564114146403320012507 00000000000000#!/bin/sh # Verifies IPv6 (S,G) and (*,G) rules, both from .conf file and IPC, by # injecting frames on one interface and verify reception on another. #set -x # shellcheck source=/dev/null . "$(dirname "$0")/lib.sh" print "Creating world ..." topo basic # IP world ... ip addr add 2001:1::1/64 dev a1 ip addr add fc00::1/64 dev a1 ip addr add 2001:2::1/64 dev a2 ip addr add 2001:2:3:4:6:7:12:1/64 dev a2 ip -br a print "Creating config ..." cat < "/tmp/$NM/conf" # ipv6 (*,G) multicast routing phyint a1 enable phyint a2 enable mgroup from a1 source fc00::1 group ff04:0:0:0:0:0:0:114 mroute from a1 source fc00::1 group ff04:0:0:0:0:0:0:114 to a2 mgroup from a1 group ff2e::42 mroute from a1 group ff2e::42 to a2 mroute from a1 group ff2e::7 to a2 EOF cat "/tmp/$NM/conf" print "Starting smcrouted ..." ../src/smcrouted -c 5 -f "/tmp/$NM/conf" -n -N -P "/tmp/$NM/pid" -l debug -u "/tmp/$NM/sock" & sleep 1 echo "-----------------------------------------------------------------------------------" ../src/smcroutectl -pu "/tmp/$NM/sock" show interfaces echo "-----------------------------------------------------------------------------------" ip -6 maddress echo "-----------------------------------------------------------------------------------" cat /proc/net/mcfilter6 echo "-----------------------------------------------------------------------------------" ../src/smcroutectl -pu "/tmp/$NM/sock" show groups collect a2 -c12 'dst ff04::114 or dst ff2e::42 or dst ff2e::43 or dst ff2e::44' ../src/smcroutectl -u "/tmp/$NM/sock" add a1 ff2e::43 a2 ../src/smcroutectl -u "/tmp/$NM/sock" add a1 fc00::1 ff2e::44 a2 show_mroute print "Starting emitter ..." ping -6 -c 3 -W 1 -I fc00::1 -t 3 ff04::114 >/dev/null ping -6 -c 3 -W 1 -I 2001:1::1 -t 3 ff2e::42 >/dev/null ping -6 -c 3 -W 1 -I 2001:1::1 -t 3 ff2e::43 >/dev/null ping -6 -c 3 -W 1 -I fc00::1 -t 3 ff2e::44 >/dev/null ping -6 -c 3 -W 1 -I 2001:2:3:4:6:7:12:1 -t 3 ff2e::7 >/dev/null show_mroute print "Analyzing ..." lines1=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep ff04::114 | tee "/tmp/$NM/result" | wc -l) lines2=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep ff2e::42 | tee -a "/tmp/$NM/result" | wc -l) lines3=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep ff2e::43 | tee -a "/tmp/$NM/result" | wc -l) lines4=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep ff2e::44 | tee -a "/tmp/$NM/result" | wc -l) cat "/tmp/$NM/result" echo " => $lines1 for group ff04::114, expected => 3" echo " => $lines2 for group ff2e::42, expected => 2" echo " => $lines3 for group ff2e::43, expected => 2" echo " => $lines4 for group ff2e::44, expected => 3" sleep 10 show_mroute ########################################################################### DONE # one frame lost due to initial (*,G) -> (S,G) route setup # no frames lost in pure (S,G) route # shellcheck disable=SC2166 disable=SC2086 [ $lines1 -eq 3 -a $lines2 -ge 2 -a $lines3 -ge 2 -a $lines4 -eq 3 ] && OK FAIL smcroute-2.5.5/README.md0000644000175100001710000003566014146403320011570 00000000000000SMCRoute - A static multicast routing daemon ============================================ Packaging status [![License Badge][]][License] [![GitHub Status][]][GitHub] [![Coverity Status][]][Coverity Scan] Table of Contents ----------------- * [About](#about) * [Features](#features) * [Usage](#usage) * [Caveat](#caveat) * [Actions Scripts](#action-scripts) * [Many Interfaces](#many-interfaces) * [Multiple Routing Tables](#multiple-routing-tables) * [Client Tool](#client-tool) * [Wildcard Routes](#wildcard-routes) * [Multicast Router Discovery](#multicast-router-discovery) * [Build & Install](#build--install) * [Linux Requirements](#linux-requirements) * [*BSD Requirements](#bsd-requirements) * [General Requirements](#general-requirements) * [Configure & Build](#configure--build) * [Integration with systemd](#integration-with-systemd) * [Static Build](#static-build) * [Building from GIT](#building-from-git) * [Origin & References](#origin--references) About ----- SMCRoute is a static multicast routing daemon providing fine grained control over the multicast forwarding cache (MFC) in the UNIX kernel. Both IPv4 and IPv6 are fully supported. SMCRoute can be used as an alternative to dynamic multicast routers like [mrouted][], [pimd][], or [pim6sd][] in setups where static multicast routes should be maintained and/or no proper IGMP or MLD signaling exists. Multicast routes exist in the UNIX kernel as long as a multicast routing daemon runs. On Linux, multiple multicast routers can run simultaneously using different multicast routing tables. The full documentation of SMCRoute is available in the manual pages, see [smcrouted(8)][], [smcroutectl(8)][], and [smcroute.conf(5)][]. Features -------- All features, except [mrdisc][], are supported for both IPv4 and IPv6. Please note, some features may not be available on systems other than Linux. E.g., FreeBSD does not have SSM group join support. - Configuration file support, `/etc/smcroute.conf` - Configuration snippet include support, `/etc/smcroute.d/*.conf` - Daemon startup options support, `/etc/default/smcroute` - Support for seamless reloading of the configuration on `SIGHUP` - Source-less on-demand routing, a.k.a. wildcard `(*,G)` based static routing, including support for `(*,G/LEN)` and `(S/LEN,G/LEN)` - Optional built-in [mrdisc][] support for IPv4, [RFC4286][] - Support for multiple routing tables on Linux - Client to add/remove routes, join/leave groups, and built-in support to show both routes and joined groups - Interface wildcard matching, `eth+` matches `eth0, eth15` > **Note:** `smcroutectl` can be used to freely modify the runtime state > of `smcrouted`, but any changes made (routes/groups) are > lost when the configuration is reloaded. This is by design. Usage ----- smcrouted [-nNhsv] [-c SEC] [-d SEC] [-e CMD] [-f FILE] [-i NAME] [-l LVL] [-p USER:GROUP] [-P FILE] [-t ID] [-u FILE] smcroutectl [-dptv] [-i NAME] [-u FILE] [COMMAND] smcroutectl ⟨kill | reload⟩ smcroutectl ⟨add | rem⟩ ⟨ROUTE⟩ smcroutectl ⟨join | leave⟩ ⟨GROUP⟩ smcroutectl show [ routes | groups] To set multicast routes and join groups you must first start the daemon, which needs *root privileges*, or `CAP_NET_ADMIN`. Use `smcrouted -n` to run the daemon in the foreground, as required by modern init daemons like systemd and [Finit][]. When started from systemd, `smcrouted` rusn with the `-n -s` options, i.e. supervised in the foreground and uses syslog for logging output. The default log level is `INFO`, this can be adjusted using the file `/etc/default/smcroute`: SMCROUTED_OPTS=-l debug When configured with `--sysconfdir=/etc`, like most Linux distributions do, `smcrouted` reads `/etc/smcroute.conf`, which can look something like this: mgroup from eth0 group 225.1.2.3 mgroup from eth0 group 225.1.2.3 source 192.168.1.42 mroute from eth0 group 225.1.2.3 source 192.168.1.42 to eth1 eth2 The first line means "Join multicast group 225.1.2.3 on interface eth0". Useful if `eth0` is not directly connected to the source, but to a LAN with switches with IGMP snooping. Joining the group opens up multicast for that group towards `eth0`. See below Caveat for limitations. The second `mgroup` is for source specific group join, i.e. the host specifies that it wants packets from 192.168.1.42 and no other source. The third `mroute` line is the actual layer-3 routing entry. Here we say that multicast data originating from 192.168.1.42 on `eth0` to the multicast group 225.1.2.3 should be forwarded to interfaces `eth1` and `eth2`. **Note:** To test the above you can use ping from another device. The multicast should be visible as long as your IP# matches the source above and you ping 225.1.2.3 -- **REMEMBER TO SET THE TTL >1** ping -I eth0 -t 2 225.1.2.3 The TTL is what usually bites people first trying out multicast routing. Most TCP/IP stacks default to a TTL of 1 for multicast frames, e.g. ping above requires `-t 2`, or greater. This limitation is intentional and reduces the risk of someone accidentally flooding multicast. Remember, multicast *behaves like broadcast* unless limited. The TTL should preferably be set on the sender side, e.g. the camera, but can also be modified in the firewall on a router. Be careful though because the TTL is the only thing that helps prevent routing loops! On Linux the following `iptables` command can be used to change the TTL: iptables -t mangle -A PREROUTING -i eth0 -d 225.1.2.3 -j TTL --ttl-inc 1 Some commands, like this one, must usually be run with root privileges or the correct set of capabilities. ### Caveat On some platforms there is a limit of 20 groups per socket. This stems from a limit in BSD UNIX, which also affects Linux. The setting that controls this is `IP_MAX_MEMBERSHIPTS`, defined in the system header file `netinet/in.h`. Linux users can tweak this with the following `/proc` setting: echo 40 > /proc/sys/net/ipv4/igmp_max_memberships `smcrouted` probes this at runtime by attempting to join as many groups as possible (as have been requested), when the kernel accepts no further joins on a socket, `smcrouted` opens a new one. For large setups it is recommended to investigate enabling multicast router ports in the switches, either statically or by enabling support for multicast router discovery, RFC 4286, or possibly use a dynamic multicast routing protocol. ### Action Scripts smcrouted -e /path/to/script With `-e CMD` a user script or command can be called when `smcrouted` receives a `SIGHUP` or installs a multicast route to the kernel. This is useful if you, for instance, also run a NAT firewall and need to flush connection tracking after installing a multicast route. ### Many Interfaces smcrouted -N With the `-N` command line option SMCRoute does *not* prepare all system interfaces for multicast routing. Very useful if your system has a lot of interfaces but only a select few are required for multicast routing. Use the following in `/etc/smcroute.conf` to enable interfaces: phyint eth0 enable phyint eth1 enable phyint eth2 enable It is possible to use any interface that supports the `MULTICAST` flag. Note, however, that depending on the UNIX kernel in use, you may have to have an interface address set, in the relevant address family, and the interface may likely also have to be `UP`. ### Multiple Routing Tables On Linux it is possible to run multiple multicast routing daemons due to its support for multiple multicast routing tables. In such setups it may be useful to change the default identity of SMCRoute: smcrouted -i mrt1 -t 1 smcrouted -i mrt2 -t 2 The `-i NAME` option alters the default syslog name, config file, PID file, and client socket file name used. In the first instance above, `smcrouted` will use: - `/etc/mrt1.conf` - `/var/run/mrt1.pid` - `/var/run/mrt1.sock` and syslog messages will use the `mrt1` identity as well. Remember to use the same `-i NAME` also to `smcroutectl`. ### Client Tool SMCRoute also has a client interface to interact with the daemon: smcroutectl join eth0 225.1.2.3 smcroutectl add eth0 192.168.1.42 225.1.2.3 eth1 eth2 If the daemon runs with a different identity the client needs to be called using the same identity: smcrouted -i mrt smcroutectl -i mrt show There are more commands. See the man page or the online help for details: smcroutectl help > **Note:** Root privileges are required by default for `smcroutectl` due > to the IPC socket permissions. Wildcard Routes --------------- Multicast often originates from different sources but usually not at the same time. For a more generic setup, and to reduce the number of rules required, it is possible to set `(*,G)` multicast routes for both IPv4 and IPv6. Variants include `(*,G/LEN)` and `(S/LEN,G/LEN`. These wildcard routes are used as "templates" to match against and install proper `(S,G)` routes when the kernel informs `smcrouted` of inbound multicast from new sources. Example `smcroute.conf`: phyint eth0 enable mrdisc phyint eth1 enable phyint eth1 enable mgroup from eth0 group 225.1.2.3 mroute from eth0 group 225.1.2.3 to eth1 eth2 or, from the command line: # smcroutectl join eth0 225.1.2.3 # smcroutectl add eth0 225.1.2.3 eth1 eth2 Also, see the `smcrouted -c SEC` option for periodic flushing of learned `(*,G)` rules, including the automatic blocking of unknown multicast, and the `smcroutectl flush` command. Multicast Router Discovery -------------------------- Another interesting feature is multicast router discovery, [mrdisc][], described in [RFC4286][]. This feature is disabled by default, enable with `configure --enable-mrdisc`. When enabled it periodically sends out an IGMP message on inbound interfaces¹ to alert switches to open up multicast in that direction. Not many managed switches have support for this yet. > **Note:** [mrdisc][] only works on Linux due to `SO_BINDTODEVICE`. ____ ¹ Notice the `mrdisc` flag to the above `phyint eth0` directive, which is missing for `eth1` and `eth2`. Build & Install --------------- SMCRoute should in theory work on any UNIX like operating system which supports the BSD MROUTING API. Both Linux and FreeBSD are tested on a regular basis. ### Linux Requirements On Linux the following kernel config is required: CONFIG_IP_MROUTE=y CONFIG_IP_PIMSM_V1=y CONFIG_IP_PIMSM_V2=y CONFIG_IP_MROUTE_MULTIPLE_TABLES=y # For multiple routing tables CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y # For multiple routing tables ### *BSD Requirements On *BSD the following kernel config is required: options MROUTING # Multicast routing options PIM # pimd extensions used for (*,G) support FreeBSD support module loading, `kldload(8)`, edit `/boot/loader.conf`: ip_mroute_load="yes" ip_mroute6_load="yes" ### General Requirements Check the list of multicast capable interfaces: cat /proc/net/dev_mcast or look for interfaces with the `MULTICAST` flag in the output from: ifconfig Some interfaces have the `MULTICAST` flag disabled by default, like `lo` and `greN`. Usually this flag can be enabled administratively. ### Configure & Build The GNU Configure & Build system use `/usr/local` as the default install prefix. In many cases this is useful, but this means the configuration files, cache, and PID files will also use that prefix. Most users have come to expect those files in `/etc/` and `/var/` and configure has a few useful options that are recommended to use. For SMCRoute you may want to use something like this: ./configure --prefix=/usr --sysconfdir=/etc --runstatedir=/var/run make -j5 sudo make install-strip Usually your system reserves `/usr` for native pacakges, so most users drop `--prefix`, installing to `/usr/local`, or use `--prefix=/opt`. **Note:** On some systems `--runstatedir` may not be available in the configure script, try `--localstatedir=/var` instead. ### Privilege Separation As of SMCRoute v2.2 support for privilege separation using the `libcap` library was added. It is used to drop full root privileges at startup, retaining only `CAP_NET_ADMIN` for managing the multicast routes. The build system searches for the `libcap` library and header file(s). Both `libcap-dev` and `pkg-config` are required. **Note:** Although support is automatically detected, the build system will issue a warning if `libcap` is missing. This can be silenced with `configure --without-libcap` ### Integration with systemd For systemd integration `libsystemd-dev` and `pkg-config` are required. When the unit file is installed, `systemctl` can be used to enable and start `smcrouted`: $ sudo systemctl enable smcroute.service $ sudo systemctl start smcroute.service Check that it started properly by inspecting the system log, or: $ sudo systemctl status smcroute.service ### Static Build Some people want to build statically, to do this with `autoconf` add the following `LDFLAGS=` *after* the configure script. You may also need to add `LIBS=...`, which will depend on your particular system: ./configure LDFLAGS="-static" ... ### Building from GIT The `configure` script and the `Makefile.in` files are generated and not stored in GIT. So if you checkout the sources from GitHub you first need to generated these files using `./autogen.sh`. Origin & References ------------------- SMCRoute is maintained collaboratively at [GitHub][Home]. Bug reports, feature requests, patches/pull requests, and documentation fixes are most welcome. The project was previously hosted and maintained by Debian at [Alioth][] and before that by [Carsten Schill][], the original author. [smcrouted(8)]: https://man.troglobit.com/man8/smcrouted.8.html [smcroutectl(8)]: https://man.troglobit.com/man8/smcroutectl.8.html [smcroute.conf(5)]:https://man.troglobit.com/man5/smcroute.conf.5.html [Finit]: https://github.com/troglobit/finit [mrouted]: https://github.com/troglobit/mrouted [pimd]: https://github.com/troglobit/pimd [pim6sd]: https://github.com/troglobit/pim6sd [mrdisc]: https://github.com/troglobit/mrdisc [RFC4286]: https://tools.ietf.org/html/rfc4286 [Home]: https://github.com/troglobit/smcroute [Alioth]: https://alioth.debian.org/projects/smcroute [Carsten Schill]: http://www.cschill.de/smcroute/ [License]: https://en.wikipedia.org/wiki/GPL_license [License Badge]: https://img.shields.io/badge/License-GPL%20v2-blue.svg [GitHub]: https://github.com/troglobit/smcroute/actions/workflows/build.yml/ [GitHub Status]: https://github.com/troglobit/smcroute/actions/workflows/build.yml/badge.svg [Coverity Scan]: https://scan.coverity.com/projects/3061 [Coverity Status]: https://scan.coverity.com/projects/3061/badge.svg smcroute-2.5.5/lib/0000755000175100001710000000000014146403363011134 500000000000000smcroute-2.5.5/lib/strlcpy.c0000644000175100001710000000307714146403320012720 00000000000000/* $OpenBSD: strlcpy.c,v 1.12 2015/01/15 03:54:12 millert Exp $ */ /* * Copyright (c) 1998, 2015 Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include #include /* * Copy string src to buffer dst of size dsize. At most dsize-1 * chars will be copied. Always NUL terminates (unless dsize == 0). * Returns strlen(src); if retval >= dsize, truncation occurred. */ size_t strlcpy(char *dst, const char *src, size_t dsize) { const char *osrc = src; size_t nleft = dsize; /* Copy as many bytes as will fit. */ if (nleft != 0) { while (--nleft != 0) { if ((*dst++ = *src++) == '\0') break; } } /* Not enough room in dst, add NUL and traverse rest of src. */ if (nleft == 0) { if (dsize != 0) *dst = '\0'; /* NUL-terminate dst */ while (*src++) ; } return(src - osrc - 1); /* count does not include NUL */ } smcroute-2.5.5/lib/utimensat.c0000644000175100001710000000263514146403320013230 00000000000000/* Replacement in case utimensat(2) is missing * * Copyright (C) 2017-2021 Joachim Wiberg * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "config.h" #include #ifdef HAVE_FCNTL_H #include #endif #include /* lutimes(), utimes(), utimensat() */ int utimensat(int dirfd, const char *pathname, const struct timespec ts[2], int flags) { int ret = -1; struct timeval tv[2]; if (dirfd != 0) { errno = ENOTSUP; return -1; } TIMESPEC_TO_TIMEVAL(&tv[0], &ts[0]); TIMESPEC_TO_TIMEVAL(&tv[1], &ts[1]); #ifdef AT_SYMLINK_NOFOLLOW if ((flags & AT_SYMLINK_NOFOLLOW) == AT_SYMLINK_NOFOLLOW) ret = lutimes(pathname, tv); else #endif ret = utimes(pathname, tv); return ret; } smcroute-2.5.5/lib/tempfile.c0000644000175100001710000000362314146403320013022 00000000000000/* A secure tmpfile() replacement. * * Copyright (c) 2015-2020 Joachim Wiberg * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include #include /* O_TMPFILE requires -D_GNU_SOURCE */ #include /* fdopen() */ #include /* umask() */ /** * tempfile - A secure tmpfile() replacement * * This is the secure replacement for tmpfile() that does not exist in * GLIBC. The function uses the Linux specific %O_TMPFILE and %O_EXCL * for security. When the %FILE is fclose()'ed the file contents is * lost. The file is hidden in the %_PATH_TMP directory on the system. * * This function requires Linux 3.11, or later, due to %O_TMPFILE. * * Returns: * An open %FILE pointer, or %NULL on error. */ FILE *tempfile(void) { #ifdef O_TMPFILE /* Only on Linux, with fairly recent (G)LIBC */ mode_t oldmask; int fd; oldmask = umask(0077); fd = open(_PATH_TMP, O_TMPFILE | O_RDWR | O_EXCL | O_CLOEXEC, S_IRUSR | S_IWUSR); umask(oldmask); if (-1 == fd) return NULL; return fdopen(fd, "w+"); #else return tmpfile(); /* Fallback on older GLIBC/Linux and actual UNIX systems */ #endif } /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/lib/strlcat.c0000644000175100001710000000332214146403320012665 00000000000000/* $OpenBSD: strlcat.c,v 1.15 2015/03/02 21:41:08 millert Exp $ */ /* * Copyright (c) 1998, 2015 Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include #include /* * Appends src to string dst of size dsize (unlike strncat, dsize is the * full size of dst, not space left). At most dsize-1 characters * will be copied. Always NUL terminates (unless dsize <= strlen(dst)). * Returns strlen(src) + MIN(dsize, strlen(initial dst)). * If retval >= dsize, truncation occurred. */ size_t strlcat(char *dst, const char *src, size_t dsize) { const char *odst = dst; const char *osrc = src; size_t n = dsize; size_t dlen; /* Find the end of dst and adjust bytes left but don't go past end. */ while (n-- != 0 && *dst != '\0') dst++; dlen = dst - odst; n = dsize - dlen; if (n-- == 0) return(dlen + strlen(src)); while (*src != '\0') { if (n != 0) { *dst++ = *src; n--; } src++; } *dst = '\0'; return(dlen + (src - osrc)); /* count does not include NUL */ } smcroute-2.5.5/smcroute0000755000175100001710000000265714146403320012100 00000000000000#!/bin/sh # Compatibility wrapper for users with old startup scripts # Written by Joachim Wiberg, placed in the public domain OP=$1 shift case "$OP" in -d) smcrouted $* ;; -h) echo "Usage: smcroute [OPTIONS] [ARGS]" echo echo " -d Start daemon" echo " -k Kill a running daemon" echo echo " -h This help text" echo " -v Show version" echo echo " -a ARGS Add a multicast route" echo " -r ARGS Remove a multicast route" echo echo " -j ARGS Join a multicast group" echo " -l ARGS Leave a multicast group" echo echo " <------------- INBOUND --------------> <----- OUTBOUND ------>" echo " -a [ ...]" echo " -r " echo echo " -j " echo " -l " echo echo "NOTE: This is a compatibility wrapper script for SMCRoute. Intended for" echo " use with old style startup scripts. It is recommended to migrate" echo " to /etc/smcroute.conf, see the smcroute(8) man page for help." return 0 ;; -k) smcroutectl kill ;; -v) smcroutectl version ;; -a) smcroutectl add $* ;; -r) smcroutectl remove $* ;; -j) smcroutectl join $* ;; *) echo "Unknown command or option to the SMCRoute compatiblity wrapper script." echo "See the smcroute(8) man page for help on available commands." return 1 ;; esac smcroute-2.5.5/autogen.sh0000755000175100001710000000005414146403320012277 00000000000000#!/bin/sh autoreconf -W portability -visfm smcroute-2.5.5/src/0000755000175100001710000000000014146403363011155 500000000000000smcroute-2.5.5/src/mroute.c0000644000175100001710000007402114146403320012551 00000000000000/* Generic kernel multicast routing API for Linux and *BSD * * Copyright (C) 2001-2005 Carsten Schill * Copyright (C) 2006-2009 Julien BLACHE * Copyright (C) 2009 Todd Hayton * Copyright (C) 2009-2011 Micha Lenk * Copyright (C) 2011-2021 Joachim Wiberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "config.h" #include "queue.h" #include #include #include /* snprintf() */ #include #include #include #include "log.h" #include "iface.h" #include "ipc.h" #include "script.h" #include "mrdisc.h" #include "mroute.h" #include "kern.h" #include "timer.h" #include "util.h" /* * Cache flush timeout, used for learned S in (*,G) that stop xmit */ static int cache_timeout = 0; /* * User added/configured routes, both ASM and SSM */ static TAILQ_HEAD(cl, mroute) conf_list = TAILQ_HEAD_INITIALIZER(conf_list); /* * Kernel MFC */ static TAILQ_HEAD(kl, mroute) kern_list = TAILQ_HEAD_INITIALIZER(kern_list); static int mroute4_add_vif (struct iface *iface); static int mroute_dyn_add (struct mroute *route); static int is_match (struct mroute *rule, struct mroute *cand); static int is_exact_match (struct mroute *rule, struct mroute *cand); static int mfc_install (struct mroute *route); static int mfc_uninstall (struct mroute *route); /* Check for kernel IGMPMSG_NOCACHE for (*,G) hits. I.e., source-less routes. */ static void handle_nocache4(int sd, void *arg) { char origin[INET_ADDRSTRLEN], group[INET_ADDRSTRLEN]; struct mroute mroute = { 0 }; struct igmpmsg *im; struct iface *iface; struct ip *ip; char tmp[128]; int result; (void)arg; result = read(sd, tmp, sizeof(tmp)); if (result < 0) { smclog(LOG_WARNING, "Failed reading IGMP message from kernel: %s", strerror(errno)); return; } ip = (struct ip *)tmp; /* Basic validation, filter out non igmpmsg */ im = (struct igmpmsg *)tmp; if (im->im_mbz != 0 || im->im_msgtype == 0) return; /* packets sent up from kernel to daemon have ip->ip_p = 0 */ if (ip->ip_p != 0) return; inet_addr_set(&mroute.source, &im->im_src); inet_addr_set(&mroute.group, &im->im_dst); mroute.inbound = im->im_vif; mroute.len = 32; mroute.src_len = 32; inet_addr2str(&mroute.source, origin, sizeof(origin)); inet_addr2str(&mroute.group, group, sizeof(group)); iface = iface_find_by_inbound(&mroute); if (!iface) { smclog(LOG_WARNING, "No matching interface for VIF %u, cannot handle IGMP message %d.", mroute.inbound, im->im_msgtype); return; } /* check for IGMPMSG_NOCACHE to do (*,G) based routing. */ switch (im->im_msgtype) { case IGMPMSG_NOCACHE: /* Find any matching route for this group on that iif. */ smclog(LOG_DEBUG, "New multicast data from %s to group %s on %s", origin, group, iface->ifname); result = mroute_dyn_add(&mroute); if (result) { /* * This is a common error, the router receives streams it is not * set up to route -- we ignore these by default, but if the user * sets a more permissive log level we help out by showing what * is going on. */ if (ENOENT == errno) smclog(LOG_INFO, "Multicast from %s, group %s, on %s does not match any (*,G) rule", origin, group, iface->ifname); return; } script_exec(&mroute); break; case IGMPMSG_WRONGVIF: smclog(LOG_WARNING, "Multicast from %s, group %s, coming in on wrong VIF %u, iface %s", origin, group, mroute.inbound, iface->ifname); break; case IGMPMSG_WHOLEPKT: #ifdef IGMPMSG_WRVIFWHOLE case IGMPMSG_WRVIFWHOLE: #endif smclog(LOG_WARNING, "Receiving PIM register data from %s, group %s", origin, group); break; default: smclog(LOG_DEBUG, "Unknown IGMP message %d from kernel", im->im_msgtype); break; } } static void cache_flush(void *arg) { (void)arg; smclog(LOG_INFO, "Cache timeout, flushing unused (*,G) routes!"); mroute_expire(cache_timeout); } /** * mroute4_enable - Initialise IPv4 multicast routing * * Setup the kernel IPv4 multicast routing API and lock the multicast * routing socket to this program (only!). * * Returns: * POSIX OK(0) on success, non-zero on error with @errno set. */ static int mroute4_enable(int do_vifs, int table_id) { struct iface *iface; if (kern_mroute_init(table_id, handle_nocache4, NULL)) { switch (errno) { case ENOPROTOOPT: smclog(LOG_WARNING, "Kernel does not even support IGMP, skipping ..."); break; case EPROTONOSUPPORT: smclog(LOG_ERR, "Cannot set IPv4 multicast routing table id: %s", strerror(errno)); smclog(LOG_ERR, "Make sure your kernel has CONFIG_IP_MROUTE_MULTIPLE_TABLES=y"); break; case EADDRINUSE: smclog(LOG_ERR, "IPv4 multicast routing API already in use: %s", strerror(errno)); break; case EOPNOTSUPP: smclog(LOG_ERR, "Kernel does not support IPv4 multicast routing, skipping ..."); break; default: smclog(LOG_ERR, "Failed initializing IPv4 multicast routing API: %s", strerror(errno)); break; } return 1; } /* Create virtual interfaces (VIFs) for all IFF_MULTICAST interfaces */ if (do_vifs) { for (iface = iface_iterator(1); iface; iface = iface_iterator(0)) mroute4_add_vif(iface); } return 0; } /** * mroute4_disable - Disable IPv4 multicast routing * * Disable IPv4 multicast routing and release kernel routing socket. */ static void mroute4_disable(void) { struct mroute *entry, *tmp; if (kern_mroute_exit()) return; TAILQ_FOREACH_SAFE(entry, &conf_list, link, tmp) { TAILQ_REMOVE(&conf_list, entry, link); free(entry); } TAILQ_FOREACH_SAFE(entry, &kern_list, link, tmp) { TAILQ_REMOVE(&kern_list, entry, link); free(entry); } } /* * Prune VIF from all existing routes and update kernel MFC. If VIF is * used as inbound, prune entire route, otherwise just the outbound. */ static void mroute4_prune_vif(int vif) { struct mroute *entry, *tmp; TAILQ_FOREACH_SAFE(entry, &conf_list, link, tmp) { if (entry->group.ss_family != AF_INET) continue; if (entry->inbound == vif) { TAILQ_REMOVE(&conf_list, entry, link); entry->unused = 1; mfc_uninstall(entry); free(entry); } else if (entry->ttl[vif] > 0) { entry->ttl[vif] = 0; mfc_install(entry); } } } /* Create a virtual interface from @iface so it can be used for IPv4 multicast routing. */ static int mroute4_add_vif(struct iface *iface) { if (kern_vif_add(iface)) { switch (errno) { case ENOPROTOOPT: smclog(LOG_INFO, "Interface %s is not multicast capable, skipping VIF.", iface->ifname); return -1; case EAGAIN: smclog(LOG_DEBUG, "No IPv4 multicast socket"); return -1; case ENOMEM: smclog(LOG_WARNING, "Not enough available VIFs to create %s", iface->ifname); return 1; case EEXIST: smclog(LOG_DEBUG, "Interface %s already has VIF %d.", iface->ifname, iface->vif); return 0; default: break; } smclog(LOG_DEBUG, "Failed creating VIF for %s: %s", iface->ifname, strerror(errno)); return -1; } if (iface->mrdisc) return mrdisc_register(iface->ifname, iface->vif); return mrdisc_deregister(iface->vif); } static int mroute4_del_vif(struct iface *iface) { int rc = 0; if (iface->mrdisc) rc = mrdisc_deregister(iface->vif); if (iface->vif == ALL_VIFS) return 0; if (kern_vif_del(iface)) { switch (errno) { case ENOENT: case EADDRNOTAVAIL: break; default: smclog(LOG_ERR, "Failed deleting VIF for iface %s: %s", iface->ifname, strerror(errno)); break; } rc = -1; } if (iface->vif != ALL_VIFS) mroute4_prune_vif(iface->vif); iface->vif = ALL_VIFS; return rc; } static int is_exact_match(struct mroute *rule, struct mroute *cand) { if (rule->group.ss_family != cand->group.ss_family) return 0; if (rule->inbound != cand->inbound) return 0; if (!inet_addr_cmp(&rule->source, &cand->source) && !inet_addr_cmp(&rule->group, &cand->group) && rule->len == cand->len && rule->src_len == cand->src_len) return 1; return 0; } /* * Used for (*,G) matches * * The incoming candidate is compared to the configured rule, e.g. * does 225.1.2.3 fall inside 225.0.0.0/8? => Yes * does 225.1.2.3 fall inside 225.0.0.0/15? => Yes * does 225.1.2.3 fall inside 225.0.0.0/16? => No * * does ff05:bad1::1 fall inside ff05:bad0::/16? => Yes * does ff05:bad1::1 fall inside ff05:bad0::/31? => Yes * does ff05:bad1::1 fall inside ff05:bad0::/32? => No */ int is_match(struct mroute *rule, struct mroute *cand) { inet_addr_t a, b; int rc = 0; if (rule->group.ss_family != cand->group.ss_family) return 0; if (rule->inbound != cand->inbound) return rc; a = inet_netaddr(&rule->group, rule->len); b = inet_netaddr(&cand->group, rule->len); rc = !inet_addr_cmp(&a, &b); if (is_anyaddr(&rule->source)) return rc; a = inet_netaddr(&rule->source, rule->src_len); b = inet_netaddr(&cand->source, rule->src_len); rc &= !inet_addr_cmp(&a, &b); return rc; } static int is_ssm(struct mroute *route) { int max_len = inet_max_len(&route->group); return !is_anyaddr(&route->source) && route->src_len == max_len && route->len == max_len; } /* find any existing route, with matching inbound interface */ static struct mroute *conf_find(struct mroute *route) { struct mroute *entry; TAILQ_FOREACH(entry, &conf_list, link) { if (is_exact_match(route, entry)) return entry; } return NULL; } /* find any existing route, with matching inbound interface */ static struct mroute *kern_find(struct mroute *route) { struct mroute *entry; TAILQ_FOREACH(entry, &kern_list, link) { if (is_match(route, entry)) return entry; } return NULL; } static int is_active(struct mroute *route) { size_t i; for (i = 0; i < NELEMS(route->ttl); i++) { if (route->ttl[i]) return 1; } return 0; } /* * Get valid packet usage statistics (i.e. number of actually forwarded * packets) from the kernel for an installed MFC entry */ static unsigned long get_valid_pkt(struct mroute *route) { struct mroute_stats ms = { 0 }; if (kern_stats(route, &ms)) return 0; return ms.ms_pktcnt - ms.ms_wrong_if; } /** * mroute_expire - Expire dynamically added (*,G) routes * @max_idle: Timeout for routes in seconds, 0 to expire all dynamic routes * * This function flushes all (*,G) routes which haven't been used (i.e. no * packets matching them have been forwarded) in the last max_idle seconds. * It is called periodically on cache-timeout or on request of smcroutectl. * The latter is useful in case of topology changes (e.g. VRRP fail-over) * or similar. */ void mroute_expire(int max_idle) { struct mroute *entry, *tmp; struct timespec now; clock_gettime(CLOCK_MONOTONIC, &now); TAILQ_FOREACH_SAFE(entry, &kern_list, link, tmp) { char origin[INET_ADDRSTR_LEN], group[INET_ADDRSTR_LEN]; struct iface *iface; /* XXX: only consider (*,G) routes, not pure (S,G), and no overlap handling for now */ if (conf_find(entry)) continue; inet_addr2str(&entry->group, group, sizeof(group)); inet_addr2str(&entry->source, origin, sizeof(origin)); iface = iface_find_by_inbound(entry); if (!entry->last_use) { /* New entry */ entry->last_use = now.tv_sec; entry->valid_pkt = get_valid_pkt(entry); continue; } smclog(LOG_DEBUG, "Checking (%s,%s) on %s, time to expire: last %ld max %d now: %ld", origin, group, iface ? iface->ifname : "UNKNOWN", entry->last_use, max_idle, now.tv_sec); if (entry->last_use + max_idle <= now.tv_sec) { unsigned long valid_pkt; valid_pkt = get_valid_pkt(entry); if (valid_pkt != entry->valid_pkt) { /* Used since last check, update */ smclog(LOG_DEBUG, " -> Nope, still active, valid %lu vs last valid %lu.", valid_pkt, entry->valid_pkt); entry->last_use = now.tv_sec; entry->valid_pkt = valid_pkt; continue; } /* Not used, expire */ smclog(LOG_DEBUG, " -> Yup, stale route."); kern_mroute_del(entry); TAILQ_REMOVE(&kern_list, entry, link); free(entry); } } } /* * Install or update kernel MFC. Installing a new route currently * requires an (S,G) entry, updating only requires a (*,G), which * is to handle overlaps. * * Currently, meaning Linux has support for (*,*) and (*,G) routing * but supporting that would require quite a bit of changes. I.e., * it's not just about removing the `!is_ssm(conf)` check ... */ static int mfc_install(struct mroute *route) { struct mroute *kern; kern = kern_find(route); if (!kern) { if (!is_ssm(route)) return 0; kern = malloc(sizeof(struct mroute)); if (!kern) { smclog(LOG_WARNING, "Cannot add kernel route: %s", strerror(errno)); return 1; } memcpy(kern, route, sizeof(struct mroute)); TAILQ_INSERT_TAIL(&kern_list, kern, link); return kern_mroute_add(kern); } TAILQ_FOREACH(kern, &kern_list, link) { if (!is_match(route, kern)) continue; for (size_t i = 0; i < NELEMS(route->ttl); i++) { if (route->ttl[i] > 0 && kern->ttl[i] != route->ttl[i]) kern->ttl[i] = route->ttl[i]; } kern_mroute_add(kern); } return 0; } /* * When route has an empty oif list -- attempt full removal of the * route, unless there exist other configured routes that map to the * same kernel MFC entry. * * When route oif list is *not* empty, attempt to remove only select * interfaces from the MFC entry. Again, unless other configured * routes map to the same MFC entry. */ static int mfc_uninstall(struct mroute *route) { struct mroute *conf, *kern, *tmp; int removal = !is_active(route); int diff = 0; int rc = 0; TAILQ_FOREACH_SAFE(kern, &kern_list, link, tmp) { if (!is_match(route, kern)) continue; if (route->unused) goto cleanup; /* First remove OIFs from route entry */ for (size_t i = 0; i < NELEMS(route->ttl); i++) { if (removal || route->ttl[i] > 0) { kern->ttl[i] = 0; diff++; } } /* Then, for each matching conf we add its oifs */ TAILQ_FOREACH(conf, &conf_list, link) { if (!is_match(kern, conf)) continue; for (size_t i = 0; i < NELEMS(conf->ttl); i++) { if (conf->ttl[i] > 0 && kern->ttl[i] == 0) { kern->ttl[i] = conf->ttl[i]; diff++; } } } if (!diff && !removal) continue; if (is_active(kern) || !removal) { rc += kern_mroute_add(kern); continue; } cleanup: rc += kern_mroute_del(kern); TAILQ_REMOVE(&kern_list, kern, link); free(kern); } return rc; } /** * mroute_add_route - Add route to kernel, or save a wildcard route for later use * @route: Pointer to multicast route to add * * Adds the given multicast @route to the kernel multicast routing table * unless it is ASM, i.e., a (*,G) route. Those we save for and check * against at runtime when the kernel signals us. * * Returns: * POSIX OK(0) on success, non-zero on error with @errno set. */ int mroute_add_route(struct mroute *route) { struct mroute *conf; conf = conf_find(route); if (conf) { size_t i; /* .conf: replace found entry with new outbounds */ if (conf->unused) { for (i = 0; i < NELEMS(conf->ttl); i++) conf->ttl[i] = 0; } /* ipc: add any new outbound interafces */ for (i = 0; i < NELEMS(conf->ttl); i++) { if (route->ttl[i]) conf->ttl[i] = route->ttl[i]; } } else { conf = malloc(sizeof(struct mroute)); if (!conf) { smclog(LOG_WARNING, "Cannot add multicast route: %s", strerror(errno)); return 1; } memcpy(conf, route, sizeof(struct mroute)); TAILQ_INSERT_TAIL(&conf_list, conf, link); } conf->unused = 0; return mfc_install(conf); } /** * mroute_del_route - Remove route from kernel, or all matching routes if wildcard * @route: Pointer to multicast route to remove * * Removes the given multicast @route from the kernel multicast routing * table, or if the @route is a wildcard, then all matching kernel * routes are removed, as well as the wildcard. * * Returns: * POSIX OK(0) on success, non-zero on error with @errno set. */ int mroute_del_route(struct mroute *route) { struct mroute *conf; int rc = 0; if (route->unused) { conf = route; goto cleanup; } conf = conf_find(route); if (!conf) { errno = ENOENT; return -1; } if (is_active(route)) { /* remove only the listed oifs from config */ for (size_t i = 0; i < NELEMS(conf->ttl); i++) { if (route->ttl[i] > 0 && conf->ttl[i] != 0) conf->ttl[i] = 0; } rc = mfc_uninstall(route); } else { cleanup: TAILQ_REMOVE(&conf_list, conf, link); rc = mfc_uninstall(route); free(conf); } return rc; } #ifdef HAVE_IPV6_MULTICAST_ROUTING static int mroute6_add_mif(struct iface *iface); /* * Receive and drop ICMPv6 stuff. This is either MLD packets or upcall * messages sent up from the kernel. */ static void handle_nocache6(int sd, void *arg) { char origin[INET_ADDRSTR_LEN], group[INET_ADDRSTR_LEN]; struct mroute mroute = { 0 }; struct mrt6msg *im6; struct iface *iface; char tmp[128]; int result; (void)arg; result = read(sd, tmp, sizeof(tmp)); if (result < 0) { smclog(LOG_INFO, "Failed clearing MLD message from kernel: %s", strerror(errno)); return; } /* * Basic input validation, filter out all non-mrt messages (e.g. * our join for each group). The mrt6msg struct is overlayed on * the MLD header, so the im6_mbz field (must-be-zero) is the * MLD type, e.g. 143, and im6_msgtype is the MLD code for an * MLDv2 Join. */ im6 = (struct mrt6msg *)tmp; if (im6->im6_mbz != 0 || im6->im6_msgtype == 0) return; inet_addr6_set(&mroute.source, &im6->im6_src); inet_addr6_set(&mroute.group, &im6->im6_dst); mroute.inbound = im6->im6_mif; mroute.len = 128; mroute.src_len = 128; inet_addr2str(&mroute.source, origin, sizeof(origin)); inet_addr2str(&mroute.group, group, sizeof(group)); iface = iface_find_by_inbound(&mroute); if (!iface) { smclog(LOG_WARNING, "No matching interface for VIF %u, cannot handle MRT6MSG %u:%u. " "Multicast source %s, dest %s", mroute.inbound, im6->im6_mbz, im6->im6_msgtype, origin, group); return; } switch (im6->im6_msgtype) { case MRT6MSG_NOCACHE: smclog(LOG_DEBUG, "New multicast data from %s to group %s on VIF %u", origin, group, mroute.inbound); /* Find any matching route for this group on that iif. */ result = mroute_dyn_add(&mroute); if (result) { /* * This is a common error, the router receives streams it is not * set up to route -- we ignore these by default, but if the user * sets a more permissive log level we help out by showing what * is going on. */ if (ENOENT == errno) smclog(LOG_INFO, "Multicast from %s, group %s, on %s does not match any (*,G) rule", origin, group, iface->ifname); return; } script_exec(&mroute); break; case MRT6MSG_WRONGMIF: smclog(LOG_WARNING, "Multicast from %s, group %s, coming in on wrong MIF %u, iface %s", origin, group, mroute.inbound, iface->ifname); break; case MRT6MSG_WHOLEPKT: smclog(LOG_WARNING, "Receiving PIM6 register data from %s, group %s", origin, group); break; default: smclog(LOG_DEBUG, "Unknown MRT6MSG %u from kernel", im6->im6_msgtype); break; } } #endif /* HAVE_IPV6_MULTICAST_ROUTING */ /** * mroute6_enable - Initialise IPv6 multicast routing * * Setup the kernel IPv6 multicast routing API and lock the multicast * routing socket to this program (only!). * * Returns: * POSIX OK(0) on success, non-zero on error with @errno set. */ static int mroute6_enable(int do_vifs, int table_id) { #ifndef HAVE_IPV6_MULTICAST_ROUTING (void)do_vifs; (void)table_id; #else struct iface *iface; if (kern_mroute6_init(table_id, handle_nocache6, NULL)) { switch (errno) { case ENOPROTOOPT: smclog(LOG_WARNING, "Kernel does not even support IPv6 ICMP, skipping ..."); break; case EPROTONOSUPPORT: smclog(LOG_ERR, "Cannot set IPv6 multicast routing table id: %s", strerror(errno)); smclog(LOG_ERR, "Make sure your kernel has CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y"); break; case EADDRINUSE: smclog(LOG_ERR, "IPv6 multicast routing API already in use: %s", strerror(errno)); break; case EOPNOTSUPP: smclog(LOG_ERR, "Kernel does not support IPv6 multicast routing, skipping ..."); break; default: smclog(LOG_ERR, "Failed initializing IPv6 multicast routing API: %s", strerror(errno)); break; } return 1; } /* Create virtual interfaces, IPv6 MIFs, for all IFF_MULTICAST interfaces */ if (do_vifs) { for (iface = iface_iterator(1); iface; iface = iface_iterator(0)) mroute6_add_mif(iface); } return 0; #endif /* HAVE_IPV6_MULTICAST_ROUTING */ return -1; } /** * mroute6_disable - Disable IPv6 multicast routing * * Disable IPv6 multicast routing and release kernel routing socket. */ static void mroute6_disable(void) { #ifdef HAVE_IPV6_MULTICAST_ROUTING kern_mroute6_exit(); #endif } #ifdef HAVE_IPV6_MULTICAST_ROUTING /* * Prune VIF from all existing routes and update kernel MFC. If VIF is * used as inbound, prune entire route, otherwise just the outbound. */ static void mroute6_prune_mif(int mif) { struct mroute *entry, *tmp; TAILQ_FOREACH_SAFE(entry, &conf_list, link, tmp) { if (entry->group.ss_family != AF_INET6) continue; if (entry->inbound == mif) { TAILQ_REMOVE(&conf_list, entry, link); entry->unused = 1; mfc_uninstall(entry); free(entry); } else if (entry->ttl[mif] > 0) { entry->ttl[mif] = 0; mfc_install(entry); } } } /* Create a virtual interface from @iface so it can be used for IPv6 multicast routing. */ static int mroute6_add_mif(struct iface *iface) { if (kern_mif_add(iface)) { switch (errno) { case ENOPROTOOPT: smclog(LOG_INFO, "Interface %s is not multicast capable, skipping MIF.", iface->ifname); return -1; case EAGAIN: smclog(LOG_DEBUG, "No IPv6 multicast socket"); return -1; case ENOMEM: smclog(LOG_WARNING, "Not enough available MIFs to create %s", iface->ifname); return 1; case EEXIST: smclog(LOG_DEBUG, "Interface %s already has MIF %d.", iface->ifname, iface->mif); return 0; default: break; } smclog(LOG_DEBUG, "Failed creating MIF for %s: %s", iface->ifname, strerror(errno)); return -1; } return 0; } static int mroute6_del_mif(struct iface *iface) { int rc = 0; if (iface->mif == ALL_VIFS) return 0; if (kern_mif_del(iface) && errno != ENOENT) { switch (errno) { case ENOENT: case EADDRNOTAVAIL: break; default: smclog(LOG_ERR, "Failed deleting MIF for iface %s: %s", iface->ifname, strerror(errno)); break; } rc = -1; } if (iface->mif != ALL_VIFS) mroute6_prune_mif(iface->mif); iface->mif = ALL_VIFS; return rc; } #endif /* HAVE_IPV6_MULTICAST_ROUTING */ /** * mroute_dyn_add - Add route to kernel if it matches a known (*,G) route. * @route: Pointer to candidate multicast route * * Returns: * POSIX OK(0) on success, non-zero on error with @errno set. */ static int mroute_dyn_add(struct mroute *route) { struct mroute *entry; int rc; TAILQ_FOREACH(entry, &conf_list, link) { /* Find matching (*,G) ... and interface. */ if (is_ssm(entry) || !is_match(entry, route)) continue; /* Use configured template (*,G) outbound interfaces. */ memcpy(route->ttl, entry->ttl, NELEMS(route->ttl) * sizeof(route->ttl[0])); break; } if (!entry) { /* * No match, add entry without outbound interfaces * nevertheless to avoid continuous cache misses from * the kernel. Note that this still gets reported as an * error (ENOENT) below. */ memset(route->ttl, 0, NELEMS(route->ttl) * sizeof(route->ttl[0])); } rc = mfc_install(route); /* Signal to cache handler we've added a stop filter */ if (!entry) { errno = ENOENT; return -1; } return rc; } int mroute_init(int do_vifs, int table_id, int cache_tmo) { static int running = 0; TAILQ_INIT(&conf_list); TAILQ_INIT(&kern_list); if (cache_tmo > 0 && !running) { running++; cache_timeout = cache_tmo; timer_add(cache_tmo, cache_flush, NULL); } return mroute4_enable(do_vifs, table_id) || mroute6_enable(do_vifs, table_id); } void mroute_exit(void) { mroute4_disable(); mroute6_disable(); } /* Used by file parser to add VIFs/MIFs after setup */ int mroute_add_vif(char *ifname, uint8_t mrdisc, uint8_t ttl) { struct ifmatch state; struct iface *iface; int rc = 0; iface_match_init(&state); while ((iface = iface_match_by_name(ifname, 1, &state))) { smclog(LOG_DEBUG, "Creating/updating multicast VIF for %s TTL %d", iface->ifname, ttl); iface->mrdisc = mrdisc; iface->threshold = ttl; iface->unused = 0; rc += mroute4_add_vif(iface); #ifdef HAVE_IPV6_MULTICAST_ROUTING rc += mroute6_add_mif(iface); #endif } if (!state.match_count) { smclog(LOG_DEBUG, "Failed adding phyint %s, no matching interfaces.", ifname); return 1; } return rc; } /* Used by file parser to remove VIFs/MIFs after setup */ int mroute_del_vif(char *ifname) { struct ifmatch state; struct iface *iface; int rc = 0; iface_match_init(&state); while ((iface = iface_match_by_name(ifname, 1, &state))) { smclog(LOG_DEBUG, "Removing multicast VIFs for %s", iface->ifname); rc += mroute4_del_vif(iface); #ifdef HAVE_IPV6_MULTICAST_ROUTING rc += mroute6_del_mif(iface); #endif } if (!state.match_count) { smclog(LOG_DEBUG, "Failed removing phyint %s, no matching interfaces.", ifname); return 1; } return rc; } /* * Called on SIGHUP/reload. Mark all known configured routes as * 'unused', let mroute*_add() unmark and mroute_reload_end() take * care to remove routes that still have the 'unused' flag. */ void mroute_reload_beg(void) { struct mroute *entry; struct iface *iface; int first = 1; TAILQ_FOREACH(entry, &conf_list, link) entry->unused = 1; while ((iface = iface_iterator(first))) { first = 0; iface->unused = 1; } } void mroute_reload_end(int do_vifs) { struct mroute *entry, *tmp; struct iface *iface; int first = 1; while ((iface = iface_iterator(first))) { char dummy[IFNAMSIZ]; first = 0; if (iface->unused || !if_indextoname(iface->ifindex, dummy)) { mroute_del_vif(iface->ifname); } else if (do_vifs) mroute_add_vif(iface->ifname, iface->mrdisc, iface->threshold); } TAILQ_FOREACH_SAFE(entry, &conf_list, link, tmp) { if (entry->unused) mroute_del_route(entry); } /* retry add if .conf changed IIF for routes, not until del (above) can we add */ TAILQ_FOREACH(entry, &conf_list, link) mfc_install(entry); } static int show_mroute(int sd, struct mroute *r, int inw, int detail) { char src[INET_ADDRSTR_LEN] = "*"; char src_len[5] = ""; char grp[INET_ADDRSTR_LEN]; char grp_len[5] = ""; char sg[(INET_ADDRSTR_LEN + 3) * 2 + 5]; char buf[MAX_MC_VIFS * 17 + 80]; struct iface *iface; int max_len; max_len = inet_max_len(&r->group); if (!is_anyaddr(&r->source)) { inet_addr2str(&r->source, src, sizeof(src)); if (r->src_len != max_len) snprintf(src_len, sizeof(src_len), "/%u", r->src_len); } inet_addr2str(&r->group, grp, sizeof(grp)); if (r->len != max_len) snprintf(grp_len, sizeof(grp_len), "/%u", r->len); iface = iface_find_by_inbound(r); snprintf(sg, sizeof(sg), "(%s%s, %s%s)", src, src_len, grp, grp_len); if (!iface) { smclog(LOG_ERR, "Failed reading iif for %s, aborting.", sg); exit(EX_SOFTWARE); } snprintf(buf, sizeof(buf), "%-42s %-*s ", sg, inw, iface->ifname); if (detail) { struct mroute_stats ms = { 0 }; char stats[30]; kern_stats(r, &ms); snprintf(stats, sizeof(stats), "%10lu %10lu ", ms.ms_pktcnt, ms.ms_bytecnt); strlcat(buf, stats, sizeof(buf)); } iface = iface_outbound_iterator(r, 1); while (iface) { char tmp[22]; snprintf(tmp, sizeof(tmp), " %s", iface->ifname); strlcat(buf, tmp, sizeof(buf)); iface = iface_outbound_iterator(r, 0); } strlcat(buf, "\n", sizeof(buf)); if (ipc_send(sd, buf, strlen(buf)) < 0) { smclog(LOG_ERR, "Failed sending reply to client: %s", strerror(errno)); return -1; } return 0; } static int has_any_ssm(void) { struct mroute *e; TAILQ_FOREACH(e, &conf_list, link) { if (is_ssm(e)) return 1; } return 0; } static int has_any_asm(void) { struct mroute *e; TAILQ_FOREACH(e, &conf_list, link) { if (!is_ssm(e)) return 1; } return 0; } /* Write all (*,G) routes to client socket */ int mroute_show(int sd, int detail) { const char *r = "ROUTE (S,G)", *o = "OIFS", *i = "IIF"; struct mroute *entry; char line[256]; int inw; inw = iface_ifname_maxlen(); if (inw < (int)strlen(i)) inw = (int)strlen(i); if (detail) { const char *p = "PACKETS", *b = "BYTES"; snprintf(line, sizeof(line), "%-42s %-*s %10s %10s %s=\n", r, inw, i, p, b, o); } else snprintf(line, sizeof(line), "%-42s %-*s %s=\n", r, inw, i, o); if (has_any_asm()) { char *asm_conf = "(*,G) Template Rules_\n"; ipc_send(sd, asm_conf, strlen(asm_conf)); ipc_send(sd, line, strlen(line)); TAILQ_FOREACH(entry, &conf_list, link) { if (is_ssm(entry)) continue; if (show_mroute(sd, entry, inw, detail) < 0) return 1; } } if (has_any_ssm()) { char *ssm_list = "(S,G) Rules_\n"; ipc_send(sd, ssm_list, strlen(ssm_list)); ipc_send(sd, line, strlen(line)); TAILQ_FOREACH(entry, &conf_list, link) { if (!is_ssm(entry)) continue; if (show_mroute(sd, entry, inw, detail) < 0) return 1; } } if (!TAILQ_EMPTY(&kern_list)) { char *asm_kern = "Kernel MFC Table_\n"; ipc_send(sd, asm_kern, strlen(asm_kern)); ipc_send(sd, line, strlen(line)); TAILQ_FOREACH(entry, &kern_list, link) { if (!is_active(entry)) continue; if (show_mroute(sd, entry, inw, detail) < 0) return 1; } TAILQ_FOREACH(entry, &kern_list, link) { if (is_active(entry)) continue; if (show_mroute(sd, entry, inw, detail) < 0) return 1; } } return 0; } /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/conf.c0000644000175100001710000002704714146403320012171 00000000000000/* Simple .conf file parser for smcroute * * Copyright (C) 2011-2021 Joachim Wiberg * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include "log.h" #include "conf.h" #include "iface.h" #include "script.h" #include "mcgroup.h" #include "util.h" #define MAX_LINE_LEN 512 #define DEBUG(fmt, args...) do { \ if (conf) \ smclog(LOG_DEBUG, "%s line %d: " fmt, conf->file, \ conf->lineno, ##args); \ else \ smclog(LOG_DEBUG, "ipc: " fmt, ##args); \ } while (0) #define INFO(fmt, args...) do { \ if (conf) \ smclog(LOG_INFO, "%s line %d: " fmt, conf->file, \ conf->lineno, ##args); \ else \ smclog(LOG_INFO, "ipc: " fmt, ##args); \ } while (0) #define WARN(fmt, args...) do { \ if (conf) \ smclog(LOG_WARNING, "%s line %d: " fmt, conf->file, \ conf->lineno, ##args); \ else \ smclog(LOG_WARNING, "ipc: " fmt, ##args); \ if (conf_vrfy) \ rc++; \ } while (0) /* Used only for verifying .conf files */ static int conf_vrfy_vif; static char *pop_token(char **line) { char *end, *token; if (!line) return NULL; token = *line; if (!token) return NULL; /* Find start of token, skip whitespace. */ while (*token && isspace((int)*token)) token++; /* Find end of token. */ end = token; while (*end && !isspace((int)*end)) end++; if (end == token) { *line = NULL; return NULL; } *end = 0; /* Terminate token. */ *line = end + 1; return token; } static int match(char *keyword, char *token) { size_t len; if (!keyword || !token) return 0; len = strlen(keyword); return !strncmp(keyword, token, len); } int conf_mgroup(struct conf *conf, int cmd, char *iif, char *source, char *group) { inet_addr_t src = { 0 }, grp = { 0 }; int src_len = 0; int grp_len = 0; int len_max; int family; int rc = 0; if (!iif || !group) { errno = EINVAL; return 1; } grp_len = is_range(group); if (inet_str2addr(group, &grp) || !is_multicast(&grp)) { WARN("join: Invalid multicast group: %s", group); goto done; } family = grp.ss_family; #ifdef HAVE_IPV6_MULTICAST_HOST if (family == AF_INET6) len_max = 128; else #endif len_max = 32; if (grp_len < 0 || grp_len > len_max) { WARN("join: Invalid group prefix length (0-%d): %d", len_max, grp_len); goto done; } if (!grp_len) grp_len = len_max; if (source) { src_len = is_range(source); if (src_len < 0 || src_len > len_max) { WARN("join: Invalid source prefix length (0-%d): %d", len_max, src_len); goto done; } if (inet_str2addr(source, &src)) { WARN("join: Invalid multicast source: %s", source); goto done; } } else inet_anyaddr(family, &src); if (!src_len) src_len = len_max; if (!conf_vrfy) rc += mcgroup_action(cmd, iif, &src, src_len, &grp, grp_len); done: return rc; } int conf_mroute(struct conf *conf, int cmd, char *iif, char *source, char *group, char *oif[], int num) { struct ifmatch state_in, state_out; struct mroute mroute = { 0 }; struct iface *iface_in, *iface; int len_max; int family; int rc = 0; int vif; if (!iif || !group) { errno = EINVAL; return 1; } mroute.len = is_range(group); if (inet_str2addr(group, &mroute.group) || !is_multicast(&mroute.group)) { WARN("mroute: Invalid multicast group: %s", group); goto done; } family = mroute.group.ss_family; #ifdef HAVE_IPV6_MULTICAST_HOST if (family == AF_INET6) len_max = 128; else #endif len_max = 32; if (mroute.len < 0 || mroute.len > len_max) { WARN("mroute: Invalid multicast group prefix length, %d", mroute.len); goto done; } if (!mroute.len) mroute.len = len_max; if (source) { mroute.src_len = is_range(source); if (mroute.src_len < 0 || mroute.src_len > len_max) { WARN("mroute: invalid prefix length: %d", mroute.src_len); goto done; } if (inet_str2addr(source, &mroute.source)) { WARN("mroute: Invalid source address: %s", source); goto done; } } else { inet_anyaddr(family, &mroute.source); mroute.src_len = 0; } if (!mroute.src_len) mroute.src_len = len_max; iface_match_init(&state_in); DEBUG("mroute: checking for input iface %s ...", iif); while (iface_match_vif_by_name(iif, &state_in, &iface_in) != NO_VIF) { char src[INET_ADDRSTR_LEN], grp[INET_ADDRSTR_LEN]; vif = iface_get_vif(family, iface_in); DEBUG("mroute: input iface %s has vif %d", iif, vif); mroute.inbound = vif; for (int i = 0; i < num; i++) { iface_match_init(&state_out); DEBUG("mroute: checking for %s ...", oif[i]); while (iface_match_vif_by_name(oif[i], &state_out, &iface) != NO_VIF) { vif = iface_get_vif(family, iface); if (vif == mroute.inbound && cmd) { /* In case of wildcard match in==out is normal, so don't complain */ if (!ifname_is_wildcard(iif) && !ifname_is_wildcard(oif[i])) INFO("mroute: Same outbound interface (%s) as inbound (%s) may cause routing loops.", oif[i], iface_in->ifname); } /* Use configured TTL threshold for the output phyint */ mroute.ttl[vif] = iface->threshold; } if (!state_out.match_count) WARN("mroute: outbound %s is not a known phyint, skipping", oif[i]); } if (conf_vrfy) continue; if (cmd) { smclog(LOG_DEBUG, "mroute: adding route from %s (%s/%u,%s/%u)", iface_in->ifname, inet_addr2str(&mroute.source, src, sizeof(src)), mroute.src_len, inet_addr2str(&mroute.group, grp, sizeof(grp)), mroute.len); rc += mroute_add_route(&mroute); } else { smclog(LOG_DEBUG, "mroute: deleting route from %s (%s/%u,%s/%u)", iface_in->ifname, inet_addr2str(&mroute.source, src, sizeof(src)), mroute.src_len, inet_addr2str(&mroute.group, grp, sizeof(grp)), mroute.len); rc += mroute_del_route(&mroute); } } if (!state_in.match_count) { WARN("mroute: inbound %s is not a known phyint", iif); rc++; } done: return rc; } static int conf_phyint(struct conf *conf, int enable, char *iif, int mrdisc, int threshold) { (void)conf; if (conf_vrfy) { struct iface *iface; struct ifmatch ifm; iface_match_init(&ifm); iface = iface_match_by_name(iif, 1, &ifm); if (!iface) return 1; iface->vif = conf_vrfy_vif; iface->mif = conf_vrfy_vif++; return 0; } if (enable) return mroute_add_vif(iif, mrdisc, threshold); return mroute_del_vif(iif); } /* * This function parses the given configuration file according to the * below format rules. Joins multicast groups and creates multicast * routes accordingly in the kernel. Whitespace is ignored. * * Format: * phyint IFNAME [ttl-threshold <1-255>] * mgroup from IFNAME [source ADDRESS] group MCGROUP * mroute from IFNAME source ADDRESS group MCGROUP to IFNAME [IFNAME ...] * include FILEPATTERN */ int conf_parse(struct conf *conf, int do_vifs) { char *linebuf, *line; int rc = 0; FILE *fp; fp = fopen(conf->file, "r"); if (!fp) { if (errno == ENOENT) smclog(LOG_NOTICE, "Configuration file %s does not exist", conf->file); else smclog(LOG_WARNING, "Failed opening %s: %s", conf->file, strerror(errno)); if (!conf_vrfy) smclog(LOG_NOTICE, "Continuing anyway, waiting for client to connect."); return 1; } linebuf = malloc(MAX_LINE_LEN * sizeof(char)); if (!linebuf) { int tmp = errno; fclose(fp); errno = tmp; smclog(LOG_ERR, "Failed allocating memory to read .conf file: %s", strerror(errno)); exit(EX_OSERR); } conf->lineno = 0; next: while ((line = fgets(linebuf, MAX_LINE_LEN, fp))) { int mrdisc = 0, threshold = DEFAULT_THRESHOLD; int op = 0, num = 0, enable = do_vifs; char *oif[MAX_MC_VIFS]; char *include = NULL; char *source = NULL; char *group = NULL; char *iif = NULL; char *ttl = NULL; char *token; glob_t gl; size_t i; /* Strip any line end character(s) */ chomp(line); conf->lineno++; DEBUG("%s", line); while ((token = pop_token(&line))) { /* Strip comments. */ if (match("#", token)) break; if (!op) { if (match("mgroup", token)) { op = MGROUP; } else if (match("ssmgroup", token)) { op = MGROUP; /* Compat */ } else if (match("mroute", token)) { op = MROUTE; } else if (match("phyint", token)) { op = PHYINT; iif = pop_token(&line); if (!iif) { WARN("phyint missing interface pattern"); goto next; } } else if (match("include", token)) { op = INCLUDE; include = pop_token(&line); smclog(LOG_DEBUG, "Found include --> %s", include); break; } else { WARN("Unknown command %s, skipping.", token); goto next; } } if (match("from", token)) { iif = pop_token(&line); } else if (match("source", token)) { source = pop_token(&line); } else if (match("group", token)) { group = pop_token(&line); } else if (match("to", token)) { while ((oif[num] = pop_token(&line))) num++; } else if (match("enable", token)) { enable = 1; } else if (match("disable", token)) { enable = 0; } else if (match("mrdisc", token)) { mrdisc = 1; } else if (match("ttl-threshold", token)) { ttl = pop_token(&line); } } if (iif && !iface_exist(iif)) { switch (op) { case MGROUP: WARN("mgroup from %s matches no valid phyint, skipping ...", iif); break; case MROUTE: WARN("mroute from %s matches no valid phyint, skipping ...", iif); break; default: WARN("phyint %s does not exist (yet?) on this system", iif); break; } continue; } if (ttl) { int val = atoi(ttl); if (val < 1 || val > 255) WARN("phyint %s ttl %s out of range (1-255)", iif ? iif : "", ttl); else threshold = val; } switch (op) { case EMPTY: break; case MGROUP: rc += conf_mgroup(conf, 1, iif, source, group); break; case MROUTE: rc += conf_mroute(conf, 1, iif, source, group, oif, num); break; case PHYINT: rc += conf_phyint(conf, enable, iif, mrdisc, threshold); break; case INCLUDE: glob(include, 0, NULL, &gl); for (i = 0; i < gl.gl_pathc; i++) { struct conf inc = { .file = gl.gl_pathv[i] }; smclog(LOG_DEBUG, "Glob expansion to %s ...", gl.gl_pathv[i]); if (conf_parse(&inc, do_vifs)) smclog(LOG_WARNING, "Failed reading %s: %s", gl.gl_pathv[i], strerror(errno)); } globfree(&gl); break; default: WARN("Unknown token %d", op); break; } } free(linebuf); fclose(fp); if (rc) { errno = EOPNOTSUPP; return 1; } return 0; } /* Parse .conf file and setup routes */ int conf_read(char *file, int do_vifs) { struct conf conf = { .file = file }; if (conf_parse(&conf, do_vifs)) { if (errno == EOPNOTSUPP) smclog(LOG_WARNING, "Parse error in %s", file); return EX_CONFIG; } if (conf_vrfy) return EX_OK; return script_exec(NULL); } /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/systemd.c0000644000175100001710000000051314146403320012721 00000000000000/* systemd service monitor backend */ #include #include void systemd_notify_ready(const char *status) { sd_notifyf(0, "READY=1\nSTATUS=%s\nMAINPID=%lu\n", status, (unsigned long)getpid()); } void systemd_notify_reload(const char *status) { sd_notifyf(0, "RELOADING=1\nSTATUS=%s\n", status); } smcroute-2.5.5/src/smcroutectl.c0000644000175100001710000002572714146403320013613 00000000000000/* Client for smcrouted, not needed if only using smcroute.conf * * Copyright (C) 2011-2021 Joachim Wiberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "config.h" #include #include #include #include #include #include #include #ifdef HAVE_TERMIOS_H # include #endif #include #include #include #include #include #include "msg.h" #include "util.h" static const char version_info[] = PACKAGE_NAME " v" PACKAGE_VERSION; static char *ident = PACKAGE; static char *sock_file = NULL; static char *prognm = NULL; static int heading = 1; static int plain = 0; struct arg { char *name; int min_args; /* 0: command takes no arguments */ int val; char *arg; char *help; char *example; /* optional */ int has_detail; } args[] = { { NULL, 0, 'd', NULL, "Detailed output in show command", NULL, 0 }, { NULL, 1, 'i', "NAME", "Identity of routing daemon instance, default: " PACKAGE, "foo", 0 }, { NULL, 1, 'I', "NAME", NULL, NULL, 0 }, /* Alias, compat with older versions */ { NULL, 0, 'p', NULL, "Use plain table headings, no ctrl chars", NULL, 0 }, { NULL, 0, 't', NULL, "Skip table heading in show command", NULL, 0 }, { NULL, 1, 'u', "FILE", "UNIX domain socket for daemon, default: " RUNSTATEDIR "/" PACKAGE ".sock", "/tmp/foo.sock", 0 }, { "help", 0, 'h', NULL, "Show help text", NULL, 0 }, { "version", 0, 'v', NULL, "Show program version and support information", NULL, 0 }, { "flush" , 0, 'F', NULL, "Flush all dynamically installed (*,G) multicast routes", NULL, 0 }, { "kill", 0, 'k', NULL, "Kill running daemon", NULL, 0 }, { "reload", 0, 'H', NULL, "Reload .conf file, like SIGHUP", NULL, 0 }, { "restart", 0, 'H', NULL, NULL, NULL, 0 }, /* Alias, compat with older versions */ { "show", 0, 's', NULL, "Show status of routes, joined groups, interfaces, etc.", NULL, 1 }, { "add", 3, 'a', NULL, "Add a multicast route", "eth0 192.168.2.42 225.1.2.3 eth1 eth2", 0 }, { "remove", 2, 'r', NULL, "Remove a multicast route", "eth0 192.168.2.42 225.1.2.3", 0 }, { "del", 2, 'r', NULL, NULL, NULL, 0 }, /* Alias */ { "join", 2, 'j', NULL, "Join multicast group on an interface", "eth0 225.1.2.3", 0 }, { "leave", 2, 'l', NULL, "Leave joined multicast group", "eth0 225.1.2.3", 0 }, { NULL, 0, 0, NULL, NULL, NULL, 0 } }; /* * Build IPC message to send to the daemon using @cmd and @count * number of arguments from @argv. */ static struct ipc_msg *msg_create(uint16_t cmd, char *argv[], size_t count) { struct ipc_msg *msg; size_t len = 0; size_t i, sz; char *ptr; for (i = 0; i < count; i++) len += strlen(argv[i]) + 1; sz = sizeof(struct ipc_msg) + len + 1; if (sz > MX_CMDPKT_SZ) { errno = EMSGSIZE; return NULL; } msg = calloc(1, sz); if (!msg) return NULL; msg->len = sz; msg->cmd = cmd; msg->count = count; ptr = (char *)msg->argv; for (i = 0; i < count; i++) { len = strlen(argv[i]) + 1; ptr = memcpy(ptr, argv[i], len) + len; } *ptr = '\0'; /* '\0' behind last string */ return msg; } #define ESC "\033" static int get_width(void) { int ret = 79; #ifdef HAVE_TERMIOS_H struct pollfd fd = { STDIN_FILENO, POLLIN, 0 }; struct termios tc, saved; char buf[42]; memset(buf, 0, sizeof(buf)); tcgetattr(STDERR_FILENO, &tc); saved = tc; tc.c_cflag |= (CLOCAL | CREAD); tc.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); tcsetattr(STDERR_FILENO, TCSANOW, &tc); fprintf(stderr, ESC "7" ESC "[r" ESC "[999;999H" ESC "[6n"); if (poll(&fd, 1, 300) > 0) { int row, col; if (scanf(ESC "[%d;%dR", &row, &col) == 2) ret = col; } fprintf(stderr, ESC "8"); tcsetattr(STDERR_FILENO, TCSANOW, &saved); #endif return ret; } static void print(char *line, int indent) { int type = 0; int i, len; chomp(line); /* Table headings, or repeat headers, end with a '=' */ len = (int)strlen(line) - 1; if (len > 0) { if (line[len] == '_') type = 1; if (line[len] == '=') type = 2; if (type) { if (!heading) return; line[len] = 0; } } switch (type) { case 1: if (!plain) { fprintf(stdout, "\e[4m%*s\e[0m\n%s\n", get_width(), "", line); return; } len = len < 79 ? 79 : len; for (i = 0; i < len; i++) fputc('_', stdout); fprintf(stdout, "\n%*s%s\n", indent, "", line); break; case 2: if (!plain) { len = get_width() - len; fprintf(stdout, "\e[7m%s%*s\e[0m\n", line, len, ""); return; } len = len < 79 ? 79 : len; for (i = 0; i < len; i++) fputc('=', stdout); fprintf(stdout, "\n%*s%s\n", indent, "", line); for (i = 0; i < len; i++) fputc('=', stdout); fputs("\n", stdout); break; default: puts(line); break; } } /* * Connects to the IPC socket of the server */ static int ipc_connect(char *path) { struct sockaddr_un sa; socklen_t len; int sd; sd = socket(AF_UNIX, SOCK_STREAM, 0); if (sd < 0) return -1; #ifdef HAVE_SOCKADDR_UN_SUN_LEN sa.sun_len = 0; /* <- correct length is set by the OS */ #endif sa.sun_family = AF_UNIX; if (!path) snprintf(sa.sun_path, sizeof(sa.sun_path), "%s/%s.sock", RUNSTATEDIR, ident); else snprintf(sa.sun_path, sizeof(sa.sun_path), "%s", path); len = offsetof(struct sockaddr_un, sun_path) + strlen(sa.sun_path); if (connect(sd, (struct sockaddr *)&sa, len) < 0) { int err = errno; if (ENOENT == errno) warnx("Cannot find IPC socket %s", sa.sun_path); close(sd); errno = err; return -1; } return sd; } static int ipc_command(uint16_t cmd, char *argv[], size_t count) { char buf[MX_CMDPKT_SZ + 1]; struct ipc_msg *msg; int retries = 30; int result = 0; ssize_t total; ssize_t len; FILE *fp; int sd; msg = msg_create(cmd, argv, count); if (!msg) { warn("Failed constructing IPC command"); return 1; } while ((sd = ipc_connect(sock_file)) < 0) { switch (errno) { case EACCES: warnx("Need root privileges to connect to daemon"); break; case ECONNREFUSED: if (--retries) { usleep(100000); continue; } warnx("Daemon not running"); break; case ENOENT: if (!sock_file) { warnx("Daemon may be running with another -i NAME"); break; } /* fallthrough */ default: warn("Failed connecting to daemon"); break; } free(msg); return 1; } /* Send command */ if (write(sd, msg, msg->len) != (ssize_t)msg->len) { warn("Communication with daemon failed"); close(sd); free(msg); return 1; } fp = tempfile(); if (!fp) { close(sd); free(msg); err(EX_OSERR, "Failed creating tempfile()"); } total = 0; while ((len = read(sd, buf, sizeof(buf) - 1)) > 0) { total += len; buf[len] = 0; fwrite(buf, len, 1, fp); } rewind(fp); if (total > 1) { if (cmd == 'S' || cmd == 's') { while (fgets(buf, sizeof(buf), fp)) print(buf, 0); } else { if (fgets(buf, sizeof(buf), fp)) warnx("%s", buf); result = 1; } } fclose(fp); close(sd); free(msg); return result; } static int usage(int code) { int i; printf("Usage:\n %s [OPTIONS] CMD [ARGS]\n\n", prognm); printf("Options:\n"); for (i = 0; args[i].val; i++) { if (!args[i].help) continue; if (args[i].name) continue; printf(" -%c %-10s %s\n", args[i].val, args[i].arg ? args[i].arg : "", args[i].help); } printf("\nCommands:\n"); for (i = 0; args[i].val; i++) { if (!args[i].help) continue; if (!args[i].name) continue; printf(" %-7s %s %s\n", args[i].name, args[i].min_args ? "ARGS" : " ", args[i].help); } printf("\nArguments:\n" " <---------- INBOUND ------------> <- OUTBOUND ->\n" " add IIF [SOURCE-IP[/LEN]] GROUP[/LEN] OIF [OIF ... ]\n" " remove IIF [SOURCE-IP[/LEN]] GROUP[/LEN]\n" "\n" " join IIF [SOURCE-IP[/LEN]] GROUP[/LEN]\n" " leave IIF [SOURCE-IP[/LEN]] GROUP[/LEN]\n" "\n" " show interfaces Show configured multicast interfaces\n" " show groups Show joined multicast groups\n" " show routes Show (*,G) and (S,G) multicast routes, default\n" "\n" "Note:\n" " Inbound (IIF) and outbound (OIF) interfaces can be either an interface\n" " name or a wildcard. E.g., \"eth+\" matches eth0, eth15, etc.\n" "\n"); return code; } static int version(void) { puts(version_info); printf("\n" "Bug report address: %s\n", PACKAGE_BUGREPORT); #ifdef PACKAGE_URL printf("Project homepage: %s\n", PACKAGE_URL); #endif return 0; } static char *progname(const char *arg0) { char *nm; nm = strrchr(arg0, '/'); if (nm) nm++; else nm = (char *)arg0; return nm; } int main(int argc, char *argv[]) { int help = 0, detail = 0; int c, i, pos = 1, status = 0; struct arg *cmd = NULL; prognm = progname(argv[0]); while ((c = getopt(argc, argv, "dhI:i:ptu:v")) != EOF) { switch (c) { case 'd': detail++; break; case 'h': help++; break; case 'I': /* compat with previous versions */ case 'i': ident = optarg; break; case 'p': plain = 1; break; case 't': heading = 0; break; case 'u': sock_file = optarg; break; case 'v': return version(); default: return usage(1); } } pos = optind; while (pos < argc && !cmd) { char *arg = argv[pos]; for (i = 0; args[i].val; i++) { char *nm = args[i].name; size_t len; if (!nm) continue; len = MIN(strlen(nm), strlen(arg)); if (strncmp(arg, nm, len)) continue; c = args[i].val; switch (c) { case 'h': help++; break; case 'v': return version(); default: cmd = &args[i]; if (help) goto help; if (argc - (pos + 1) < args[i].min_args) { warnx("Not enough arguments to command %s", nm); status = 1; goto help; } break; } break; /* Next arg */ } pos++; } if (help) { if (!cmd) return usage(0); help: while (!cmd->help) cmd--; printf("Help:\n" " %s\n\n" "Example:\n" " %s %s %s\n\n", cmd->help, prognm, cmd->name, cmd->example ? cmd->example : ""); return status; } if (!cmd) return ipc_command(detail ? 'S' : 's', NULL, 0); c = cmd->val; if (detail && cmd->has_detail) c -= 0x20; return ipc_command(c, &argv[pos], argc - pos); } /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/smcrouted.c0000644000175100001710000002627714146403320013255 00000000000000/* Static multicast routing daemon * * Copyright (C) 2011-2021 Joachim Wiberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "config.h" #include #include #include #include #include #include #include #include #include /* gettimeofday() */ #include #include "cap.h" #include "ipc.h" #include "log.h" #include "msg.h" #include "conf.h" #include "iface.h" #include "util.h" #include "timer.h" #include "notify.h" #include "script.h" #include "socket.h" #include "mrdisc.h" #include "mroute.h" #include "mcgroup.h" int background = 1; int do_vifs = 1; int do_syslog = 1; int cache_tmo = 60; int interval = MRDISC_INTERVAL_DEFAULT; int startup_delay = 0; int exit_delay = 0; int table_id = 0; char *script = NULL; char *ident = PACKAGE; char *prognm = NULL; char *pid_file = NULL; char *conf_file = NULL; char *sock_file = NULL; int conf_vrfy = 0; static uid_t uid = 0; static gid_t gid = 0; volatile sig_atomic_t reloading = 0; volatile sig_atomic_t running = 1; static const char version_info[] = PACKAGE_NAME " v" PACKAGE_VERSION; /* Cleans up, i.e. releases allocated resources. Called via atexit() */ static void clean(void) { timer_exit(); mroute_exit(); mcgroup_exit(); ipc_exit(); iface_exit(); smclog(LOG_NOTICE, "Exiting."); } void reload(void) { notify_reload(); mcgroup_reload_beg(); mroute_reload_beg(); iface_update(); conf_read(conf_file, do_vifs); mroute_reload_end(do_vifs); mcgroup_reload_end(); /* Acknowledge client SIGHUP/reload */ notify_ready(NULL, uid, gid); } /* * Signal handler. Take note of the fact that the signal arrived * so that the main loop can take care of it. */ static void handler(int signo) { switch (signo) { case SIGINT: case SIGTERM: running = 0; break; case SIGHUP: reloading = 1; break; } } static void signal_init(void) { struct sigaction sa; sa.sa_handler = handler; sa.sa_flags = 0; /* Interrupt system calls */ sigemptyset(&sa.sa_mask); if (sigaction(SIGHUP, &sa, NULL) || sigaction(SIGTERM, &sa, NULL) || sigaction(SIGINT, &sa, NULL)) smclog(LOG_WARNING, "Failed setting up signal handlers: %s", strerror(errno)); } static void server_exit(void *arg) { (void)arg; smclog(LOG_NOTICE, "Exit delay timer expired."); exit(0); } static int server_loop(void) { script_init(script); mrdisc_init(interval); while (running) { if (reloading) { reload(); reloading = 0; } socket_poll(NULL); } return 0; } /* Init everything before forking, so we can fail and return an * error code in the parent and the initscript will fail */ static int start_server(void) { int api = 2, busy = 0; if (geteuid() != 0) { smclog(LOG_ERR, "Need root privileges to start %s", prognm); return EX_NOPERM; } if (background) { if (daemon(0, 0) < 0) { smclog(LOG_ERR, "Failed daemonizing: %s", strerror(errno)); return EX_OSERR; } } /* Hello world! */ smclog(LOG_NOTICE, "%s", version_info); if (startup_delay > 0) { smclog(LOG_INFO, "Startup delay requested, waiting %d sec before continuing.", startup_delay); sleep(startup_delay); } /* * Timer API needs to be initilized before mroute_init() */ timer_init(); if (exit_delay > 0) { smclog(LOG_INFO, "Exit delay requested, starting background timer, %d sec", exit_delay); timer_add(exit_delay, server_exit, NULL); } /* * Build list of multicast-capable physical interfaces */ iface_init(); if (mroute_init(do_vifs, table_id, cache_tmo)) { if (errno == EADDRINUSE) busy++; api--; } /* At least one API (IPv4 or IPv6) must have initialized successfully * otherwise we abort the server initialization. */ if (!api) { if (busy) { smclog(LOG_ERR, "Another multicast routing application is already running."); exit(EX_UNAVAILABLE); } smclog(LOG_ERR, "Kernel does not support multicast routing."); exit(EX_PROTOCOL); } atexit(clean); signal_init(); mcgroup_init(); ipc_init(sock_file); conf_read(conf_file, do_vifs); /* Everything setup, notify any clients waiting for us */ notify_ready(pid_file, uid, gid); /* Drop root privileges before entering the server loop */ cap_drop_root(uid, gid); return server_loop(); } static void cleanup(void) { if (conf_file) free(conf_file); conf_file = NULL; if (sock_file) free(sock_file); sock_file = NULL; } static int compose_paths(void) { /* Default .conf file path: "/etc" + '/' + "smcroute" + ".conf" */ if (!conf_file) { size_t len = strlen(SYSCONFDIR) + strlen(ident) + 7; conf_file = malloc(len); if (!conf_file) { smclog(LOG_ERR, "Failed allocating memory, exiting: %s", strerror(errno)); exit(EX_OSERR); } snprintf(conf_file, len, "%s/%s.conf", SYSCONFDIR, ident); } if (!sock_file) { size_t len = strlen(RUNSTATEDIR) + strlen(ident) + 7; sock_file = malloc(len); if (!sock_file) { smclog(LOG_ERR, "Failed allocating memory, exiting: %s", strerror(errno)); exit(EX_OSERR); } snprintf(sock_file, len, "%s/%s.sock", RUNSTATEDIR, ident); } /* Default is to let pidfile() API construct PID file from ident */ if (!pid_file) pid_file = ident; atexit(cleanup); return 0; } static int usage(int code) { char *pidfn; size_t len; compose_paths(); len = sizeof(RUNSTATEDIR) + strlen(pid_file) + 6; pidfn = malloc(len); if (!pidfn) err(EX_OSERR, "Failed allocating memory for PID file name"); if (pid_file[0] != '/') snprintf(pidfn, len, "%s/%s.pid", RUNSTATEDIR, pid_file); else snprintf(pidfn, len, "%s", pid_file); printf("Usage:\n" " %s [-hnNsv] [-c SEC] [-d SEC] [-e CMD] [-f FILE] [-i NAME] [-l LVL] " "\n" " " #ifdef ENABLE_MRDISC "[-m SEC] " #endif "[-P FILE] [-t ID] [-u FILE]\n" "\n" "Options:\n" " -c SEC Flush dynamic (*,G) multicast routes every SEC seconds,\n" " default 60 sec. Useful when source/interface changes\n" " -d SEC Startup delay, useful for delaying interface probe at boot\n" " -e CMD Script or command to call on startup/reload when all routes\n" " have been installed, or when a (*,G) is installed\n" " -f FILE Configuration file, default use ident NAME: %s\n" " -F FILE Check configuration file syntax, use -l to increase verbosity\n" " -h This help text\n" " -i NAME Identity for .conf/.pid/.sock file, and syslog, default: %s\n" " -l LVL Set log level: none, err, notice*, info, debug\n" #ifdef ENABLE_MRDISC " -m SEC Multicast router discovery, 4-180, default: 20 sec\n" #endif " -n Run daemon in foreground, when started by systemd or finit\n" " -N No multicast VIFs/MIFs created by default. Use with\n" " smcroute.conf `phyint enable` directive\n" #ifdef ENABLE_LIBCAP " -p USER[:GROUP] After initialization set UID and GID to USER and GROUP\n" #endif " -P FILE Set daemon PID file name, with optional path.\n" " Default use ident NAME: %s\n" " -s Use syslog, default unless running in foreground, -n\n" " -t ID Set multicast routing table ID, default: 0\n" " -u FILE UNIX domain socket path, for use with smcroutectl.\n" " Default use ident NAME: %s\n" " -v Show program version and support information\n" "\n", prognm, conf_file, ident, pidfn, sock_file); free(pidfn); cleanup(); return code; } static char *progname(const char *arg0) { char *nm; nm = strrchr(arg0, '/'); if (nm) nm++; else nm = (char *)arg0; return nm; } /** * main - Main program * * Parses command line options and enters either daemon or client mode. * * In daemon mode, acquires multicast routing sockets, opens IPC socket * and goes in receive-execute command loop. * * In client mode, creates commands from command line and sends them to * the daemon. */ int main(int argc, char *argv[]) { int log_opts = LOG_NDELAY | LOG_PID; int c, new_log_level = -1; prognm = progname(argv[0]); while ((c = getopt(argc, argv, "c:d:D:e:f:F:hI:i:l:m:nNp:P:st:u:v")) != EOF) { switch (c) { case 'c': /* cache timeout */ cache_tmo = atoi(optarg); break; case 'd': startup_delay = atoi(optarg); break; case 'D': /* Undocumented, used for testing. */ exit_delay = atoi(optarg); break; case 'e': script = optarg; break; case 'F': log_level = LOG_INFO; /* Raise log level for verify */ conf_vrfy = 1; /* fallthrough */ case 'f': conf_file = strdup(optarg); break; case 'h': /* help */ return usage(EX_OK); case 'I': /* compat with previous versions */ case 'i': ident = optarg; break; case 'l': new_log_level = loglvl(optarg); break; case 'm': #ifndef ENABLE_MRDISC warnx("Built without mrdisc support."); #else interval = atoi(optarg); if (interval < 4 || interval > 180) errx(1, "Invalid mrdisc announcement interval, 4-180."); #endif break; case 'n': /* run daemon in foreground, i.e., do not fork */ background = 0; do_syslog--; break; case 'N': do_vifs = 0; break; case 'p': cap_set_user(optarg, &uid, &gid); break; case 'P': /* Handled separately from the other files, no strdup() */ pid_file = optarg; break; case 's': /* Force syslog even though in foreground */ do_syslog++; break; case 't': #ifndef __linux__ errx(1, "Different multicast routing tables only available on Linux."); #else table_id = atoi(optarg); if (table_id < 0) return usage(EX_USAGE); #endif break; case 'u': sock_file = strdup(optarg); break; case 'v': /* version */ puts(version_info); printf("\n" "Bug report address: %s\n", PACKAGE_BUGREPORT); #ifdef PACKAGE_URL printf("Project homepage: %s\n", PACKAGE_URL); #endif return EX_OK; default: /* unknown option */ return usage(EX_USAGE); } } if (new_log_level != -1) log_level = new_log_level; compose_paths(); if (conf_vrfy) { smclog(LOG_INFO, "Verifying configuration file %s ...", conf_file); iface_init(); c = conf_read(conf_file, do_vifs); iface_exit(); return c; } if (!background && do_syslog < 1) log_opts |= LOG_PERROR; openlog(ident, log_opts, LOG_DAEMON); setlogmask(LOG_UPTO(log_level)); return start_server(); } /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/script.c0000644000175100001710000000537514146403320012550 00000000000000/* Run script when a (*,G) group is matched and installed in the kernel * * Copyright (C) 2011-2021 Joachim Wiberg * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include #include /* sigemptyset(), sigaction() */ #include #include #include #include #include #include #include #include /* AF_INET, AF_INET6 */ #include "log.h" #include "iface.h" #include "script.h" static char *exec = NULL; static pid_t script = 0; static void handler(int signo) { int status; pid_t pid = 1; (void)signo; while (pid > 0) { pid = waitpid(-1, &status, WNOHANG); if (pid == script) { script = 0; /* Script exit OK. */ if (WIFEXITED(status)) continue; /* Script exit status ... */ status = WEXITSTATUS(status); if (status) smclog(LOG_WARNING, "Script %s returned error: %d", exec, status); } } } int script_init(char *script) { struct sigaction sa; if (script && access(script, X_OK)) { smclog(LOG_ERR, "%s is not executable.", script); return -1; } exec = script; sa.sa_handler = handler; sa.sa_flags = 0; sigemptyset(&sa.sa_mask); sigaction(SIGCHLD, &sa, NULL); return 0; } int script_exec(struct mroute *mroute) { pid_t pid; char *argv[] = { exec, "reload", NULL, }; if (!exec) return 0; if (mroute) { char source[INET_ADDRSTR_LEN], group[INET_ADDRSTR_LEN]; inet_addr2str(&mroute->source, source, sizeof(source)); inet_addr2str(&mroute->group, group, sizeof(group)); setenv("source", source, 1); setenv("group", group, 1); argv[1] = "install"; } else { unsetenv("source"); unsetenv("group"); } pid = fork(); if (!pid) { /* Prevent children from accessing systemd socket (if enabled) */ unsetenv("NOTIFY_SOCKET"); _exit(execv(argv[0], argv)); } if (pid < 0) { smclog(LOG_WARNING, "Cannot start script %s: %s", exec, strerror(errno)); return EX_OSERR; } script = pid; return EX_OK; } /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/queue.h0000644000175100001710000004362114146403320012371 00000000000000/* $OpenBSD: queue.h,v 1.43 2015/12/28 19:38:40 millert Exp $ */ /* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */ /* * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)queue.h 8.5 (Berkeley) 8/20/94 */ #ifndef _SYS_QUEUE_H_ #define _SYS_QUEUE_H_ /* * This file defines five types of data structures: singly-linked lists, * lists, simple queues, tail queues and XOR simple queues. * * * A singly-linked list is headed by a single forward pointer. The elements * are singly linked for minimum space and pointer manipulation overhead at * the expense of O(n) removal for arbitrary elements. New elements can be * added to the list after an existing element or at the head of the list. * Elements being removed from the head of the list should use the explicit * macro for this purpose for optimum efficiency. A singly-linked list may * only be traversed in the forward direction. Singly-linked lists are ideal * for applications with large datasets and few or no removals or for * implementing a LIFO queue. * * A list is headed by a single forward pointer (or an array of forward * pointers for a hash table header). The elements are doubly linked * so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before * or after an existing element or at the head of the list. A list * may only be traversed in the forward direction. * * A simple queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are singly * linked to save space, so elements can only be removed from the * head of the list. New elements can be added to the list before or after * an existing element, at the head of the list, or at the end of the * list. A simple queue may only be traversed in the forward direction. * * A tail queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are doubly * linked so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before or * after an existing element, at the head of the list, or at the end of * the list. A tail queue may be traversed in either direction. * * An XOR simple queue is used in the same way as a regular simple queue. * The difference is that the head structure also includes a "cookie" that * is XOR'd with the queue pointer (first, last or next) to generate the * real pointer value. * * For details on the use of these macros, see the queue(3) manual page. */ #if defined(QUEUE_MACRO_DEBUG) || (defined(_KERNEL) && defined(DIAGNOSTIC)) #define _Q_INVALIDATE(a) (a) = ((void *)-1) #else #define _Q_INVALIDATE(a) #endif /* * Singly-linked List definitions. */ #define SLIST_HEAD(name, type) \ struct name { \ struct type *slh_first; /* first element */ \ } #define SLIST_HEAD_INITIALIZER(head) \ { NULL } #define SLIST_ENTRY(type) \ struct { \ struct type *sle_next; /* next element */ \ } /* * Singly-linked List access methods. */ #define SLIST_FIRST(head) ((head)->slh_first) #define SLIST_END(head) NULL #define SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head)) #define SLIST_NEXT(elm, field) ((elm)->field.sle_next) #define SLIST_FOREACH(var, head, field) \ for((var) = SLIST_FIRST(head); \ (var) != SLIST_END(head); \ (var) = SLIST_NEXT(var, field)) #define SLIST_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = SLIST_FIRST(head); \ (var) && ((tvar) = SLIST_NEXT(var, field), 1); \ (var) = (tvar)) /* * Singly-linked List functions. */ #define SLIST_INIT(head) { \ SLIST_FIRST(head) = SLIST_END(head); \ } #define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ (elm)->field.sle_next = (slistelm)->field.sle_next; \ (slistelm)->field.sle_next = (elm); \ } while (0) #define SLIST_INSERT_HEAD(head, elm, field) do { \ (elm)->field.sle_next = (head)->slh_first; \ (head)->slh_first = (elm); \ } while (0) #define SLIST_REMOVE_AFTER(elm, field) do { \ (elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \ } while (0) #define SLIST_REMOVE_HEAD(head, field) do { \ (head)->slh_first = (head)->slh_first->field.sle_next; \ } while (0) #define SLIST_REMOVE(head, elm, type, field) do { \ if ((head)->slh_first == (elm)) { \ SLIST_REMOVE_HEAD((head), field); \ } else { \ struct type *curelm = (head)->slh_first; \ \ while (curelm->field.sle_next != (elm)) \ curelm = curelm->field.sle_next; \ curelm->field.sle_next = \ curelm->field.sle_next->field.sle_next; \ } \ _Q_INVALIDATE((elm)->field.sle_next); \ } while (0) /* * List definitions. */ #define LIST_HEAD(name, type) \ struct name { \ struct type *lh_first; /* first element */ \ } #define LIST_HEAD_INITIALIZER(head) \ { NULL } #define LIST_ENTRY(type) \ struct { \ struct type *le_next; /* next element */ \ struct type **le_prev; /* address of previous next element */ \ } /* * List access methods. */ #define LIST_FIRST(head) ((head)->lh_first) #define LIST_END(head) NULL #define LIST_EMPTY(head) (LIST_FIRST(head) == LIST_END(head)) #define LIST_NEXT(elm, field) ((elm)->field.le_next) #define LIST_FOREACH(var, head, field) \ for((var) = LIST_FIRST(head); \ (var)!= LIST_END(head); \ (var) = LIST_NEXT(var, field)) #define LIST_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = LIST_FIRST(head); \ (var) && ((tvar) = LIST_NEXT(var, field), 1); \ (var) = (tvar)) /* * List functions. */ #define LIST_INIT(head) do { \ LIST_FIRST(head) = LIST_END(head); \ } while (0) #define LIST_INSERT_AFTER(listelm, elm, field) do { \ if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ (listelm)->field.le_next->field.le_prev = \ &(elm)->field.le_next; \ (listelm)->field.le_next = (elm); \ (elm)->field.le_prev = &(listelm)->field.le_next; \ } while (0) #define LIST_INSERT_BEFORE(listelm, elm, field) do { \ (elm)->field.le_prev = (listelm)->field.le_prev; \ (elm)->field.le_next = (listelm); \ *(listelm)->field.le_prev = (elm); \ (listelm)->field.le_prev = &(elm)->field.le_next; \ } while (0) #define LIST_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.le_next = (head)->lh_first) != NULL) \ (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ (head)->lh_first = (elm); \ (elm)->field.le_prev = &(head)->lh_first; \ } while (0) #define LIST_REMOVE(elm, field) do { \ if ((elm)->field.le_next != NULL) \ (elm)->field.le_next->field.le_prev = \ (elm)->field.le_prev; \ *(elm)->field.le_prev = (elm)->field.le_next; \ _Q_INVALIDATE((elm)->field.le_prev); \ _Q_INVALIDATE((elm)->field.le_next); \ } while (0) #define LIST_REPLACE(elm, elm2, field) do { \ if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \ (elm2)->field.le_next->field.le_prev = \ &(elm2)->field.le_next; \ (elm2)->field.le_prev = (elm)->field.le_prev; \ *(elm2)->field.le_prev = (elm2); \ _Q_INVALIDATE((elm)->field.le_prev); \ _Q_INVALIDATE((elm)->field.le_next); \ } while (0) /* * Simple queue definitions. */ #define SIMPLEQ_HEAD(name, type) \ struct name { \ struct type *sqh_first; /* first element */ \ struct type **sqh_last; /* addr of last next element */ \ } #define SIMPLEQ_HEAD_INITIALIZER(head) \ { NULL, &(head).sqh_first } #define SIMPLEQ_ENTRY(type) \ struct { \ struct type *sqe_next; /* next element */ \ } /* * Simple queue access methods. */ #define SIMPLEQ_FIRST(head) ((head)->sqh_first) #define SIMPLEQ_END(head) NULL #define SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head)) #define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) #define SIMPLEQ_FOREACH(var, head, field) \ for((var) = SIMPLEQ_FIRST(head); \ (var) != SIMPLEQ_END(head); \ (var) = SIMPLEQ_NEXT(var, field)) #define SIMPLEQ_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = SIMPLEQ_FIRST(head); \ (var) && ((tvar) = SIMPLEQ_NEXT(var, field), 1); \ (var) = (tvar)) /* * Simple queue functions. */ #define SIMPLEQ_INIT(head) do { \ (head)->sqh_first = NULL; \ (head)->sqh_last = &(head)->sqh_first; \ } while (0) #define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ (head)->sqh_last = &(elm)->field.sqe_next; \ (head)->sqh_first = (elm); \ } while (0) #define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.sqe_next = NULL; \ *(head)->sqh_last = (elm); \ (head)->sqh_last = &(elm)->field.sqe_next; \ } while (0) #define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ (head)->sqh_last = &(elm)->field.sqe_next; \ (listelm)->field.sqe_next = (elm); \ } while (0) #define SIMPLEQ_REMOVE_HEAD(head, field) do { \ if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ (head)->sqh_last = &(head)->sqh_first; \ } while (0) #define SIMPLEQ_REMOVE_AFTER(head, elm, field) do { \ if (((elm)->field.sqe_next = (elm)->field.sqe_next->field.sqe_next) \ == NULL) \ (head)->sqh_last = &(elm)->field.sqe_next; \ } while (0) #define SIMPLEQ_CONCAT(head1, head2) do { \ if (!SIMPLEQ_EMPTY((head2))) { \ *(head1)->sqh_last = (head2)->sqh_first; \ (head1)->sqh_last = (head2)->sqh_last; \ SIMPLEQ_INIT((head2)); \ } \ } while (0) /* * XOR Simple queue definitions. */ #define XSIMPLEQ_HEAD(name, type) \ struct name { \ struct type *sqx_first; /* first element */ \ struct type **sqx_last; /* addr of last next element */ \ unsigned long sqx_cookie; \ } #define XSIMPLEQ_ENTRY(type) \ struct { \ struct type *sqx_next; /* next element */ \ } /* * XOR Simple queue access methods. */ #define XSIMPLEQ_XOR(head, ptr) ((__typeof(ptr))((head)->sqx_cookie ^ \ (unsigned long)(ptr))) #define XSIMPLEQ_FIRST(head) XSIMPLEQ_XOR(head, ((head)->sqx_first)) #define XSIMPLEQ_END(head) NULL #define XSIMPLEQ_EMPTY(head) (XSIMPLEQ_FIRST(head) == XSIMPLEQ_END(head)) #define XSIMPLEQ_NEXT(head, elm, field) XSIMPLEQ_XOR(head, ((elm)->field.sqx_next)) #define XSIMPLEQ_FOREACH(var, head, field) \ for ((var) = XSIMPLEQ_FIRST(head); \ (var) != XSIMPLEQ_END(head); \ (var) = XSIMPLEQ_NEXT(head, var, field)) #define XSIMPLEQ_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = XSIMPLEQ_FIRST(head); \ (var) && ((tvar) = XSIMPLEQ_NEXT(head, var, field), 1); \ (var) = (tvar)) /* * XOR Simple queue functions. */ #define XSIMPLEQ_INIT(head) do { \ arc4random_buf(&(head)->sqx_cookie, sizeof((head)->sqx_cookie)); \ (head)->sqx_first = XSIMPLEQ_XOR(head, NULL); \ (head)->sqx_last = XSIMPLEQ_XOR(head, &(head)->sqx_first); \ } while (0) #define XSIMPLEQ_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.sqx_next = (head)->sqx_first) == \ XSIMPLEQ_XOR(head, NULL)) \ (head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \ (head)->sqx_first = XSIMPLEQ_XOR(head, (elm)); \ } while (0) #define XSIMPLEQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.sqx_next = XSIMPLEQ_XOR(head, NULL); \ *(XSIMPLEQ_XOR(head, (head)->sqx_last)) = XSIMPLEQ_XOR(head, (elm)); \ (head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \ } while (0) #define XSIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ if (((elm)->field.sqx_next = (listelm)->field.sqx_next) == \ XSIMPLEQ_XOR(head, NULL)) \ (head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \ (listelm)->field.sqx_next = XSIMPLEQ_XOR(head, (elm)); \ } while (0) #define XSIMPLEQ_REMOVE_HEAD(head, field) do { \ if (((head)->sqx_first = XSIMPLEQ_XOR(head, \ (head)->sqx_first)->field.sqx_next) == XSIMPLEQ_XOR(head, NULL)) \ (head)->sqx_last = XSIMPLEQ_XOR(head, &(head)->sqx_first); \ } while (0) #define XSIMPLEQ_REMOVE_AFTER(head, elm, field) do { \ if (((elm)->field.sqx_next = XSIMPLEQ_XOR(head, \ (elm)->field.sqx_next)->field.sqx_next) \ == XSIMPLEQ_XOR(head, NULL)) \ (head)->sqx_last = \ XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \ } while (0) /* * Tail queue definitions. */ #define TAILQ_HEAD(name, type) \ struct name { \ struct type *tqh_first; /* first element */ \ struct type **tqh_last; /* addr of last next element */ \ } #define TAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).tqh_first } #define TAILQ_ENTRY(type) \ struct { \ struct type *tqe_next; /* next element */ \ struct type **tqe_prev; /* address of previous next element */ \ } /* * Tail queue access methods. */ #define TAILQ_FIRST(head) ((head)->tqh_first) #define TAILQ_END(head) NULL #define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) #define TAILQ_LAST(head, headname) \ (*(((struct headname *)((head)->tqh_last))->tqh_last)) /* XXX */ #define TAILQ_PREV(elm, headname, field) \ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) #define TAILQ_EMPTY(head) \ (TAILQ_FIRST(head) == TAILQ_END(head)) #define TAILQ_FOREACH(var, head, field) \ for((var) = TAILQ_FIRST(head); \ (var) != TAILQ_END(head); \ (var) = TAILQ_NEXT(var, field)) #define TAILQ_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = TAILQ_FIRST(head); \ (var) != TAILQ_END(head) && \ ((tvar) = TAILQ_NEXT(var, field), 1); \ (var) = (tvar)) #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ for((var) = TAILQ_LAST(head, headname); \ (var) != TAILQ_END(head); \ (var) = TAILQ_PREV(var, headname, field)) #define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \ for ((var) = TAILQ_LAST(head, headname); \ (var) != TAILQ_END(head) && \ ((tvar) = TAILQ_PREV(var, headname, field), 1); \ (var) = (tvar)) /* * Tail queue functions. */ #define TAILQ_INIT(head) do { \ (head)->tqh_first = NULL; \ (head)->tqh_last = &(head)->tqh_first; \ } while (0) #define TAILQ_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ (head)->tqh_first->field.tqe_prev = \ &(elm)->field.tqe_next; \ else \ (head)->tqh_last = &(elm)->field.tqe_next; \ (head)->tqh_first = (elm); \ (elm)->field.tqe_prev = &(head)->tqh_first; \ } while (0) #define TAILQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.tqe_next = NULL; \ (elm)->field.tqe_prev = (head)->tqh_last; \ *(head)->tqh_last = (elm); \ (head)->tqh_last = &(elm)->field.tqe_next; \ } while (0) #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ (elm)->field.tqe_next->field.tqe_prev = \ &(elm)->field.tqe_next; \ else \ (head)->tqh_last = &(elm)->field.tqe_next; \ (listelm)->field.tqe_next = (elm); \ (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ } while (0) #define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ (elm)->field.tqe_next = (listelm); \ *(listelm)->field.tqe_prev = (elm); \ (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ } while (0) #define TAILQ_REMOVE(head, elm, field) do { \ if (((elm)->field.tqe_next) != NULL) \ (elm)->field.tqe_next->field.tqe_prev = \ (elm)->field.tqe_prev; \ else \ (head)->tqh_last = (elm)->field.tqe_prev; \ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ _Q_INVALIDATE((elm)->field.tqe_prev); \ _Q_INVALIDATE((elm)->field.tqe_next); \ } while (0) #define TAILQ_REPLACE(head, elm, elm2, field) do { \ if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \ (elm2)->field.tqe_next->field.tqe_prev = \ &(elm2)->field.tqe_next; \ else \ (head)->tqh_last = &(elm2)->field.tqe_next; \ (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \ *(elm2)->field.tqe_prev = (elm2); \ _Q_INVALIDATE((elm)->field.tqe_prev); \ _Q_INVALIDATE((elm)->field.tqe_next); \ } while (0) #define TAILQ_CONCAT(head1, head2, field) do { \ if (!TAILQ_EMPTY(head2)) { \ *(head1)->tqh_last = (head2)->tqh_first; \ (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ (head1)->tqh_last = (head2)->tqh_last; \ TAILQ_INIT((head2)); \ } \ } while (0) #endif /* !_SYS_QUEUE_H_ */ smcroute-2.5.5/src/ipc.h0000644000175100001710000000056114146403320012014 00000000000000/* Daemon IPC API */ #ifndef SMCROUTE_IPC_H_ #define SMCROUTE_IPC_H_ #include "config.h" int ipc_init (char *path); void ipc_exit (void); int ipc_send (int sd, char *buf, size_t len); void *ipc_receive (int sd, char *buf, size_t len); #endif /* SMCROUTE_IPC_H_ */ /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/mrdisc.h0000644000175100001710000000311214146403320012515 00000000000000/* Multicast Router Discovery Protocol, RFC4286 (IPv4 only) * * Copyright (C) 2017-2021 Joachim Wiberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef SMCROUTE_MRDISC_H_ #define SMCROUTE_MRDISC_H_ #include "config.h" #define MRDISC_INTERVAL_DEFAULT 20 #ifdef ENABLE_MRDISC int mrdisc_init (int interval); int mrdisc_exit (void); int mrdisc_register (char *ifname, short vif); int mrdisc_deregister ( short vif); int mrdisc_enable (short vif); int mrdisc_disable (short vif); void mrdisc_send ( void *arg); void mrdisc_recv (int sd, void *arg); #else #define mrdisc_init(interval) #define mrdisc_exit() #define mrdisc_register(ifname, vif) 0 #define mrdisc_deregister(vif) 0 #define mrdisc_enable(ifname) #define mrdisc_disable(ifname) {} #define mrdisc_send(arg) #define mrdisc_recv(sd, arg) #endif #endif /* SMCROUTE_MRDISC_H_ */ smcroute-2.5.5/src/notify.c0000644000175100001710000000266014146403320012546 00000000000000/* generic service monitor backend * * Copyright (C) 2019-2021 Joachim Wiberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include "log.h" #include "notify.h" #include "util.h" void notify_ready(char *pidfn, uid_t uid, gid_t gid) { const char *msg = "Ready, waiting for client request or kernel event."; if (pidfile_create(pidfn, uid, gid)) smclog(LOG_WARNING, "Failed create/chown PID file: %s", strerror(errno)); systemd_notify_ready(msg); smclog(LOG_NOTICE, msg); } void notify_reload(void) { const char *msg = "Reloading configuration, please wait ..."; systemd_notify_reload(msg); smclog(LOG_NOTICE, msg); } /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/cap.c0000644000175100001710000000745514146403320012010 00000000000000/* Daemon capability API * * Copyright (C) 2016 Markus Palonen * Copyright (C) 2016-2020 Joachim Wiberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "config.h" #include #include #include #include #include #include #ifdef HAVE_SYS_PRCTL_H # include #endif #include #include #include #include "log.h" static const char *username = NULL; static int whoami(const char *user, const char *group, uid_t *uid, gid_t *gid) { struct passwd *pw; struct group *gr; if (!user) return -1; /* Get target UID and target GID */ pw = getpwnam(user); if (!pw) { smclog(LOG_ERR, "User '%s' not found!", user); return -1; } *uid = pw->pw_uid; *gid = pw->pw_gid; if (group) { gr = getgrnam(group); if (!gr) { smclog(LOG_ERR, "Group '%s' not found!", group); return -1; } *gid = gr->gr_gid; } /* Valid user */ username = user; return 0; } static int setcaps(cap_value_t cv) { int result; cap_t caps = cap_get_proc(); cap_value_t cap_list = cv; cap_clear(caps); cap_set_flag(caps, CAP_PERMITTED, 1, &cap_list, CAP_SET); cap_set_flag(caps, CAP_EFFECTIVE, 1, &cap_list, CAP_SET); result = cap_set_proc(caps); cap_free(caps); return result; } /* * Drop root privileges except capability CAP_NET_ADMIN. This capability * enables the thread (among other networking related things) to add and * remove multicast routes */ static int drop_root(const char *user, uid_t uid, gid_t gid) { #ifdef HAVE_SYS_PRCTL_H /* Allow this process to preserve permitted capabilities */ if (prctl(PR_SET_KEEPCAPS, 1) == -1) { smclog(LOG_ERR, "Cannot preserve capabilities: %s", strerror(errno)); return -1; } #endif /* Set supplementary groups, GID and UID */ if (initgroups(user, gid) == -1) { smclog(LOG_ERR, "Failed setting supplementary groups: %s", strerror(errno)); return -1; } if (setgid(gid) == -1) { smclog(LOG_ERR, "Failed setting group ID %d: %s", gid, strerror(errno)); return -1; } if (setuid(uid) == -1) { smclog(LOG_ERR, "Failed setting user ID %d: %s", uid, strerror(errno)); return -1; } /* Clear all capabilities except CAP_NET_ADMIN */ if (setcaps(CAP_NET_ADMIN)) { smclog(LOG_ERR, "Failed setting `CAP_NET_ADMIN`: %s", strerror(errno)); return -1; } /* Try to regain root UID, should not work at this point. */ if (setuid(0) == 0) return -1; return 0; } void cap_drop_root(uid_t uid, gid_t gid) { if (username) { if (drop_root(username, uid, gid) == -1) smclog(LOG_WARNING, "Could not drop root privileges, continuing as root."); else smclog(LOG_INFO, "Root privileges dropped: Current UID %u, GID %u.", getuid(), getgid()); } } void cap_set_user(char *arg, uid_t *uid, gid_t *gid) { char *ptr; char *user; char *group; ptr = strdup(arg); if (!ptr) err(1, "Failed parsing user:group argument"); user = strtok(ptr, ":"); group = strtok(NULL, ":"); if (whoami(user, group, uid, gid)) err(1, "Invalid user:group argument"); free(ptr); } /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/msg.h0000644000175100001710000000316014146403320012025 00000000000000/* SMCRoute IPC API * * Multicast routes: * * add eth0 [1.1.1.1] 239.1.1.1 eth1 eth2 * * +----+-----+---+--------------------------------------------+ * | 42 | 'a' | 5 | "eth0\01.1.1.1\0239.1.1.1\0eth1\0eth2\0\0" | * +----+-----+---+--------------------------------------------+ * ^ ^ |-----| * | | `---> Second argument is optional => (*,G) * +-----cmd------+ * * del [1.1.1.1] 239.1.1.1 * * +----+-----+---+--------------------------+ * | 27 | 'r' | 2 | "1.1.1.1\0239.1.1.1\0\0" | * +----+-----+---+--------------------------+ * ^ ^ * | | * +-----cmd------+ * * Multicast groups: * * join/leave eth0 [1.1.1.1] 239.1.1.1 * * +----+-----+---+--------------------------------------------+ * | 32 | 'j' | 3 | "eth0\01.1.1.1\0239.1.1.1\0\0" | * +----+-----+---+--------------------------------------------+ * |-----| * `-----> For SSM group join/leave */ #ifndef SMCROUTE_MSG_H_ #define SMCROUTE_MSG_H_ #include #include #include #define MX_CMDPKT_SZ 1024 /* command size including appended strings */ struct ipc_msg { size_t len; /* total size of packet including cmd header */ uint16_t cmd; /* 'a'=Add,'r'=Remove,'j'=Join,'l'=Leave,'k'=Kill */ uint16_t count; /* command argument count */ char *argv[0]; /* 'count' * '\0' terminated strings + '\0' */ }; int msg_do(int sd, struct ipc_msg *msg); #endif /* SMCROUTE_MSG_H_ */ /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/ipc.c0000644000175100001710000001266314146403320012015 00000000000000/* Daemon IPC API * * Copyright (C) 2001-2005 Carsten Schill * Copyright (C) 2006-2009 Julien BLACHE * Copyright (C) 2009 Todd Hayton * Copyright (C) 2009-2011 Micha Lenk * Copyright (C) 2011-2021 Joachim Wiberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include #include #include #include #include "ipc.h" #include "log.h" #include "msg.h" #include "util.h" #include "socket.h" #include "mroute.h" extern char *ident; static struct sockaddr_un sun; static int ipc_socket = -1; /* Receive command from the smcroutectl */ static void ipc_read(int sd) { char buf[MX_CMDPKT_SZ]; struct ipc_msg *msg; memset(buf, 0, sizeof(buf)); msg = (struct ipc_msg *)ipc_receive(sd, buf, sizeof(buf)); if (!msg) { /* Skip logging client disconnects */ if (errno != ECONNRESET) smclog(LOG_WARNING, "Failed receiving IPC message from client: %s", strerror(errno)); return; } if (msg_do(sd, msg)) { if (EINVAL == errno) smclog(LOG_WARNING, "Unknown or malformed IPC message '%c' from client.", msg->cmd); errno = 0; ipc_send(sd, log_message, strlen(log_message) + 1); } else { ipc_send(sd, "", 1); } free(msg); } static void ipc_accept(int sd, void *arg) { int client; socklen_t socklen = 0; (void)arg; client = accept(sd, NULL, &socklen); if (client < 0) return; ipc_read(client); close(client); } /** * ipc_init - Initialise an IPC server socket * @path: Path to UNIX domain socket * * Returns: * The socket descriptor, or -1 on error with @errno set. */ int ipc_init(char *path) { socklen_t len; int sd; if (strlen(RUNSTATEDIR) + strlen(ident) + 11 >= sizeof(sun.sun_path)) { smclog(LOG_ERR, "Too long socket path, max %zd chars", sizeof(sun.sun_path)); return -1; } sd = socket_create(AF_UNIX, SOCK_STREAM, 0, ipc_accept, NULL); if (sd < 0) { smclog(LOG_WARNING, "Failed creating IPC socket, client disabled: %s", strerror(errno)); return -1; } #ifdef HAVE_SOCKADDR_UN_SUN_LEN sun.sun_len = 0; /* <- correct length is set by the OS */ #endif sun.sun_family = AF_UNIX; strlcpy(sun.sun_path, path, sizeof(sun.sun_path)); unlink(sun.sun_path); smclog(LOG_DEBUG, "Binding IPC socket to %s", sun.sun_path); len = offsetof(struct sockaddr_un, sun_path) + strlen(sun.sun_path); if (bind(sd, (struct sockaddr *)&sun, len) < 0 || listen(sd, 1)) { smclog(LOG_WARNING, "Failed binding IPC socket, client disabled: %s", strerror(errno)); socket_close(sd); return -1; } ipc_socket = sd; return sd; } /** * ipc_exit - Tear down and cleanup IPC communication. */ void ipc_exit(void) { if (ipc_socket >= 0) socket_close(ipc_socket); unlink(sun.sun_path); } /** * ipc_send - Send message to peer * @sd: Client socket from ipc_accept() * @buf: Message to send * @len: Message length in bytes of @buf * * Sends the IPC message in @buf of the size @len to the peer. * * Returns: * Number of bytes successfully sent, or -1 with @errno on failure. */ int ipc_send(int sd, char *buf, size_t len) { if (write(sd, buf, len) != (ssize_t)len) return -1; return len; } /** * ipc_server_read - Read IPC message from client * @sd: Client socket from ipc_accept() * @buf: Buffer for message * @len: Size of @buf in bytes * * Reads a message from the IPC socket and stores in @buf, respecting * the size @len. Connects and resets connection as necessary. * * Returns: * Pointer to a successfuly read command packet in @buf, or %NULL on error. */ void *ipc_receive(int sd, char *buf, size_t len) { size_t sz; sz = recv(sd, buf, len - 1, 0); if (!sz) { errno = ECONNRESET; return NULL; } /* successful read */ if (sz >= sizeof(struct ipc_msg)) { struct ipc_msg *msg = (struct ipc_msg *)buf; /* Make sure to always have at least one NUL, for strlen() */ buf[sz] = 0; if (sz == msg->len) { char *ptr; size_t i, count; /* Upper bound: smcroutectl add in1 source group out1 out2 .. out32 */ count = msg->count; if (count > (MAXVIFS + 3)) { errno = EINVAL; return NULL; } msg = malloc(sizeof(struct ipc_msg) + msg->count * sizeof(char *)); if (!msg) return NULL; memcpy(msg, buf, sizeof(struct ipc_msg)); ptr = buf + offsetof(struct ipc_msg, argv); for (i = 0; i < count; i++) { /* Verify ptr, attacker may set too large msg->count */ if (ptr >= (buf + len)) { free(msg); errno = EBADMSG; return NULL; } msg->argv[i] = ptr; ptr += strlen(ptr) + 1; } msg->count = count; return msg; } } errno = EAGAIN; return NULL; } /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/inet.h0000644000175100001710000000531714146403320012204 00000000000000/* Housekeeping IPv4/IPv6 wrapper functions * * Copyright (C) 2017-2021 Joachim Wiberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef SMCROUTE_INET_H_ #define SMCROUTE_INET_H_ #include "config.h" #include #include #include #include /* inet_ntop() */ #include #include #ifdef HAVE_IPV6_MULTICAST_HOST #define INET_ADDRSTR_LEN INET6_ADDRSTRLEN #else #define INET_ADDRSTR_LEN INET_ADDRSTRLEN #endif typedef struct sockaddr_storage inet_addr_t; #ifndef s6_addr32 # if defined(__FreeBSD__) # define s6_addr32 __u6_addr.__u6_addr32 # elif defined(__linux__) # define s6_addr32 __in6_u.__u6_addr32 # else # error "IPv6 s6_addr32 is not defined, unknown operating system, build --without-ipv6" # endif #endif struct inet_iter { inet_addr_t orig; int len; inet_addr_t addr; uint32_t num; }; void inet_addr_set (inet_addr_t *addr, const struct in_addr *ina); struct in_addr *inet_addr_get (inet_addr_t *addr); #ifdef HAVE_IPV6_MULTICAST_HOST void inet_addr6_set (inet_addr_t *addr, const struct in6_addr *ina); struct sockaddr_in6 *inet_addr6_get (inet_addr_t *addr); #endif void inet_anyaddr (sa_family_t family, inet_addr_t *addr); inet_addr_t inet_netaddr (inet_addr_t *addr, int len); int inet_addr_cmp (inet_addr_t *a, inet_addr_t *b); const char *inet_addr2str (inet_addr_t *addr, char *str, size_t len); int inet_str2addr (const char *str, inet_addr_t *addr); int is_multicast (inet_addr_t *addr); int is_anyaddr (inet_addr_t *addr); int inet_iter_init (struct inet_iter *iter, inet_addr_t *addr, int len); int inet_iterator (struct inet_iter *iter, inet_addr_t *addr); static inline int inet_max_len (inet_addr_t *addr) { #ifdef HAVE_IPV6_MULTICAST_HOST if (addr->ss_family == AF_INET6) return 128; #endif return 32; } #endif /* SMCROUTE_INET_H_ */ smcroute-2.5.5/src/Makefile.in0000644000175100001710000016611114146403357013153 00000000000000# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : sbin_PROGRAMS = smcrouted$(EXEEXT) smcroutectl$(EXEEXT) @USE_LIBCAP_TRUE@am__append_1 = cap.c cap.h @USE_LIBCAP_TRUE@am__append_2 = -lcap @HAVE_LIBSYSTEMD_TRUE@am__append_3 = systemd.c @HAVE_LIBSYSTEMD_TRUE@am__append_4 = $(libsystemd_CFLAGS) @HAVE_LIBSYSTEMD_TRUE@am__append_5 = $(libsystemd_LIBS) @USE_MRDISC_TRUE@am__append_6 = mrdisc.c mrdisc.h subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/misc.m4 \ $(top_srcdir)/m4/mroute.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(sbindir)" PROGRAMS = $(sbin_PROGRAMS) am_smcroutectl_OBJECTS = smcroutectl-smcroutectl.$(OBJEXT) smcroutectl_OBJECTS = $(am_smcroutectl_OBJECTS) am__DEPENDENCIES_1 = LIBOBJDIR = ../lib/ am__dirstamp = $(am__leading_dot)dirstamp smcroutectl_DEPENDENCIES = $(am__DEPENDENCIES_1) $(LIBOBJS) smcroutectl_LINK = $(CCLD) $(smcroutectl_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ am__smcrouted_SOURCES_DIST = smcrouted.c conf.c conf.h mroute.c \ mroute.h iface.c iface.h inet.c inet.h ipc.c ipc.h kern.c \ kern.h log.c log.h mcgroup.c mcgroup.h msg.c msg.h notify.c \ notify.h pidfile.c queue.h script.c script.h socket.c socket.h \ timer.c timer.h util.h cap.c cap.h systemd.c mrdisc.c mrdisc.h @USE_LIBCAP_TRUE@am__objects_1 = smcrouted-cap.$(OBJEXT) @HAVE_LIBSYSTEMD_TRUE@am__objects_2 = smcrouted-systemd.$(OBJEXT) @USE_MRDISC_TRUE@am__objects_3 = smcrouted-mrdisc.$(OBJEXT) am_smcrouted_OBJECTS = smcrouted-smcrouted.$(OBJEXT) \ smcrouted-conf.$(OBJEXT) smcrouted-mroute.$(OBJEXT) \ smcrouted-iface.$(OBJEXT) smcrouted-inet.$(OBJEXT) \ smcrouted-ipc.$(OBJEXT) smcrouted-kern.$(OBJEXT) \ smcrouted-log.$(OBJEXT) smcrouted-mcgroup.$(OBJEXT) \ smcrouted-msg.$(OBJEXT) smcrouted-notify.$(OBJEXT) \ smcrouted-pidfile.$(OBJEXT) smcrouted-script.$(OBJEXT) \ smcrouted-socket.$(OBJEXT) smcrouted-timer.$(OBJEXT) \ $(am__objects_1) $(am__objects_2) $(am__objects_3) smcrouted_OBJECTS = $(am_smcrouted_OBJECTS) @HAVE_LIBSYSTEMD_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) smcrouted_DEPENDENCIES = $(am__DEPENDENCIES_1) $(LIBOBJS) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) smcrouted_LINK = $(CCLD) $(smcrouted_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/aux/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ../lib/$(DEPDIR)/strlcat.Po \ ../lib/$(DEPDIR)/strlcpy.Po ../lib/$(DEPDIR)/tempfile.Po \ ../lib/$(DEPDIR)/utimensat.Po \ ./$(DEPDIR)/smcroutectl-smcroutectl.Po \ ./$(DEPDIR)/smcrouted-cap.Po ./$(DEPDIR)/smcrouted-conf.Po \ ./$(DEPDIR)/smcrouted-iface.Po ./$(DEPDIR)/smcrouted-inet.Po \ ./$(DEPDIR)/smcrouted-ipc.Po ./$(DEPDIR)/smcrouted-kern.Po \ ./$(DEPDIR)/smcrouted-log.Po ./$(DEPDIR)/smcrouted-mcgroup.Po \ ./$(DEPDIR)/smcrouted-mrdisc.Po \ ./$(DEPDIR)/smcrouted-mroute.Po ./$(DEPDIR)/smcrouted-msg.Po \ ./$(DEPDIR)/smcrouted-notify.Po \ ./$(DEPDIR)/smcrouted-pidfile.Po \ ./$(DEPDIR)/smcrouted-script.Po \ ./$(DEPDIR)/smcrouted-smcrouted.Po \ ./$(DEPDIR)/smcrouted-socket.Po \ ./$(DEPDIR)/smcrouted-systemd.Po \ ./$(DEPDIR)/smcrouted-timer.Po am__mv = mv -f AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(smcroutectl_SOURCES) $(smcrouted_SOURCES) DIST_SOURCES = $(smcroutectl_SOURCES) $(am__smcrouted_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/aux/depcomp \ $(top_srcdir)/lib/strlcat.c $(top_srcdir)/lib/strlcpy.c \ $(top_srcdir)/lib/tempfile.c $(top_srcdir)/lib/utimensat.c DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAEMON_TYPE = @DAEMON_TYPE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DOCDIR = @DOCDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PTHREAD = @LIB_PTHREAD@ LIB_RT = @LIB_RT@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ SBINDIR = @SBINDIR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libsystemd_CFLAGS = @libsystemd_CFLAGS@ libsystemd_LIBS = @libsystemd_LIBS@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ systemddir = @systemddir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = subdir-objects smcrouted_SOURCES = smcrouted.c conf.c conf.h mroute.c mroute.h \ iface.c iface.h inet.c inet.h ipc.c ipc.h kern.c kern.h log.c \ log.h mcgroup.c mcgroup.h msg.c msg.h notify.c notify.h \ pidfile.c queue.h script.c script.h socket.c socket.h timer.c \ timer.h util.h $(am__append_1) $(am__append_3) $(am__append_6) smcrouted_CFLAGS = -W -Wall -Wextra -Wno-deprecated-declarations \ -std=gnu99 $(am__append_4) smcrouted_CPPFLAGS = -D_ATFILE_SOURCE -D_INCOMPLETE_XOPEN_C063 \ -DSYSCONFDIR=\"@sysconfdir@\" -DRUNSTATEDIR=\"@runstatedir@\" smcrouted_LDADD = $(LIBS) $(LIBOBJS) @LIB_RT@ @LIB_PTHREAD@ \ $(am__append_2) $(am__append_5) smcroutectl_SOURCES = smcroutectl.c msg.h util.h smcroutectl_CFLAGS = -W -Wall -Wextra -std=gnu99 smcroutectl_CPPFLAGS = -DRUNSTATEDIR=\"@runstatedir@\" smcroutectl_LDADD = $(LIBS) $(LIBOBJS) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ } \ ; done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(sbindir)" && rm -f $$files clean-sbinPROGRAMS: -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) ../lib/$(am__dirstamp): @$(MKDIR_P) ../lib/ @: > ../lib/$(am__dirstamp) ../lib/strlcpy.$(OBJEXT): ../lib/$(am__dirstamp) ../lib/utimensat.$(OBJEXT): ../lib/$(am__dirstamp) ../lib/strlcat.$(OBJEXT): ../lib/$(am__dirstamp) ../lib/tempfile.$(OBJEXT): ../lib/$(am__dirstamp) smcroutectl$(EXEEXT): $(smcroutectl_OBJECTS) $(smcroutectl_DEPENDENCIES) $(EXTRA_smcroutectl_DEPENDENCIES) @rm -f smcroutectl$(EXEEXT) $(AM_V_CCLD)$(smcroutectl_LINK) $(smcroutectl_OBJECTS) $(smcroutectl_LDADD) $(LIBS) smcrouted$(EXEEXT): $(smcrouted_OBJECTS) $(smcrouted_DEPENDENCIES) $(EXTRA_smcrouted_DEPENDENCIES) @rm -f smcrouted$(EXEEXT) $(AM_V_CCLD)$(smcrouted_LINK) $(smcrouted_OBJECTS) $(smcrouted_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@../lib/$(DEPDIR)/strlcat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@../lib/$(DEPDIR)/strlcpy.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@../lib/$(DEPDIR)/tempfile.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@../lib/$(DEPDIR)/utimensat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smcroutectl-smcroutectl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smcrouted-cap.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smcrouted-conf.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smcrouted-iface.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smcrouted-inet.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smcrouted-ipc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smcrouted-kern.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smcrouted-log.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smcrouted-mcgroup.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smcrouted-mrdisc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smcrouted-mroute.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smcrouted-msg.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smcrouted-notify.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smcrouted-pidfile.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smcrouted-script.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smcrouted-smcrouted.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smcrouted-socket.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smcrouted-systemd.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smcrouted-timer.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` smcroutectl-smcroutectl.o: smcroutectl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcroutectl_CPPFLAGS) $(CPPFLAGS) $(smcroutectl_CFLAGS) $(CFLAGS) -MT smcroutectl-smcroutectl.o -MD -MP -MF $(DEPDIR)/smcroutectl-smcroutectl.Tpo -c -o smcroutectl-smcroutectl.o `test -f 'smcroutectl.c' || echo '$(srcdir)/'`smcroutectl.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcroutectl-smcroutectl.Tpo $(DEPDIR)/smcroutectl-smcroutectl.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='smcroutectl.c' object='smcroutectl-smcroutectl.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcroutectl_CPPFLAGS) $(CPPFLAGS) $(smcroutectl_CFLAGS) $(CFLAGS) -c -o smcroutectl-smcroutectl.o `test -f 'smcroutectl.c' || echo '$(srcdir)/'`smcroutectl.c smcroutectl-smcroutectl.obj: smcroutectl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcroutectl_CPPFLAGS) $(CPPFLAGS) $(smcroutectl_CFLAGS) $(CFLAGS) -MT smcroutectl-smcroutectl.obj -MD -MP -MF $(DEPDIR)/smcroutectl-smcroutectl.Tpo -c -o smcroutectl-smcroutectl.obj `if test -f 'smcroutectl.c'; then $(CYGPATH_W) 'smcroutectl.c'; else $(CYGPATH_W) '$(srcdir)/smcroutectl.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcroutectl-smcroutectl.Tpo $(DEPDIR)/smcroutectl-smcroutectl.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='smcroutectl.c' object='smcroutectl-smcroutectl.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcroutectl_CPPFLAGS) $(CPPFLAGS) $(smcroutectl_CFLAGS) $(CFLAGS) -c -o smcroutectl-smcroutectl.obj `if test -f 'smcroutectl.c'; then $(CYGPATH_W) 'smcroutectl.c'; else $(CYGPATH_W) '$(srcdir)/smcroutectl.c'; fi` smcrouted-smcrouted.o: smcrouted.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-smcrouted.o -MD -MP -MF $(DEPDIR)/smcrouted-smcrouted.Tpo -c -o smcrouted-smcrouted.o `test -f 'smcrouted.c' || echo '$(srcdir)/'`smcrouted.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-smcrouted.Tpo $(DEPDIR)/smcrouted-smcrouted.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='smcrouted.c' object='smcrouted-smcrouted.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-smcrouted.o `test -f 'smcrouted.c' || echo '$(srcdir)/'`smcrouted.c smcrouted-smcrouted.obj: smcrouted.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-smcrouted.obj -MD -MP -MF $(DEPDIR)/smcrouted-smcrouted.Tpo -c -o smcrouted-smcrouted.obj `if test -f 'smcrouted.c'; then $(CYGPATH_W) 'smcrouted.c'; else $(CYGPATH_W) '$(srcdir)/smcrouted.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-smcrouted.Tpo $(DEPDIR)/smcrouted-smcrouted.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='smcrouted.c' object='smcrouted-smcrouted.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-smcrouted.obj `if test -f 'smcrouted.c'; then $(CYGPATH_W) 'smcrouted.c'; else $(CYGPATH_W) '$(srcdir)/smcrouted.c'; fi` smcrouted-conf.o: conf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-conf.o -MD -MP -MF $(DEPDIR)/smcrouted-conf.Tpo -c -o smcrouted-conf.o `test -f 'conf.c' || echo '$(srcdir)/'`conf.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-conf.Tpo $(DEPDIR)/smcrouted-conf.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='conf.c' object='smcrouted-conf.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-conf.o `test -f 'conf.c' || echo '$(srcdir)/'`conf.c smcrouted-conf.obj: conf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-conf.obj -MD -MP -MF $(DEPDIR)/smcrouted-conf.Tpo -c -o smcrouted-conf.obj `if test -f 'conf.c'; then $(CYGPATH_W) 'conf.c'; else $(CYGPATH_W) '$(srcdir)/conf.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-conf.Tpo $(DEPDIR)/smcrouted-conf.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='conf.c' object='smcrouted-conf.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-conf.obj `if test -f 'conf.c'; then $(CYGPATH_W) 'conf.c'; else $(CYGPATH_W) '$(srcdir)/conf.c'; fi` smcrouted-mroute.o: mroute.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-mroute.o -MD -MP -MF $(DEPDIR)/smcrouted-mroute.Tpo -c -o smcrouted-mroute.o `test -f 'mroute.c' || echo '$(srcdir)/'`mroute.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-mroute.Tpo $(DEPDIR)/smcrouted-mroute.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mroute.c' object='smcrouted-mroute.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-mroute.o `test -f 'mroute.c' || echo '$(srcdir)/'`mroute.c smcrouted-mroute.obj: mroute.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-mroute.obj -MD -MP -MF $(DEPDIR)/smcrouted-mroute.Tpo -c -o smcrouted-mroute.obj `if test -f 'mroute.c'; then $(CYGPATH_W) 'mroute.c'; else $(CYGPATH_W) '$(srcdir)/mroute.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-mroute.Tpo $(DEPDIR)/smcrouted-mroute.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mroute.c' object='smcrouted-mroute.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-mroute.obj `if test -f 'mroute.c'; then $(CYGPATH_W) 'mroute.c'; else $(CYGPATH_W) '$(srcdir)/mroute.c'; fi` smcrouted-iface.o: iface.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-iface.o -MD -MP -MF $(DEPDIR)/smcrouted-iface.Tpo -c -o smcrouted-iface.o `test -f 'iface.c' || echo '$(srcdir)/'`iface.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-iface.Tpo $(DEPDIR)/smcrouted-iface.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='iface.c' object='smcrouted-iface.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-iface.o `test -f 'iface.c' || echo '$(srcdir)/'`iface.c smcrouted-iface.obj: iface.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-iface.obj -MD -MP -MF $(DEPDIR)/smcrouted-iface.Tpo -c -o smcrouted-iface.obj `if test -f 'iface.c'; then $(CYGPATH_W) 'iface.c'; else $(CYGPATH_W) '$(srcdir)/iface.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-iface.Tpo $(DEPDIR)/smcrouted-iface.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='iface.c' object='smcrouted-iface.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-iface.obj `if test -f 'iface.c'; then $(CYGPATH_W) 'iface.c'; else $(CYGPATH_W) '$(srcdir)/iface.c'; fi` smcrouted-inet.o: inet.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-inet.o -MD -MP -MF $(DEPDIR)/smcrouted-inet.Tpo -c -o smcrouted-inet.o `test -f 'inet.c' || echo '$(srcdir)/'`inet.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-inet.Tpo $(DEPDIR)/smcrouted-inet.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='inet.c' object='smcrouted-inet.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-inet.o `test -f 'inet.c' || echo '$(srcdir)/'`inet.c smcrouted-inet.obj: inet.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-inet.obj -MD -MP -MF $(DEPDIR)/smcrouted-inet.Tpo -c -o smcrouted-inet.obj `if test -f 'inet.c'; then $(CYGPATH_W) 'inet.c'; else $(CYGPATH_W) '$(srcdir)/inet.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-inet.Tpo $(DEPDIR)/smcrouted-inet.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='inet.c' object='smcrouted-inet.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-inet.obj `if test -f 'inet.c'; then $(CYGPATH_W) 'inet.c'; else $(CYGPATH_W) '$(srcdir)/inet.c'; fi` smcrouted-ipc.o: ipc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-ipc.o -MD -MP -MF $(DEPDIR)/smcrouted-ipc.Tpo -c -o smcrouted-ipc.o `test -f 'ipc.c' || echo '$(srcdir)/'`ipc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-ipc.Tpo $(DEPDIR)/smcrouted-ipc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ipc.c' object='smcrouted-ipc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-ipc.o `test -f 'ipc.c' || echo '$(srcdir)/'`ipc.c smcrouted-ipc.obj: ipc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-ipc.obj -MD -MP -MF $(DEPDIR)/smcrouted-ipc.Tpo -c -o smcrouted-ipc.obj `if test -f 'ipc.c'; then $(CYGPATH_W) 'ipc.c'; else $(CYGPATH_W) '$(srcdir)/ipc.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-ipc.Tpo $(DEPDIR)/smcrouted-ipc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ipc.c' object='smcrouted-ipc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-ipc.obj `if test -f 'ipc.c'; then $(CYGPATH_W) 'ipc.c'; else $(CYGPATH_W) '$(srcdir)/ipc.c'; fi` smcrouted-kern.o: kern.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-kern.o -MD -MP -MF $(DEPDIR)/smcrouted-kern.Tpo -c -o smcrouted-kern.o `test -f 'kern.c' || echo '$(srcdir)/'`kern.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-kern.Tpo $(DEPDIR)/smcrouted-kern.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='kern.c' object='smcrouted-kern.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-kern.o `test -f 'kern.c' || echo '$(srcdir)/'`kern.c smcrouted-kern.obj: kern.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-kern.obj -MD -MP -MF $(DEPDIR)/smcrouted-kern.Tpo -c -o smcrouted-kern.obj `if test -f 'kern.c'; then $(CYGPATH_W) 'kern.c'; else $(CYGPATH_W) '$(srcdir)/kern.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-kern.Tpo $(DEPDIR)/smcrouted-kern.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='kern.c' object='smcrouted-kern.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-kern.obj `if test -f 'kern.c'; then $(CYGPATH_W) 'kern.c'; else $(CYGPATH_W) '$(srcdir)/kern.c'; fi` smcrouted-log.o: log.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-log.o -MD -MP -MF $(DEPDIR)/smcrouted-log.Tpo -c -o smcrouted-log.o `test -f 'log.c' || echo '$(srcdir)/'`log.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-log.Tpo $(DEPDIR)/smcrouted-log.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='log.c' object='smcrouted-log.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-log.o `test -f 'log.c' || echo '$(srcdir)/'`log.c smcrouted-log.obj: log.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-log.obj -MD -MP -MF $(DEPDIR)/smcrouted-log.Tpo -c -o smcrouted-log.obj `if test -f 'log.c'; then $(CYGPATH_W) 'log.c'; else $(CYGPATH_W) '$(srcdir)/log.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-log.Tpo $(DEPDIR)/smcrouted-log.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='log.c' object='smcrouted-log.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-log.obj `if test -f 'log.c'; then $(CYGPATH_W) 'log.c'; else $(CYGPATH_W) '$(srcdir)/log.c'; fi` smcrouted-mcgroup.o: mcgroup.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-mcgroup.o -MD -MP -MF $(DEPDIR)/smcrouted-mcgroup.Tpo -c -o smcrouted-mcgroup.o `test -f 'mcgroup.c' || echo '$(srcdir)/'`mcgroup.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-mcgroup.Tpo $(DEPDIR)/smcrouted-mcgroup.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mcgroup.c' object='smcrouted-mcgroup.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-mcgroup.o `test -f 'mcgroup.c' || echo '$(srcdir)/'`mcgroup.c smcrouted-mcgroup.obj: mcgroup.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-mcgroup.obj -MD -MP -MF $(DEPDIR)/smcrouted-mcgroup.Tpo -c -o smcrouted-mcgroup.obj `if test -f 'mcgroup.c'; then $(CYGPATH_W) 'mcgroup.c'; else $(CYGPATH_W) '$(srcdir)/mcgroup.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-mcgroup.Tpo $(DEPDIR)/smcrouted-mcgroup.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mcgroup.c' object='smcrouted-mcgroup.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-mcgroup.obj `if test -f 'mcgroup.c'; then $(CYGPATH_W) 'mcgroup.c'; else $(CYGPATH_W) '$(srcdir)/mcgroup.c'; fi` smcrouted-msg.o: msg.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-msg.o -MD -MP -MF $(DEPDIR)/smcrouted-msg.Tpo -c -o smcrouted-msg.o `test -f 'msg.c' || echo '$(srcdir)/'`msg.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-msg.Tpo $(DEPDIR)/smcrouted-msg.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msg.c' object='smcrouted-msg.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-msg.o `test -f 'msg.c' || echo '$(srcdir)/'`msg.c smcrouted-msg.obj: msg.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-msg.obj -MD -MP -MF $(DEPDIR)/smcrouted-msg.Tpo -c -o smcrouted-msg.obj `if test -f 'msg.c'; then $(CYGPATH_W) 'msg.c'; else $(CYGPATH_W) '$(srcdir)/msg.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-msg.Tpo $(DEPDIR)/smcrouted-msg.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msg.c' object='smcrouted-msg.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-msg.obj `if test -f 'msg.c'; then $(CYGPATH_W) 'msg.c'; else $(CYGPATH_W) '$(srcdir)/msg.c'; fi` smcrouted-notify.o: notify.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-notify.o -MD -MP -MF $(DEPDIR)/smcrouted-notify.Tpo -c -o smcrouted-notify.o `test -f 'notify.c' || echo '$(srcdir)/'`notify.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-notify.Tpo $(DEPDIR)/smcrouted-notify.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='notify.c' object='smcrouted-notify.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-notify.o `test -f 'notify.c' || echo '$(srcdir)/'`notify.c smcrouted-notify.obj: notify.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-notify.obj -MD -MP -MF $(DEPDIR)/smcrouted-notify.Tpo -c -o smcrouted-notify.obj `if test -f 'notify.c'; then $(CYGPATH_W) 'notify.c'; else $(CYGPATH_W) '$(srcdir)/notify.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-notify.Tpo $(DEPDIR)/smcrouted-notify.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='notify.c' object='smcrouted-notify.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-notify.obj `if test -f 'notify.c'; then $(CYGPATH_W) 'notify.c'; else $(CYGPATH_W) '$(srcdir)/notify.c'; fi` smcrouted-pidfile.o: pidfile.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-pidfile.o -MD -MP -MF $(DEPDIR)/smcrouted-pidfile.Tpo -c -o smcrouted-pidfile.o `test -f 'pidfile.c' || echo '$(srcdir)/'`pidfile.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-pidfile.Tpo $(DEPDIR)/smcrouted-pidfile.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pidfile.c' object='smcrouted-pidfile.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-pidfile.o `test -f 'pidfile.c' || echo '$(srcdir)/'`pidfile.c smcrouted-pidfile.obj: pidfile.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-pidfile.obj -MD -MP -MF $(DEPDIR)/smcrouted-pidfile.Tpo -c -o smcrouted-pidfile.obj `if test -f 'pidfile.c'; then $(CYGPATH_W) 'pidfile.c'; else $(CYGPATH_W) '$(srcdir)/pidfile.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-pidfile.Tpo $(DEPDIR)/smcrouted-pidfile.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pidfile.c' object='smcrouted-pidfile.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-pidfile.obj `if test -f 'pidfile.c'; then $(CYGPATH_W) 'pidfile.c'; else $(CYGPATH_W) '$(srcdir)/pidfile.c'; fi` smcrouted-script.o: script.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-script.o -MD -MP -MF $(DEPDIR)/smcrouted-script.Tpo -c -o smcrouted-script.o `test -f 'script.c' || echo '$(srcdir)/'`script.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-script.Tpo $(DEPDIR)/smcrouted-script.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='script.c' object='smcrouted-script.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-script.o `test -f 'script.c' || echo '$(srcdir)/'`script.c smcrouted-script.obj: script.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-script.obj -MD -MP -MF $(DEPDIR)/smcrouted-script.Tpo -c -o smcrouted-script.obj `if test -f 'script.c'; then $(CYGPATH_W) 'script.c'; else $(CYGPATH_W) '$(srcdir)/script.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-script.Tpo $(DEPDIR)/smcrouted-script.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='script.c' object='smcrouted-script.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-script.obj `if test -f 'script.c'; then $(CYGPATH_W) 'script.c'; else $(CYGPATH_W) '$(srcdir)/script.c'; fi` smcrouted-socket.o: socket.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-socket.o -MD -MP -MF $(DEPDIR)/smcrouted-socket.Tpo -c -o smcrouted-socket.o `test -f 'socket.c' || echo '$(srcdir)/'`socket.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-socket.Tpo $(DEPDIR)/smcrouted-socket.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='socket.c' object='smcrouted-socket.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-socket.o `test -f 'socket.c' || echo '$(srcdir)/'`socket.c smcrouted-socket.obj: socket.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-socket.obj -MD -MP -MF $(DEPDIR)/smcrouted-socket.Tpo -c -o smcrouted-socket.obj `if test -f 'socket.c'; then $(CYGPATH_W) 'socket.c'; else $(CYGPATH_W) '$(srcdir)/socket.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-socket.Tpo $(DEPDIR)/smcrouted-socket.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='socket.c' object='smcrouted-socket.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-socket.obj `if test -f 'socket.c'; then $(CYGPATH_W) 'socket.c'; else $(CYGPATH_W) '$(srcdir)/socket.c'; fi` smcrouted-timer.o: timer.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-timer.o -MD -MP -MF $(DEPDIR)/smcrouted-timer.Tpo -c -o smcrouted-timer.o `test -f 'timer.c' || echo '$(srcdir)/'`timer.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-timer.Tpo $(DEPDIR)/smcrouted-timer.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='timer.c' object='smcrouted-timer.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-timer.o `test -f 'timer.c' || echo '$(srcdir)/'`timer.c smcrouted-timer.obj: timer.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-timer.obj -MD -MP -MF $(DEPDIR)/smcrouted-timer.Tpo -c -o smcrouted-timer.obj `if test -f 'timer.c'; then $(CYGPATH_W) 'timer.c'; else $(CYGPATH_W) '$(srcdir)/timer.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-timer.Tpo $(DEPDIR)/smcrouted-timer.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='timer.c' object='smcrouted-timer.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-timer.obj `if test -f 'timer.c'; then $(CYGPATH_W) 'timer.c'; else $(CYGPATH_W) '$(srcdir)/timer.c'; fi` smcrouted-cap.o: cap.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-cap.o -MD -MP -MF $(DEPDIR)/smcrouted-cap.Tpo -c -o smcrouted-cap.o `test -f 'cap.c' || echo '$(srcdir)/'`cap.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-cap.Tpo $(DEPDIR)/smcrouted-cap.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cap.c' object='smcrouted-cap.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-cap.o `test -f 'cap.c' || echo '$(srcdir)/'`cap.c smcrouted-cap.obj: cap.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-cap.obj -MD -MP -MF $(DEPDIR)/smcrouted-cap.Tpo -c -o smcrouted-cap.obj `if test -f 'cap.c'; then $(CYGPATH_W) 'cap.c'; else $(CYGPATH_W) '$(srcdir)/cap.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-cap.Tpo $(DEPDIR)/smcrouted-cap.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cap.c' object='smcrouted-cap.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-cap.obj `if test -f 'cap.c'; then $(CYGPATH_W) 'cap.c'; else $(CYGPATH_W) '$(srcdir)/cap.c'; fi` smcrouted-systemd.o: systemd.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-systemd.o -MD -MP -MF $(DEPDIR)/smcrouted-systemd.Tpo -c -o smcrouted-systemd.o `test -f 'systemd.c' || echo '$(srcdir)/'`systemd.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-systemd.Tpo $(DEPDIR)/smcrouted-systemd.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='systemd.c' object='smcrouted-systemd.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-systemd.o `test -f 'systemd.c' || echo '$(srcdir)/'`systemd.c smcrouted-systemd.obj: systemd.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-systemd.obj -MD -MP -MF $(DEPDIR)/smcrouted-systemd.Tpo -c -o smcrouted-systemd.obj `if test -f 'systemd.c'; then $(CYGPATH_W) 'systemd.c'; else $(CYGPATH_W) '$(srcdir)/systemd.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-systemd.Tpo $(DEPDIR)/smcrouted-systemd.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='systemd.c' object='smcrouted-systemd.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-systemd.obj `if test -f 'systemd.c'; then $(CYGPATH_W) 'systemd.c'; else $(CYGPATH_W) '$(srcdir)/systemd.c'; fi` smcrouted-mrdisc.o: mrdisc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-mrdisc.o -MD -MP -MF $(DEPDIR)/smcrouted-mrdisc.Tpo -c -o smcrouted-mrdisc.o `test -f 'mrdisc.c' || echo '$(srcdir)/'`mrdisc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-mrdisc.Tpo $(DEPDIR)/smcrouted-mrdisc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mrdisc.c' object='smcrouted-mrdisc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-mrdisc.o `test -f 'mrdisc.c' || echo '$(srcdir)/'`mrdisc.c smcrouted-mrdisc.obj: mrdisc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -MT smcrouted-mrdisc.obj -MD -MP -MF $(DEPDIR)/smcrouted-mrdisc.Tpo -c -o smcrouted-mrdisc.obj `if test -f 'mrdisc.c'; then $(CYGPATH_W) 'mrdisc.c'; else $(CYGPATH_W) '$(srcdir)/mrdisc.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smcrouted-mrdisc.Tpo $(DEPDIR)/smcrouted-mrdisc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mrdisc.c' object='smcrouted-mrdisc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(smcrouted_CPPFLAGS) $(CPPFLAGS) $(smcrouted_CFLAGS) $(CFLAGS) -c -o smcrouted-mrdisc.obj `if test -f 'mrdisc.c'; then $(CYGPATH_W) 'mrdisc.c'; else $(CYGPATH_W) '$(srcdir)/mrdisc.c'; fi` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(sbindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -rm -f ../lib/strlcat.$(OBJEXT) -rm -f ../lib/strlcpy.$(OBJEXT) -rm -f ../lib/tempfile.$(OBJEXT) -rm -f ../lib/utimensat.$(OBJEXT) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f ../lib/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am distclean: distclean-am -rm -f ../lib/$(DEPDIR)/strlcat.Po -rm -f ../lib/$(DEPDIR)/strlcpy.Po -rm -f ../lib/$(DEPDIR)/tempfile.Po -rm -f ../lib/$(DEPDIR)/utimensat.Po -rm -f ./$(DEPDIR)/smcroutectl-smcroutectl.Po -rm -f ./$(DEPDIR)/smcrouted-cap.Po -rm -f ./$(DEPDIR)/smcrouted-conf.Po -rm -f ./$(DEPDIR)/smcrouted-iface.Po -rm -f ./$(DEPDIR)/smcrouted-inet.Po -rm -f ./$(DEPDIR)/smcrouted-ipc.Po -rm -f ./$(DEPDIR)/smcrouted-kern.Po -rm -f ./$(DEPDIR)/smcrouted-log.Po -rm -f ./$(DEPDIR)/smcrouted-mcgroup.Po -rm -f ./$(DEPDIR)/smcrouted-mrdisc.Po -rm -f ./$(DEPDIR)/smcrouted-mroute.Po -rm -f ./$(DEPDIR)/smcrouted-msg.Po -rm -f ./$(DEPDIR)/smcrouted-notify.Po -rm -f ./$(DEPDIR)/smcrouted-pidfile.Po -rm -f ./$(DEPDIR)/smcrouted-script.Po -rm -f ./$(DEPDIR)/smcrouted-smcrouted.Po -rm -f ./$(DEPDIR)/smcrouted-socket.Po -rm -f ./$(DEPDIR)/smcrouted-systemd.Po -rm -f ./$(DEPDIR)/smcrouted-timer.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-sbinPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ../lib/$(DEPDIR)/strlcat.Po -rm -f ../lib/$(DEPDIR)/strlcpy.Po -rm -f ../lib/$(DEPDIR)/tempfile.Po -rm -f ../lib/$(DEPDIR)/utimensat.Po -rm -f ./$(DEPDIR)/smcroutectl-smcroutectl.Po -rm -f ./$(DEPDIR)/smcrouted-cap.Po -rm -f ./$(DEPDIR)/smcrouted-conf.Po -rm -f ./$(DEPDIR)/smcrouted-iface.Po -rm -f ./$(DEPDIR)/smcrouted-inet.Po -rm -f ./$(DEPDIR)/smcrouted-ipc.Po -rm -f ./$(DEPDIR)/smcrouted-kern.Po -rm -f ./$(DEPDIR)/smcrouted-log.Po -rm -f ./$(DEPDIR)/smcrouted-mcgroup.Po -rm -f ./$(DEPDIR)/smcrouted-mrdisc.Po -rm -f ./$(DEPDIR)/smcrouted-mroute.Po -rm -f ./$(DEPDIR)/smcrouted-msg.Po -rm -f ./$(DEPDIR)/smcrouted-notify.Po -rm -f ./$(DEPDIR)/smcrouted-pidfile.Po -rm -f ./$(DEPDIR)/smcrouted-script.Po -rm -f ./$(DEPDIR)/smcrouted-smcrouted.Po -rm -f ./$(DEPDIR)/smcrouted-socket.Po -rm -f ./$(DEPDIR)/smcrouted-systemd.Po -rm -f ./$(DEPDIR)/smcrouted-timer.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sbinPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-sbinPROGRAMS cscopelist-am ctags ctags-am \ distclean distclean-compile distclean-generic distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-sbinPROGRAMS install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-sbinPROGRAMS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: smcroute-2.5.5/src/util.h0000644000175100001710000000213514146403320012215 00000000000000/* Utilitity and replacement functions */ #ifndef SMCROUTE_UTIL_H_ #define SMCROUTE_UTIL_H_ #include "config.h" #include #include #include "mroute.h" #ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif #ifndef MAX #define MAX(a, b) ((a) < (b) ? (b) : (a)) #endif /* From The Practice of Programming, by Kernighan and Pike */ #ifndef NELEMS #define NELEMS(array) (sizeof(array) / sizeof(array[0])) #endif int pidfile_create(const char *basename, uid_t uid, gid_t gid); #ifndef HAVE_UTIMENSAT int utimensat(int dirfd, const char *pathname, const struct timespec ts[2], int flags); #endif #ifndef HAVE_STRLCPY size_t strlcpy(char *dst, const char *src, size_t len); #endif #ifndef HAVE_STRLCAT size_t strlcat(char *dst, const char *src, size_t dsize); #endif #ifndef HAVE_TEMPFILE FILE *tempfile(void); #endif int is_range(char *arg); inline static char *chomp(char *str) { char *p; if (!str || strlen(str) < 1) { errno = EINVAL; return NULL; } p = str + strlen(str) - 1; while (p >= str && *p == '\n') *p-- = 0; return str; } #endif /* SMCROUTE_UTIL_H_ */ smcroute-2.5.5/src/pidfile.c0000644000175100001710000000743014146403320012652 00000000000000/* Updated by troglobit for libite/finit/uftpd/smcroute projects 2016/07/04 */ /* $OpenBSD: pidfile.c,v 1.11 2015/06/03 02:24:36 millert Exp $ */ /* $NetBSD: pidfile.c,v 1.4 2001/02/19 22:43:42 cgd Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Jason R. Thorpe. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #include /* utimensat() */ #include /* utimensat() on *BSD */ #include #include #include #include #include #include "log.h" #include "util.h" static char *pidfile_path = NULL; static pid_t pidfile_pid = 0; const char *__pidfile_path = RUNSTATEDIR; const char *__pidfile_name = NULL; extern char *prognm; static void pidfile_cleanup(void) { if (pidfile_path != NULL && pidfile_pid == getpid()) { (void) unlink(pidfile_path); free(pidfile_path); pidfile_path = NULL; } } int pidfile_create(const char *basename, uid_t uid, gid_t gid) { int save_errno; int atexit_already; pid_t pid; FILE *f; if (basename == NULL) basename = prognm; pid = getpid(); atexit_already = 0; if (pidfile_path != NULL) { if (!access(pidfile_path, R_OK) && pid == pidfile_pid) { utimensat(0, pidfile_path, NULL, 0); return 0; } free(pidfile_path); pidfile_path = NULL; __pidfile_name = NULL; atexit_already = 1; } if (basename[0] != '/') { if (asprintf(&pidfile_path, "%s/%s.pid", __pidfile_path, basename) == -1) return -1; } else { if (asprintf(&pidfile_path, "%s", basename) == -1) return -1; } smclog(LOG_DEBUG, "Creating PID file %s", pidfile_path); if ((f = fopen(pidfile_path, "w")) == NULL) { save_errno = errno; free(pidfile_path); pidfile_path = NULL; errno = save_errno; return -1; } if (fprintf(f, "%ld\n", (long)pid) <= 0 || fflush(f) != 0) { save_errno = errno; (void) fclose(f); (void) unlink(pidfile_path); free(pidfile_path); pidfile_path = NULL; errno = save_errno; return -1; } (void) fclose(f); __pidfile_name = pidfile_path; if (chown(pidfile_path, uid, gid)) return -1; /* * LITE extension, no need to set up another atexit() handler * if user only called us to update the mtime of the PID file */ if (atexit_already) return 0; pidfile_pid = pid; if (atexit(pidfile_cleanup) < 0) { save_errno = errno; (void) unlink(pidfile_path); free(pidfile_path); pidfile_path = NULL; pidfile_pid = 0; errno = save_errno; return -1; } return 0; } smcroute-2.5.5/src/log.c0000644000175100001710000000433714146403320012022 00000000000000/* System logging API * * Copyright (C) 2011-2021 Joachim Wiberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #define SYSLOG_NAMES #include #include #include #include "log.h" #include "conf.h" #include "util.h" int log_level = LOG_NOTICE; char log_message[128]; /** * loglvl - Convert log level string to value * @level: String from user, debug, error, warning, etc. * * Returns: * Matching %LOG_DEBUG, %LOG_ERR, etc. */ int loglvl(const char *level) { int i; for (i = 0; prioritynames[i].c_name; i++) { size_t len = MIN(strlen(prioritynames[i].c_name), strlen(level)); if (!strncasecmp(prioritynames[i].c_name, level, len)) return prioritynames[i].c_val; } return atoi(level); } /** * smclog - Log message to syslog or stderr * @severity: Standard syslog() severity levels * @fmt: Standard printf() formatted message to log * * Logs a standard printf() formatted message to syslog and stderr when * @severity is greater than the @log_level threshold. When @code is * set it is appended to the log, along with the error message. * * When @severity is %LOG_ERR or worse this function will call exit(). */ void smclog(int severity, const char *fmt, ...) { va_list args; va_start(args, fmt); if (!conf_vrfy) { vsnprintf(log_message, sizeof(log_message), fmt, args); } else { if (severity <= log_level) { vprintf(fmt, args); puts(""); } } va_end(args); syslog(severity, "%s", log_message); } /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/script.h0000644000175100001710000000032014146403320012536 00000000000000/* SMCRoute script API */ #ifndef SMCROUTE_SCRIPT_H_ #define SMCROUTE_SCRIPT_H_ #include "mroute.h" int script_init (char *script); int script_exec (struct mroute *mroute); #endif /* SMCROUTE_SCRIPT_H_ */ smcroute-2.5.5/src/socket.c0000644000175100001710000001005314146403320012521 00000000000000/* Socket helper functions * * Copyright (C) 2017-2021 Joachim Wiberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "config.h" #include "queue.h" #include #ifdef HAVE_FCNTL_H #include #endif #include #include #include #include #include #include #include #include #include #include "log.h" struct sock { LIST_ENTRY(sock) link; int sd; void (*cb)(int, void *arg); void *arg; }; static int max_fdnum = -1; static LIST_HEAD(slist, sock) sock_list = LIST_HEAD_INITIALIZER(); int nfds(void) { return max_fdnum + 1; } /* * register socket/fd/pipe created elsewhere, optional callback */ int socket_register(int sd, void (*cb)(int, void *), void *arg) { struct sock *entry; entry = malloc(sizeof(*entry)); if (!entry) { smclog(LOG_ERR, "Failed allocating memory registering socket: %s", strerror(errno)); exit(EX_OSERR); } entry->sd = sd; entry->cb = cb; entry->arg = arg; LIST_INSERT_HEAD(&sock_list, entry, link); #if !defined(HAVE_SOCK_CLOEXEC) && defined(HAVE_FCNTL_H) fcntl(sd, F_SETFD, fcntl(sd, F_GETFD) | FD_CLOEXEC); #endif /* Keep track for select() */ if (sd > max_fdnum) max_fdnum = sd; return sd; } /* * create socket, with optional callback for reading inbound data */ int socket_create(int domain, int type, int proto, void (*cb)(int, void *), void *arg) { int val = 0; int sd; #ifdef HAVE_SOCK_CLOEXEC type |= SOCK_CLOEXEC; #endif sd = socket(domain, type, proto); if (sd < 0) return -1; if (domain == AF_UNIX) goto done; #ifdef HAVE_IPV6_MULTICAST_HOST if (domain == AF_INET6) { if (setsockopt(sd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &val, sizeof(val))) smclog(LOG_WARNING, "failed disabling IPV6_MULTICAST_LOOP: %s", strerror(errno)); #ifdef IPV6_MULTICAST_ALL if (setsockopt(sd, IPPROTO_IPV6, IPV6_MULTICAST_ALL, &val, sizeof(val))) smclog(LOG_WARNING, "failed disabling IPV6_MULTICAST_ALL: %s", strerror(errno)); #endif } else #endif /* HAVE_IPV6_MULTICAST_HOST */ { if (setsockopt(sd, IPPROTO_IP, IP_MULTICAST_LOOP, &val, sizeof(val))) smclog(LOG_WARNING, "failed disabling IP_MULTICAST_LOOP: %s", strerror(errno)); #ifdef IP_MULTICAST_ALL if (setsockopt(sd, IPPROTO_IP, IP_MULTICAST_ALL, &val, sizeof(val))) smclog(LOG_WARNING, "failed disabling IP_MULTICAST_ALL: %s", strerror(errno)); #endif } done: if (socket_register(sd, cb, arg) < 0) { close(sd); return -1; } return sd; } int socket_close(int sd) { struct sock *entry, *tmp; LIST_FOREACH_SAFE(entry, &sock_list, link, tmp) { if (entry->sd == sd) { LIST_REMOVE(entry, link); close(entry->sd); free(entry); return 0; } } errno = ENOENT; return -1; } int socket_poll(struct timeval *timeout) { int num; fd_set fds; struct sock *entry; FD_ZERO(&fds); LIST_FOREACH(entry, &sock_list, link) FD_SET(entry->sd, &fds); num = select(nfds(), &fds, NULL, NULL, timeout); if (num <= 0) { /* Log all errors, except when signalled, ignore failures. */ if (num < 0 && EINTR != errno) smclog(LOG_WARNING, "Failed select(): %s", strerror(errno)); return num; } LIST_FOREACH(entry, &sock_list, link) { if (!FD_ISSET(entry->sd, &fds)) continue; if (entry->cb) entry->cb(entry->sd, entry->arg); } return num; } /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/iface.h0000644000175100001710000000466414146403320012320 00000000000000/* Physical and virtual interface API */ #ifndef SMCROUTE_IFACE_H_ #define SMCROUTE_IFACE_H_ #include "config.h" #include #include /* IFNAMSIZ */ #include /* struct in_addr */ #include "mroute.h" /* vifit_t + mifi_t */ #ifndef ALL_MIFS #define ALL_MIFS (vifi_t)-1 #endif #define DEFAULT_THRESHOLD 1 /* Packet TTL must be at least 1 to pass */ #define NO_VIF ALL_VIFS struct iface { TAILQ_ENTRY(iface) link; int unused; /* set on reload/SIGHUP only */ char ifname[IFNAMSIZ]; struct in_addr inaddr; /* == 0 for non IP interfaces */ int ifindex; /* Physical interface index */ short flags; vifi_t vif; mifi_t mif; uint8_t mrdisc; /* Enable multicast router discovery */ uint8_t threshold; /* TTL threshold: 1-255, default: 1 */ }; struct ifmatch { struct iface *iface; size_t match_count; }; void iface_init (void); void iface_exit (void); void iface_update (void); struct iface *iface_iterator (int first); struct iface *iface_outbound_iterator (struct mroute *route, int first); struct iface *iface_find (int ifindex); struct iface *iface_find_by_name (const char *ifname); struct iface *iface_find_by_inbound (struct mroute *route); void iface_match_init (struct ifmatch *state); struct iface *iface_match_by_name (const char *ifname, int reload, struct ifmatch *state); int ifname_is_wildcard (const char *ifname); vifi_t iface_get_vif (int af_family, struct iface *iface); vifi_t iface_match_vif_by_name (const char *ifname, struct ifmatch *state, struct iface **found); mifi_t iface_match_mif_by_name (const char *ifname, struct ifmatch *state, struct iface **found); int iface_show (int sd, int detail); /* * Check if interface exists, at all, on the system */ static inline int iface_exist(char *ifname) { struct ifmatch ifm; iface_match_init(&ifm); return iface_match_by_name(ifname, 1, &ifm) != NULL; } static inline int iface_ifname_maxlen(void) { struct iface *iface; int maxlen = 0; int first = 1; while ((iface = iface_iterator(first))) { first = 0; if ((int)strlen(iface->ifname) > maxlen) maxlen = (int)strlen(iface->ifname); } return maxlen; } #endif /* SMCROUTE_IFACE_H_ */ /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/mcgroup.c0000644000175100001710000002742514146403320012720 00000000000000/* Multicast group management (join/leave) API * * Copyright (C) 2001-2005 Carsten Schill * Copyright (C) 2006-2009 Julien BLACHE * Copyright (C) 2009 Todd Hayton * Copyright (C) 2009-2011 Micha Lenk * Copyright (C) 2011-2021 Joachim Wiberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "config.h" #include "queue.h" #include #include #include #include #include #include #ifdef HAVE_LINUX_FILTER_H #include #endif #include #include "log.h" #include "ipc.h" #include "util.h" #include "iface.h" #include "socket.h" #include "mcgroup.h" #include "kern.h" /* * Track IGMP join, any-source and source specific */ static TAILQ_HEAD(kmcglist, mcgroup) kern_list = TAILQ_HEAD_INITIALIZER(kern_list); static TAILQ_HEAD(cmcglist, mcgroup) conf_list = TAILQ_HEAD_INITIALIZER(conf_list); #ifdef HAVE_LINUX_FILTER_H /* * Extremely simple "drop everything" filter for Linux so we do not get * a copy each packet of every routed group we join. */ static struct sock_filter filter[] = { { 0x6, 0, 0, 0x00000000 }, }; static struct sock_fprog fprog = { sizeof(filter) / sizeof(filter[0]), filter }; #endif /* HAVE_LINUX_FILTER_H */ /* * Linux net.ipv4.igmp_max_memberships defaults to 20, but empiricism * suggests we can only ever get 10 from each socket on Linux 5.11. * We therefore calibrate for the current system this using ENOBUFS. */ #define MAX_GROUPS 20 static int max_groups = MAX_GROUPS; struct mc_sock { TAILQ_ENTRY(mc_sock) link; int family; /* address family */ int sd; /* socket for join/leave ops */ int cnt; /* max 20 on linux */ }; TAILQ_HEAD(mcslist, mc_sock) mc_sock_list= TAILQ_HEAD_INITIALIZER(mc_sock_list); static int alloc_mc_sock(int family) { struct mc_sock *entry; TAILQ_FOREACH(entry, &mc_sock_list, link) { if (entry->cnt < max_groups && entry->family == family) break; } if (!entry) { entry = malloc(sizeof(struct mc_sock)); if (!entry) { smclog(LOG_ERR, "Out of memory in %s()", __func__); return -1; } entry->family = family; entry->cnt = 0; entry->sd = socket_create(family, SOCK_DGRAM, 0, NULL, NULL); if (entry->sd == -1) { smclog(LOG_ERR, "Failed creating mc socket: %s", strerror(errno)); free(entry); return -1; } #ifdef HAVE_LINUX_FILTER_H if (setsockopt(entry->sd, SOL_SOCKET, SO_ATTACH_FILTER, &fprog, sizeof(fprog)) < 0) smclog(LOG_WARNING, "failed setting IPv4 socket filter, continuing anyway"); #endif TAILQ_INSERT_TAIL(&mc_sock_list, entry, link); } entry->cnt++; smclog(LOG_DEBUG, "Group socket %d count %d of MAX %d", entry->sd, entry->cnt, max_groups); return entry->sd; } static void free_mc_sock(int sd) { struct mc_sock *entry, *tmp; TAILQ_FOREACH_SAFE(entry, &mc_sock_list, link, tmp) { if (entry->sd == sd) break; } if (entry) { if (--entry->cnt == 0) { TAILQ_REMOVE(&mc_sock_list, entry, link); socket_close(entry->sd); free(entry); } } } static struct iface *match_valid_iface(const char *ifname, struct ifmatch *state) { struct iface *iface = iface_match_by_name(ifname, 0, state); if (!iface && !state->match_count) smclog(LOG_DEBUG, "unknown interface %s", ifname); return iface; } static void list_add(int sd, struct mcgroup *mcg) { struct mcgroup *entry; entry = malloc(sizeof(*entry)); if (!entry) { smclog(LOG_ERR, "Failed adding mgroup to list: %s", strerror(errno)); return; } *entry = *mcg; entry->sd = sd; TAILQ_INSERT_TAIL(&kern_list, entry, link); } static void list_rem(int sd, struct mcgroup *mcg) { struct mcgroup *entry, *tmp; (void)sd; TAILQ_FOREACH_SAFE(entry, &kern_list, link, tmp) { if (entry->iface->ifindex != mcg->iface->ifindex) continue; if (inet_addr_cmp(&entry->source, &mcg->source) || inet_addr_cmp(&entry->group, &mcg->group)) continue; TAILQ_REMOVE(&kern_list, entry, link); free_mc_sock(entry->sd); free(entry); } } void mcgroup_init(void) { struct rlimit rlim; if (getrlimit(RLIMIT_NOFILE, &rlim)) { smclog(LOG_ERR, "Failed reading RLIMIT_NOFILE"); return; } smclog(LOG_DEBUG, "NOFILE: current %lu max %lu", rlim.rlim_cur, rlim.rlim_max); rlim.rlim_cur = rlim.rlim_max; if (setrlimit(RLIMIT_NOFILE, &rlim)) { smclog(LOG_ERR, "Failed setting RLIMIT_NOFILE soft limit to %lu: %s", rlim.rlim_max, strerror(errno)); return; } smclog(LOG_DEBUG, "NOFILE: set new current %ld max %ld", rlim.rlim_cur, rlim.rlim_max); } /* * Close IPv4/IPv6 multicast sockets to kernel to leave any joined groups */ void mcgroup_exit(void) { struct mcgroup *entry, *tmp; TAILQ_FOREACH_SAFE(entry, &conf_list, link, tmp) { TAILQ_REMOVE(&conf_list, entry, link); free(entry); } TAILQ_FOREACH_SAFE(entry, &kern_list, link, tmp) { TAILQ_REMOVE(&kern_list, entry, link); free_mc_sock(entry->sd); free(entry); } } static struct mcgroup *find_conf(const char *ifname, inet_addr_t *source, inet_addr_t *group, int len) { struct mcgroup *entry; TAILQ_FOREACH(entry, &conf_list, link) { if (strcmp(entry->ifname, ifname)) continue; if (inet_addr_cmp(&entry->source, source)) continue; if (inet_addr_cmp(&entry->group, group) || entry->len != len) continue; return entry; } return NULL; } static struct mcgroup *find_kern(struct mcgroup *mcg) { struct mcgroup *entry; TAILQ_FOREACH(entry, &kern_list, link) { if (strcmp(entry->ifname, mcg->ifname)) continue; if (inet_addr_cmp(&entry->source, &mcg->source)) continue; if (inet_addr_cmp(&entry->group, &mcg->group)) continue; return entry; } return NULL; } int mcgroup_action(int cmd, const char *ifname, inet_addr_t *source, int src_len, inet_addr_t *group, int len) { char src[INET_ADDRSTR_LEN] = "*", grp[INET_ADDRSTR_LEN]; struct mcgroup *mcg; struct ifmatch state; int rc = 0; int sd; if (!is_anyaddr(source)) inet_addr2str(source, src, sizeof(src)); inet_addr2str(group, grp, sizeof(grp)); mcg = find_conf(ifname, source, group, len); if (mcg) { if (cmd) { if (mcg->unused) { mcg->unused = 0; return 0; } smclog(LOG_INFO, "Already joined (%s,%s) on %s", src, grp, ifname); errno = EALREADY; return 1; } } else { if (!cmd) { smclog(LOG_INFO, "No group (%s,%s) on %s to leave", src, grp, ifname); errno = ENOENT; return 1; } mcg = calloc(1, sizeof(*mcg)); if (!mcg) { smclog(LOG_ERR, "Out of memory joining (%s,%s) on %s", src, grp, ifname); return 1; } strlcpy(mcg->ifname, ifname, sizeof(mcg->ifname)); mcg->source = *source; mcg->src_len = src_len; mcg->group = *group; mcg->len = len; TAILQ_INSERT_TAIL(&conf_list, mcg, link); } iface_match_init(&state); while ((mcg->iface = match_valid_iface(ifname, &state))) { struct inet_iter siter; inet_iter_init(&siter, &mcg->source, mcg->src_len); while (inet_iterator(&siter, &mcg->source)) { struct inet_iter giter; inet_iter_init(&giter, &mcg->group, mcg->len); while (inet_iterator(&giter, &mcg->group)) { if (!cmd) { struct mcgroup *kmcg; kmcg = find_kern(mcg); if (!kmcg) continue; sd = kmcg->sd; } else { retry: sd = alloc_mc_sock(group->ss_family); } if (sd == -1) { smclog(LOG_ERR, "Failed %s (%s,%s) on %s: %s", cmd ? "joining" : "leaving", src, grp, ifname, strerror(errno)); continue; } if (kern_join_leave(sd, cmd, mcg)) { if (cmd) { switch (errno) { case EADDRINUSE: /* Already joined, ignore */ continue; case ENOBUFS: smclog(LOG_WARNING, "Out of groups on socket " "adjusting max_groups %d.", max_groups); /* * Maxed out net.ipv4.igmp_max_msf * or net.ipv4.igmp_max_memberships * Linux only. */ max_groups--; goto retry; default: break; } } rc++; break; } if (cmd) list_add(sd, mcg); else list_rem(sd, mcg); } mcg->group = giter.orig; } mcg->source = siter.orig; } if (!cmd) { TAILQ_REMOVE(&kern_list, mcg, link); free_mc_sock(mcg->sd); free(mcg); } if (!state.match_count) return 1; return rc; } /* * Called on SIGHUP/reload. Mark all known configured groups as * 'unused', let mcgroup_action() unmark and mcgroup_reload_end() * take care to remove groups that still have the 'unused' flag. */ void mcgroup_reload_beg(void) { struct mcgroup *entry; TAILQ_FOREACH(entry, &conf_list, link) entry->unused = 1; } void mcgroup_reload_end(void) { struct mcgroup *entry, *tmp; struct iface *iface; int first = 1; while ((iface = iface_iterator(first))) { char dummy[IFNAMSIZ]; first = 0; if (iface->unused || !if_indextoname(iface->ifindex, dummy)) mcgroup_prune(iface->ifname); } TAILQ_FOREACH_SAFE(entry, &conf_list, link, tmp) { if (!entry->unused) continue; mcgroup_action(0, entry->ifname, &entry->source, entry->src_len, &entry->group, entry->len); } } /* * When an interface is removed from the system, or its flags are * changed to exclude the MULTICAST flag, we must prune groups. */ void mcgroup_prune(char *ifname) { struct mcgroup *entry, *tmp; TAILQ_FOREACH_SAFE(entry, &conf_list, link, tmp) { if (strcmp(entry->ifname, ifname)) continue; mcgroup_action(0, entry->ifname, &entry->source, entry->src_len, &entry->group, entry->len); } } static int show_mcgroup(int sd, struct mcgroup *entry) { int max_len = inet_max_len(&entry->group); char sg[INET_ADDRSTR_LEN * 2 + 10 + 3]; char src[INET_ADDRSTR_LEN] = "*"; char grp[INET_ADDRSTR_LEN]; char line[256]; if (!is_anyaddr(&entry->source)) inet_addr2str(&entry->source, src, sizeof(src)); inet_addr2str(&entry->group, grp, sizeof(grp)); snprintf(sg, sizeof(sg), "(%s", src); if (entry->src_len != max_len) snprintf(line, sizeof(line), "/%u, ", entry->src_len); else snprintf(line, sizeof(line), ", "); strlcat(sg, line, sizeof(sg)); if (entry->len != max_len) snprintf(line, sizeof(line), "%s/%u)", grp, entry->len); else snprintf(line, sizeof(line), "%s)", grp); strlcat(sg, line, sizeof(sg)); snprintf(line, sizeof(line), "%-42s %s\n", sg, entry->ifname); if (ipc_send(sd, line, strlen(line)) < 0) { smclog(LOG_ERR, "Failed sending reply to client: %s", strerror(errno)); return -1; } return 0; } /* Write all joined IGMP/MLD groups to client socket */ int mcgroup_show(int sd, int detail) { char *conf_str = "Group Memberships Table_\n"; char *kern_str = "Kernel Group Membership Table_\n"; struct mcgroup *entry; char line[256]; if (TAILQ_EMPTY(&conf_list)) return 0; ipc_send(sd, conf_str, strlen(conf_str)); snprintf(line, sizeof(line), "%-42s %-16s=\n", "GROUP (S,G)", "IIF"); ipc_send(sd, line, strlen(line)); TAILQ_FOREACH(entry, &conf_list, link) { if (show_mcgroup(sd, entry) < 0) return 1; } if (!detail) return 0; ipc_send(sd, kern_str, strlen(kern_str)); snprintf(line, sizeof(line), "%-42s %-16s=\n", "GROUP (S,G)", "IIF"); TAILQ_FOREACH(entry, &kern_list, link) { if (show_mcgroup(sd, entry) < 0) return 1; } return 0; } /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/iface.c0000644000175100001710000002567314146403320012316 00000000000000/* Physical and virtual interface API * * Copyright (C) 2001-2005 Carsten Schill * Copyright (C) 2006-2009 Julien BLACHE * Copyright (C) 2009 Todd Hayton * Copyright (C) 2009-2011 Micha Lenk * Copyright (C) 2011-2021 Joachim Wiberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "queue.h" #include #include #include #include #include #include #include #include #include #include #include #include "log.h" #include "ipc.h" #include "iface.h" #include "mcgroup.h" #include "timer.h" #include "util.h" static TAILQ_HEAD(iflist, iface) iface_list = TAILQ_HEAD_INITIALIZER(iface_list); extern int do_vifs; /** * iface_update - Check of new interfaces */ void iface_update(void) { struct ifaddrs *ifaddr, *ifa; if (getifaddrs(&ifaddr) == -1) { smclog(LOG_ERR, "Failed retrieving interface addresses: %s", strerror(errno)); exit(EX_OSERR); } for (ifa = ifaddr; ifa; ifa = ifa->ifa_next) { struct iface *iface; int ifindex; ifindex = if_nametoindex(ifa->ifa_name); /* Check if already added? */ iface = iface_find_by_name(ifa->ifa_name); if (iface) { smclog(LOG_DEBUG, "Found %s, updating ...", ifa->ifa_name); iface->flags = ifa->ifa_flags; if (ifindex != iface->ifindex || (iface->flags & IFF_MULTICAST) != IFF_MULTICAST) { mcgroup_prune(ifa->ifa_name); mroute_del_vif(ifa->ifa_name); } iface->ifindex = ifindex; if (!iface->inaddr.s_addr && ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET) iface->inaddr = ((struct sockaddr_in *)ifa->ifa_addr)->sin_addr; if (do_vifs) iface->unused = 0; continue; } smclog(LOG_DEBUG, "Found new interface %s, adding ...", ifa->ifa_name); iface = calloc(1, sizeof(struct iface)); if (!iface) { smclog(LOG_ERR, "Failed allocating space for interface: %s", strerror(errno)); exit(EX_OSERR); } /* * Only copy interface address if inteface has one. On * Linux we can enumerate VIFs using ifindex, useful for * DHCP interfaces w/o any address yet. Other UNIX * systems will fail on the MRT_ADD_VIF ioctl. if the * kernel cannot find a matching interface. */ if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET) iface->inaddr = ((struct sockaddr_in *)ifa->ifa_addr)->sin_addr; iface->flags = ifa->ifa_flags; strlcpy(iface->ifname, ifa->ifa_name, sizeof(iface->ifname)); iface->ifindex = if_nametoindex(iface->ifname); iface->vif = ALL_VIFS; iface->mif = ALL_MIFS; iface->mrdisc = 0; iface->threshold = DEFAULT_THRESHOLD; TAILQ_INSERT_TAIL(&iface_list, iface, link); } freeifaddrs(ifaddr); } /** * iface_init - Probe for interaces at startup * * Builds up a vector with active system interfaces. Must be called * before any other interface functions in this module! */ void iface_init(void) { iface_update(); } /** * iface_exit - Tear down interface list and clean up */ void iface_exit(void) { struct iface *iface, *tmp; TAILQ_FOREACH_SAFE(iface, &iface_list, link, tmp) { TAILQ_REMOVE(&iface_list, iface, link); free(iface); } } /** * iface_find - Find an interface by ifindex * @ifindex: Interface index * * Returns: * Pointer to a @struct iface of the matching interface, or %NULL if no * interface exists, or is up. If more than one interface exists, chose * the interface that corresponds to a virtual interface. */ struct iface *iface_find(int ifindex) { struct iface *iface; TAILQ_FOREACH(iface, &iface_list, link) { if (iface->ifindex == ifindex) return iface; } return NULL; } /** * iface_find_by_name - Find an interface by name * @ifname: Interface name * * Returns: * Pointer to a @struct iface of the matching interface, or %NULL if no * interface exists, or is up. If more than one interface exists, chose * the interface that corresponds to a virtual interface. */ struct iface *iface_find_by_name(const char *ifname) { struct iface *candidate = NULL; struct iface *iface; #ifdef __linux__ char *ptr; #endif char *nm; if (!ifname) return NULL; nm = strdup(ifname); if (!nm) return NULL; #ifdef __linux__ /* Linux alias interfaces should use the same VIF/MIF as parent */ ptr = strchr(nm, ':'); if (ptr) *ptr = 0; #endif TAILQ_FOREACH(iface, &iface_list, link) { if (!strcmp(nm, iface->ifname)) { if (iface->vif != NO_VIF) { free(nm); return iface; } candidate = iface; } } free(nm); return candidate; } static struct iface *find_by_vif(vifi_t vif) { struct iface *iface; TAILQ_FOREACH(iface, &iface_list, link) { if (iface->vif != NO_VIF && iface->vif == vif) return iface; } return NULL; } static struct iface *find_by_mif(mifi_t mif) { struct iface *iface; TAILQ_FOREACH(iface, &iface_list, link) { if (iface->mif != NO_VIF && iface->mif == mif) return iface; } return NULL; } /** * iface_find_by_inbound - Find iface by route's inbound VIF * @route: Route's inbound to use * * Returns: * Pointer to a @struct iface of the requested interface, or %NULL if no * interface matching @mif exists. */ struct iface *iface_find_by_inbound(struct mroute *route) { #ifdef HAVE_IPV6_MULTICAST_HOST if (route->group.ss_family == AF_INET6) return find_by_mif(route->inbound); #endif return find_by_vif(route->inbound); } /** * iface_match_init - Initialize interface matching iterator * @state: Iterator state to be initialized */ void iface_match_init(struct ifmatch *state) { state->iface = TAILQ_FIRST(&iface_list); state->match_count = 0; } /** * ifname_is_wildcard - Check whether interface name is a wildcard * * Returns: * %TRUE(1) if wildcard, %FALSE(0) if normal interface name */ int ifname_is_wildcard(const char *ifname) { return (ifname && ifname[0] && ifname[strlen(ifname) - 1] == '+'); } /** * iface_match_by_name - Find matching interfaces by name pattern * @ifname: Interface name pattern * @reload: Set while reloading .conf * @state: Iterator state * * Interface name patterns use iptables- syntax, i.e. perform prefix * match with a trailing '+' matching anything. * * Returns: * Pointer to a @struct iface of the next matching interface, or %NULL if no * (more) interfaces exist (or are up). */ struct iface *iface_match_by_name(const char *ifname, int reload, struct ifmatch *state) { unsigned int match_len = UINT_MAX; if (!ifname) return NULL; if (ifname_is_wildcard(ifname)) match_len = strlen(ifname) - 1; while (state->iface != TAILQ_END(&iface_list)) { struct iface *iface = state->iface; if (!strncmp(ifname, iface->ifname, match_len)) { if (reload || !iface->unused) { state->iface = TAILQ_NEXT(iface, link); state->match_count++; return iface; } } state->iface = TAILQ_NEXT(iface, link); } return NULL; } /** * iface_iterator - Interface iterator * @first: Set to start from beginning * * Returns: * Pointer to a @struct iface, or %NULL when no more interfaces exist. */ struct iface *iface_iterator(int first) { static struct iface *iface = NULL; if (first) iface = TAILQ_FIRST(&iface_list); else iface = TAILQ_NEXT(iface, link); return iface; } struct iface *iface_outbound_iterator(struct mroute *route, int first) { struct iface *iface = NULL; static vifi_t i = 0; if (first) i = 0; while (i < MAX_MC_VIFS) { vifi_t vif = i++; if (route->ttl[vif] == 0) continue; #ifdef HAVE_IPV6_MULTICAST_ROUTING if (route->group.ss_family == AF_INET6) iface = find_by_mif(vif); else #endif iface = find_by_vif(vif); if (!iface) continue; return iface; } return NULL; } vifi_t iface_get_vif(int af_family, struct iface *iface) { #ifdef HAVE_IPV6_MULTICAST_HOST if (af_family == AF_INET6) return iface->mif; #endif return iface->vif; } /** * iface_match_vif_by_name - Get matching virtual interface index by interface name pattern (IPv4) * @ifname: Interface name pattern * @state: Iterator state * * Returns: * The virtual interface index if the interface matches and is registered * with the kernel, or -1 if no (more) matching virtual interfaces are found. */ vifi_t iface_match_vif_by_name(const char *ifname, struct ifmatch *state, struct iface **found) { struct iface *iface; while ((iface = iface_match_by_name(ifname, 0, state))) { if (iface->vif != NO_VIF) { if (found) *found = iface; // smclog(LOG_DEBUG, " %s has VIF %d", iface->ifname, iface->vif); return iface->vif; } // smclog(LOG_DEBUG, " %s has NO VIF", iface->ifname); state->match_count--; } return NO_VIF; } /** * iface_match_mif_by_name - Get matching virtual interface index by interface name pattern (IPv6) * @ifname: Interface name pattern * @state: Iterator state * * Returns: * The virtual interface index if the interface matches and is registered * with the kernel, or -1 if no (more) matching virtual interfaces are found. */ mifi_t iface_match_mif_by_name(const char *ifname, struct ifmatch *state, struct iface **found) { struct iface *iface; while ((iface = iface_match_by_name(ifname, 0, state))) { if (iface->mif != NO_VIF) { if (found) *found = iface; smclog(LOG_DEBUG, " %s has MIF %d", iface->ifname, iface->mif); return iface->mif; } state->match_count--; } return NO_VIF; } /* Return all currently known interfaces */ int iface_show(int sd, int detail) { struct iface *iface; char *p = "PHYINT"; char line[120]; int inw; (void)detail; inw = iface_ifname_maxlen(); if (inw < (int)strlen(p)) inw = (int)strlen(p); snprintf(line, sizeof(line), " INDEX %-*s VIF MIF=\n", inw, p); ipc_send(sd, line, strlen(line)); iface = iface_iterator(1); while (iface) { char buf[256]; char vif[6]; char mif[6]; if (iface->vif < 65535) snprintf(vif, sizeof(vif), "%d", iface->vif); else snprintf(vif, sizeof(vif), "N/A"); if (iface->mif < 65535) snprintf(mif, sizeof(mif), "%d", iface->mif); else snprintf(mif, sizeof(mif), "N/A"); snprintf(buf, sizeof(buf), "%6d %-*s %4s %4s\n", iface->ifindex, inw, iface->ifname, vif, mif); if (ipc_send(sd, buf, strlen(buf)) < 0) { smclog(LOG_ERR, "Failed sending reply to client: %s", strerror(errno)); return -1; } iface = iface_iterator(0); } return 0; } /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/timer.c0000644000175100001710000001310014146403320012345 00000000000000/* Timer helper functions * * Copyright (C) 2017-2021 Joachim Wiberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "queue.h" #include #include #include /* memset() */ #include /* malloc() */ #include #include /* read()/write() */ #include #include "log.h" #include "socket.h" #include "timer.h" /* * TODO * - Timers should ideally be sorted in priority order, and/or * - Investigate using the pipe to notify which timer expired */ struct timer { LIST_ENTRY(timer) link; int active; /* Set to 0 to delete */ int period; /* period time in seconds */ struct timespec timeout; void (*cb)(void *arg); void *arg; }; static timer_t timer; static int timerfd[2]; static LIST_HEAD(tlist, timer) timer_list = LIST_HEAD_INITIALIZER(); static void set(struct timer *t, struct timespec *now) { t->timeout.tv_sec = now->tv_sec + t->period; t->timeout.tv_nsec = now->tv_nsec; } static int expired(struct timer *t, struct timespec *now) { long round_nsec; round_nsec = now->tv_nsec + 250000000; round_nsec = round_nsec > 999999999 ? 999999999 : round_nsec; if (t->timeout.tv_sec < now->tv_sec) return 1; if (t->timeout.tv_sec == now->tv_sec && t->timeout.tv_nsec <= round_nsec) return 1; return 0; } static struct timer *compare(struct timer *a, struct timer *b) { if (a->timeout.tv_sec <= b->timeout.tv_sec) { if (a->timeout.tv_sec == b->timeout.tv_sec) { if (a->timeout.tv_nsec <= b->timeout.tv_nsec) return a; return b; } return a; } return b; } static struct timer *find(void (*cb), void *arg) { struct timer *entry; LIST_FOREACH(entry, &timer_list, link) { if (entry->cb != cb || entry->arg != arg) continue; return entry; } return NULL; } static int start(struct timespec *now) { struct itimerspec it = { 0 }; struct timer *next, *entry; if (LIST_EMPTY(&timer_list)) return -1; next = LIST_FIRST(&timer_list); LIST_FOREACH(entry, &timer_list, link) next = compare(next, entry); it.it_value.tv_sec = next->timeout.tv_sec - now->tv_sec; it.it_value.tv_nsec = next->timeout.tv_nsec - now->tv_nsec; if (it.it_value.tv_nsec < 0) { it.it_value.tv_sec -= 1; it.it_value.tv_nsec = 1000000000 + it.it_value.tv_nsec; } if (it.it_value.tv_sec < 0) it.it_value.tv_sec = 0; if (timer_settime(timer, 0, &it, NULL)) smclog(LOG_ERR, "Failed starting %.1f sec period timer, errno %d: %s", difftime(next->timeout.tv_sec, now->tv_sec), errno, strerror(errno)); return 0; } /* callback for activity on pipe */ static void run(int sd, void *arg) { struct timer *entry, *tmp; struct timespec now; char dummy; (void)arg; if (read(sd, &dummy, 1) < 0) smclog(LOG_DEBUG, "Failed read(pipe): %s", strerror(errno)); clock_gettime(CLOCK_MONOTONIC, &now); LIST_FOREACH_SAFE(entry, &timer_list, link, tmp) { if (expired(entry, &now)) { if (entry->cb) entry->cb(entry->arg); set(entry, &now); } if (!entry->active) { LIST_REMOVE(entry, link); free(entry); } } start(&now); } /* write to pipe to create an event for select() on SIGALRM */ static void handler(int signo) { (void)signo; if (write(timerfd[1], "!", 1) < 0) smclog(LOG_DEBUG, "Failed write(pipe): %s", strerror(errno)); } /* * register signal pipe and callbacks */ int timer_init(void) { struct sigaction sa; if (pipe(timerfd)) { smclog(LOG_ERR, "Failed creating timer pipe(): %s", strerror(errno)); exit(EX_OSERR); } socket_register(timerfd[0], run, NULL); socket_register(timerfd[1], NULL, NULL); sa.sa_handler = handler; sa.sa_flags = 0; sigemptyset(&sa.sa_mask); sigaction(SIGALRM, &sa, NULL); if (timer_create(CLOCK_MONOTONIC, NULL, &timer)) { socket_close(timerfd[0]); socket_close(timerfd[1]); return -1; } return 0; } /* * cleanup and free for program exit */ void timer_exit(void) { struct timer *entry, *tmp; timer_delete(timer); socket_close(timerfd[0]); socket_close(timerfd[1]); LIST_FOREACH_SAFE(entry, &timer_list, link, tmp) { LIST_REMOVE(entry, link); free(entry); } } /* * create periodic timer (seconds) */ int timer_add(int period, void (*cb)(void *), void *arg) { struct timespec now; struct timer *t; t = find(cb, arg); if (t && t->active) { errno = EEXIST; return -1; } if (clock_gettime(CLOCK_MONOTONIC, &now) < 0) return -1; t = malloc(sizeof(*t)); if (!t) { smclog(LOG_ERR, "Out of memory in %s()", __func__); exit(EX_OSERR); } t->active = 1; t->period = period; t->cb = cb; t->arg = arg; set(t, &now); LIST_INSERT_HEAD(&timer_list, t, link); return start(&now); } /* * delete a timer */ int timer_del(void (*cb)(void *), void *arg) { struct timer *entry; entry = find(cb, arg); if (!entry) return 1; /* Mark for deletion and issue a new run */ entry->active = 0; handler(0); return 0; } /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/conf.h0000644000175100001710000000121214146403320012160 00000000000000#ifndef SMCROUTE_CONF_H_ #define SMCROUTE_CONF_H_ #include "config.h" #define EMPTY 0 #define MGROUP 1 #define MROUTE 2 #define PHYINT 3 #define INCLUDE 4 struct conf { const char *file; unsigned int lineno; }; extern int conf_vrfy; int conf_mgroup (struct conf *conf, int cmd, char *iif, char *source, char *group); int conf_mroute (struct conf *conf, int cmd, char *iif, char *source, char *group, char *oif[], int num); int conf_parse (struct conf *conf, int do_vifs); int conf_read (char *file, int do_vifs); #endif /* SMCROUTE_CONF_H_ */ /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/socket.h0000644000175100001710000000224614146403320012533 00000000000000/* Helper functions * * Copyright (C) 2017-2021 Joachim Wiberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef SMCROUTE_SOCKET_H_ #define SMCROUTE_SOCKET_H_ #include #include #include int socket_register(int sd, void (*cb)(int, void *), void *arg); int socket_create (int domain, int type, int proto, void (*cb)(int, void *), void *arg); int socket_close (int sd); int socket_poll (struct timeval *timeout); #endif /* SMCROUTE_SOCKET_H_ */ smcroute-2.5.5/src/log.h0000644000175100001710000000040314146403320012015 00000000000000/* System logging API */ #ifndef SMCROUTE_LOG_H_ #define SMCROUTE_LOG_H_ #include extern int log_level; extern char log_message[128]; int loglvl(const char *level); void smclog(int severity, const char *fmt, ...); #endif /* SMCROUTE_LOG_H_ */ smcroute-2.5.5/src/notify.h0000644000175100001710000000070614146403320012552 00000000000000/* Wrappers for different service monitors */ #ifndef SMCROUTE_NOTIFY_H_ #define SMCROUTE_NOTIFY_H_ #include "config.h" void notify_ready(char *pidfn, uid_t uid, gid_t gid); void notify_reload(void); #ifdef HAVE_LIBSYSTEMD void systemd_notify_ready(const char *status); void systemd_notify_reload(const char *status); #else #define systemd_notify_ready(status) #define systemd_notify_reload(status) #endif #endif /* SMCROUTE_NOTIFY_H_ */ smcroute-2.5.5/src/msg.c0000644000175100001710000000737714146403320012036 00000000000000/* IPC command parser and builder for daemon and client * * Copyright (C) 2011-2021 Joachim Wiberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "config.h" #include #include /* sig_atomic_t */ #include #include #include #include #include "conf.h" #include "log.h" #include "msg.h" #include "iface.h" #include "util.h" #include "mroute.h" #include "mcgroup.h" extern volatile sig_atomic_t running; extern volatile sig_atomic_t reloading; /* * Check for prefix length, only applicable for (*,G) routes */ int is_range(char *arg) { char *ptr; ptr = strchr(arg, '/'); if (ptr) { *ptr++ = 0; return atoi(ptr); } return 0; } static int do_mgroup(struct ipc_msg *msg) { char source[INET_ADDRSTR_LEN + 5] = { 0 }; char group[INET_ADDRSTR_LEN + 5] = { 0 }; char *ifname = msg->argv[0]; if (msg->count < 2) { errno = EINVAL; return -1; } if (msg->count == 3) { strlcpy(source, msg->argv[1], sizeof(source)); strlcpy(group, msg->argv[2], sizeof(group)); } else strlcpy(group, msg->argv[1], sizeof(group)); return conf_mgroup(NULL, msg->cmd == 'j' ? 1 : 0, ifname, source[0] ? source : NULL, group); } static int do_mroute(struct ipc_msg *msg) { char src[INET_ADDRSTR_LEN + 5]; char *ifname, *source, *group; char *out[MAX_MC_VIFS]; inet_addr_t ss; int num = 0; int pos = 0; if (msg->count < 2) { errno = EINVAL; return -1; } ifname = msg->argv[pos++]; strlcpy(src, msg->argv[pos++], sizeof(src)); is_range(src); if (inet_str2addr(src, &ss)) { smclog(LOG_ERR, "mroute: invalid source/group address: %s", src); return 1; } if (!is_multicast(&ss)) { char grp[INET_ADDRSTR_LEN + 5]; strlcpy(grp, msg->argv[pos++], sizeof(grp)); is_range(grp); if (inet_str2addr(grp, &ss) || !is_multicast(&ss)) { smclog(LOG_DEBUG, "mroute: invalid multicast group: %s", grp); return 1; } source = msg->argv[1]; group = msg->argv[2]; } else { source = NULL; group = msg->argv[1]; } while (pos < msg->count) out[num++] = msg->argv[pos++]; return conf_mroute(NULL, msg->cmd == 'a' ? 1 : 0, ifname, source, group, out, num); } static int do_show(struct ipc_msg *msg, int sd, int detail) { if (msg->count > 0) { char cmd = msg->argv[0][0]; switch (cmd) { case 'g': return mcgroup_show(sd, detail); case 'i': return iface_show(sd, detail); default: break; } } return mroute_show(sd, detail); } /* * Convert IPC command from client to a mulicast route or group join/leave */ int msg_do(int sd, struct ipc_msg *msg) { int result = 0; switch (msg->cmd) { case 'a': case 'r': result = do_mroute(msg); break; case 'j': case 'l': result = do_mgroup(msg); break; case 'F': mroute_expire(0); break; case 'H': /* HUP */ reloading = 1; break; case 'k': running = 0; break; case 'S': result = do_show(msg, sd, 1); break; case 's': result = do_show(msg, sd, 0); break; default: errno = EINVAL; result = -1; } return result; } /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/kern.c0000644000175100001710000003761114146403320012201 00000000000000/* Kernel API for join/leave multicast groups and add/del routes * * Copyright (C) 2011-2021 Joachim Wiberg * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "config.h" #include #ifdef HAVE_FCNTL_H #include #endif #include #include #include #include "iface.h" #include "kern.h" #include "log.h" #include "mrdisc.h" #include "socket.h" #include "util.h" /* * Raw IGMP socket used as interface for the IPv4 mrouted API. * Receives IGMP packets and upcall messages from the kernel. */ static int sd4 = -1; /* * Raw ICMPv6 socket used as interface for the IPv6 mrouted API. * Receives MLD packets and upcall messages from the kenrel. */ static int sd6 = -1; /* IPv4 internal virtual interfaces (VIF) descriptor vector */ static struct { struct iface *iface; } vif_list[MAX_MC_VIFS]; /* IPv6 internal virtual interfaces (VIF) descriptor vector */ static struct mif { struct iface *iface; } mif_list[MAX_MC_VIFS]; /* * This function handles both ASM and SSM join/leave for IPv4 and IPv6 * using the RFC 3678 API available on Linux, FreeBSD, and a few other * operating systems. * * On Linux this makes it possible to join a group on an interface that * is down and/or has no IP address assigned to it yet. The latter is * one of the most common causes of malfunction on Linux and IPv4 with * the old struct ip_mreq API. */ #ifdef HAVE_STRUCT_GROUP_REQ /* Prefer RFC 3678 */ static int group_req(int sd, int cmd, struct mcgroup *mcg) { char source[INET_ADDRSTR_LEN], group[INET_ADDRSTR_LEN]; struct group_source_req gsr = { 0 }; struct group_req gr = { 0 }; size_t len; void *arg; int op, proto; #ifdef HAVE_IPV6_MULTICAST_HOST if (mcg->group.ss_family == AF_INET6) proto = IPPROTO_IPV6; else #endif proto = IPPROTO_IP; if (is_anyaddr(&mcg->source)) { if (cmd) op = MCAST_JOIN_GROUP; else op = MCAST_LEAVE_GROUP; arg = &gr; len = sizeof(gr); gr.gr_interface = mcg->iface->ifindex; gr.gr_group = mcg->group; strncpy(source, "*", sizeof(source)); inet_addr2str(&gr.gr_group, group, sizeof(group)); } else { if (cmd) op = MCAST_JOIN_SOURCE_GROUP; else op = MCAST_LEAVE_SOURCE_GROUP; arg = &gsr; len = sizeof(gsr); gsr.gsr_interface = mcg->iface->ifindex; gsr.gsr_source = mcg->source; gsr.gsr_group = mcg->group; inet_addr2str(&gsr.gsr_source, source, sizeof(source)); inet_addr2str(&gsr.gsr_group, group, sizeof(group)); } smclog(LOG_DEBUG, "%s group (%s,%s) on ifindex %d and socket %d ...", cmd ? "Join" : "Leave", source, group, mcg->iface->ifindex, sd); return setsockopt(sd, proto, op, arg, len); } #else /* Assume we have old style struct ip_mreq */ static int group_req(int sd, int cmd, struct mcgroup *mcg) { char group[INET_ADDRSTR_LEN]; #ifdef HAVE_IPV6_MULTICAST_HOST struct ipv6_mreq ipv6mr = { 0 }; #endif #ifdef HAVE_STRUCT_IP_MREQN struct ip_mreqn imr = { 0 }; #else struct ip_mreq imr = { 0 }; #endif int op, proto; size_t len; void *arg; #ifdef HAVE_IPV6_MULTICAST_HOST if (mcg->group.ss_family == AF_INET6) { struct sockaddr_in6 *sin6; sin6 = inet_addr6_get(&mcg->group); ipv6mr.ipv6mr_multiaddr = sin6->sin6_addr; ipv6mr.ipv6mr_interface = mcg->iface->ifindex; proto = IPPROTO_IPV6; op = cmd ? IPV6_JOIN_GROUP : IPV6_LEAVE_GROUP; arg = &ipv6mr; len = sizeof(ipv6mr); } else #endif { imr.imr_multiaddr = *inet_addr_get(&mcg->group); #ifdef HAVE_STRUCT_IP_MREQN imr.imr_ifindex = mcg->iface->ifindex; #else imr.imr_interface = mcg->iface->inaddr; #endif proto = IPPROTO_IP; op = cmd ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP; arg = &imr; len = sizeof(imr); } smclog(LOG_DEBUG, "%s group (*,%s) on ifindex %d ...", cmd ? "Join" : "Leave", inet_addr2str(&mcg->group, group, sizeof(group)), mcg->iface->ifindex); return setsockopt(sd, proto, op, arg, len); } #endif int kern_join_leave(int sd, int cmd, struct mcgroup *mcg) { if (group_req(sd, cmd, mcg)) { char source[INET_ADDRSTR_LEN] = "*"; char group[INET_ADDRSTR_LEN]; int len; if (!is_anyaddr(&mcg->source)) inet_addr2str(&mcg->source, source, sizeof(source)); inet_addr2str(&mcg->group, group, sizeof(group)); len = mcg->len == 0 ? 32 : mcg->len; smclog(LOG_ERR, "Failed %s group (%s,%s/%d) on sd %d ... %d: %s", cmd ? "joining" : "leaving", source, group, len, sd, errno, strerror(errno)); return 1; } return 0; } int kern_mroute_init(int table_id, void (*cb)(int, void *), void *arg) { int val = 1; if (sd4 < 0) { sd4 = socket_create(AF_INET, SOCK_RAW, IPPROTO_IGMP, cb, arg); if (sd4 < 0) return -1; } #ifdef MRT_TABLE /* Currently only available on Linux */ if (table_id != 0) { smclog(LOG_INFO, "Setting IPv4 multicast routing table id %d", table_id); if (setsockopt(sd4, IPPROTO_IP, MRT_TABLE, &table_id, sizeof(table_id)) < 0) { errno = EPROTONOSUPPORT; goto error; } } #else (void)table_id; #endif if (setsockopt(sd4, IPPROTO_IP, MRT_INIT, &val, sizeof(val))) goto error; /* Enable "PIM" to get WRONGVIF messages */ if (setsockopt(sd4, IPPROTO_IP, MRT_PIM, &val, sizeof(val))) smclog(LOG_ERR, "Failed enabling PIM IGMPMSG_WRONGVIF, ignoring: %s", strerror(errno)); /* Initialize virtual interface table */ memset(&vif_list, 0, sizeof(vif_list)); return 0; error: socket_close(sd4); sd4 = -1; return -1; } int kern_mroute_exit(void) { if (sd4 == -1) return errno = EAGAIN; /* Drop all kernel routes set by smcroute */ if (setsockopt(sd4, IPPROTO_IP, MRT_DONE, NULL, 0)) smclog(LOG_WARNING, "Failed shutting down IPv4 multicast routing socket: %s", strerror(errno)); socket_close(sd4); sd4 = -1; return 0; } int kern_vif_add(struct iface *iface) { struct vifctl vifc = { 0 }; size_t i; int vif; if (!iface) return errno = EINVAL; if ((iface->flags & IFF_MULTICAST) != IFF_MULTICAST) return errno = ENOPROTOOPT; if (sd4 == -1) return errno = EAGAIN; if (iface->vif != NO_VIF) return errno = EEXIST; /* find a free vif */ for (i = 0, vif = -1; i < NELEMS(vif_list); i++) { if (!vif_list[i].iface) { vif = i; break; } } if (vif == -1) return errno = ENOMEM; memset(&vifc, 0, sizeof(vifc)); vifc.vifc_vifi = vif; vifc.vifc_flags = 0; /* no tunnel, no source routing, register ? */ vifc.vifc_threshold = iface->threshold; vifc.vifc_rate_limit = 0; /* hopefully no limit */ #ifdef VIFF_USE_IFINDEX /* Register VIF using ifindex, not lcl_addr, since Linux 2.6.33 */ vifc.vifc_flags |= VIFF_USE_IFINDEX; vifc.vifc_lcl_ifindex = iface->ifindex; #else vifc.vifc_lcl_addr.s_addr = iface->inaddr.s_addr; #endif vifc.vifc_rmt_addr.s_addr = htonl(INADDR_ANY); smclog(LOG_DEBUG, "Map iface %-16s => VIF %-2d ifindex %2d flags 0x%04x TTL threshold %u", iface->ifname, vifc.vifc_vifi, iface->ifindex, vifc.vifc_flags, iface->threshold); if (setsockopt(sd4, IPPROTO_IP, MRT_ADD_VIF, &vifc, sizeof(vifc))) return 1; iface->vif = vif; vif_list[vif].iface = iface; return 0; } int kern_vif_del(struct iface *iface) { struct vifctl vifc = { 0 }; int rc; if (sd4 == -1) return errno = EAGAIN; if (!iface) return errno = EINVAL; if (iface->vif == NO_VIF) return errno = ENOENT; smclog(LOG_DEBUG, "Removing %-16s => VIF %-2d", iface->ifname, iface->vif); vifc.vifc_vifi = iface->vif; #ifdef __linux__ rc = setsockopt(sd4, IPPROTO_IP, MRT_DEL_VIF, &vifc, sizeof(vifc)); #else rc = setsockopt(sd4, IPPROTO_IP, MRT_DEL_VIF, &vifc.vifc_vifi, sizeof(vifc.vifc_vifi)); #endif if (!rc) { vif_list[iface->vif].iface = NULL; iface->vif = -1; } return rc; } static int kern_mroute4(int cmd, struct mroute *route) { char origin[INET_ADDRSTRLEN], group[INET_ADDRSTRLEN]; int op = cmd ? MRT_ADD_MFC : MRT_DEL_MFC; struct mfcctl mfcc = { 0 }; size_t i; if (sd4 == -1) { smclog(LOG_DEBUG, "No IPv4 multicast socket"); return -1; } memset(&mfcc, 0, sizeof(mfcc)); mfcc.mfcc_origin = *inet_addr_get(&route->source); mfcc.mfcc_mcastgrp = *inet_addr_get(&route->group); mfcc.mfcc_parent = route->inbound; inet_addr2str(&route->source, origin, sizeof(origin)); inet_addr2str(&route->group, group, sizeof(group)); /* copy the TTL vector, as many as the kernel supports */ for (i = 0; i < NELEMS(mfcc.mfcc_ttls); i++) mfcc.mfcc_ttls[i] = route->ttl[i]; if (setsockopt(sd4, IPPROTO_IP, op, &mfcc, sizeof(mfcc))) { if (ENOENT == errno) smclog(LOG_DEBUG, "failed removing multicast route (%s,%s), does not exist.", origin, group); else smclog(LOG_WARNING, "failed %s IPv4 multicast route (%s,%s): %s", cmd ? "adding" : "removing", origin, group, strerror(errno)); return 1; } smclog(LOG_DEBUG, "%s %s -> %s from VIF %d", cmd ? "Add" : "Del", origin, group, route->inbound); return 0; } static int kern_stats4(struct mroute *route, struct mroute_stats *ms) { struct sioc_sg_req sg_req = { 0 }; if (sd4 == -1) return errno = EAGAIN; memset(&sg_req, 0, sizeof(sg_req)); sg_req.src = *inet_addr_get(&route->source); sg_req.grp = *inet_addr_get(&route->group); if (ioctl(sd4, SIOCGETSGCNT, &sg_req) < 0) { if (ms->ms_wrong_if) smclog(LOG_WARNING, "Failed getting MFC stats: %s", strerror(errno)); return errno; } ms->ms_pktcnt = sg_req.pktcnt; ms->ms_bytecnt = sg_req.bytecnt; ms->ms_wrong_if = sg_req.wrong_if; return 0; } #ifdef HAVE_IPV6_MULTICAST_HOST #ifdef __linux__ #define IPV6_ALL_MC_FORWARD "/proc/sys/net/ipv6/conf/all/mc_forwarding" static int proc_set_val(char *file, int val) { int fd, rc = 0; fd = open(file, O_WRONLY); if (fd < 0) return 1; if (-1 == write(fd, "1", val)) rc = 1; close(fd); return rc; } #endif /* Linux only */ int kern_mroute6_init(int table_id, void (*cb)(int, void *), void *arg) { int val = 1; if (sd6 < 0) { sd6 = socket_create(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6, cb, arg); if (sd6 < 0) return -1; } #ifdef MRT6_TABLE /* Currently only available on Linux */ if (table_id != 0) { smclog(LOG_INFO, "Setting IPv6 multicast routing table id %d", table_id); if (setsockopt(sd6, IPPROTO_IPV6, MRT6_TABLE, &table_id, sizeof(table_id)) < 0) { errno = EPROTONOSUPPORT; goto error; } } #else (void)table_id; #endif if (setsockopt(sd6, IPPROTO_IPV6, MRT6_INIT, &val, sizeof(val))) goto error; /* Initialize virtual interface table */ memset(&mif_list, 0, sizeof(mif_list)); #ifdef __linux__ /* * On Linux pre 2.6.29 kernels net.ipv6.conf.all.mc_forwarding * is not set on MRT6_INIT so we have to do this manually */ if (proc_set_val(IPV6_ALL_MC_FORWARD, 1)) { if (errno != EACCES) { smclog(LOG_ERR, "Failed enabling IPv6 multicast forwarding: %s", strerror(errno)); goto error; } } #endif return 0; error: socket_close(sd6); sd6 = -1; return -1; } int kern_mroute6_exit(void) { if (sd6 == -1) return errno = EAGAIN; if (setsockopt(sd6, IPPROTO_IPV6, MRT6_DONE, NULL, 0)) smclog(LOG_WARNING, "Failed shutting down IPv6 multicast routing socket: %s", strerror(errno)); socket_close(sd6); sd6 = -1; return 0; } /* Create a virtual interface from @iface so it can be used for IPv6 multicast routing. */ int kern_mif_add(struct iface *iface) { struct mif6ctl mif6c = { 0 }; int mif = -1; size_t i; if (sd6 == -1) return errno = EAGAIN; if (!iface) return errno = EINVAL; if ((iface->flags & IFF_MULTICAST) != IFF_MULTICAST) return errno = ENOPROTOOPT; if (iface->mif != NO_VIF) return errno = EEXIST; /* find a free mif */ for (i = 0; i < NELEMS(mif_list); i++) { if (!mif_list[i].iface) { mif = i; break; } } if (mif == -1) return errno = ENOMEM; memset(&mif6c, 0, sizeof(mif6c)); mif6c.mif6c_mifi = mif; mif6c.mif6c_flags = 0; /* no register */ #ifdef HAVE_MIF6CTL_VIFC_THRESHOLD mif6c.vifc_threshold = iface->threshold; #endif mif6c.mif6c_pifi = iface->ifindex; /* physical interface index */ #ifdef HAVE_MIF6CTL_VIFC_RATE_LIMIT mif6c.vifc_rate_limit = 0; /* hopefully no limit */ #endif smclog(LOG_DEBUG, "Map iface %-16s => MIF %-2d ifindex %2d flags 0x%04x TTL threshold %u", iface->ifname, mif6c.mif6c_mifi, mif6c.mif6c_pifi, mif6c.mif6c_flags, iface->threshold); if (setsockopt(sd6, IPPROTO_IPV6, MRT6_ADD_MIF, &mif6c, sizeof(mif6c))) return -1; iface->mif = mif; mif_list[mif].iface = iface; return 0; } int kern_mif_del(struct iface *iface) { int rc; if (sd6 == -1) return errno = EAGAIN; if (!iface) return errno = EINVAL; if (iface->mif == NO_VIF) return errno = ENOENT; smclog(LOG_DEBUG, "Removing %-16s => MIF %-2d", iface->ifname, iface->mif); rc = setsockopt(sd6, IPPROTO_IPV6, MRT6_DEL_MIF, &iface->mif, sizeof(iface->mif)); if (!rc) { mif_list[iface->mif].iface = NULL; iface->mif = -1; } return rc; } static int kern_mroute6(int cmd, struct mroute *route) { char origin[INET_ADDRSTR_LEN], group[INET_ADDRSTR_LEN]; int op = cmd ? MRT6_ADD_MFC : MRT6_DEL_MFC; struct mf6cctl mf6cc = { 0 }; size_t i; if (sd6 == -1) return errno = EAGAIN; if (!route) return errno = EINVAL; memset(&mf6cc, 0, sizeof(mf6cc)); mf6cc.mf6cc_origin = *inet_addr6_get(&route->source); mf6cc.mf6cc_mcastgrp = *inet_addr6_get(&route->group); mf6cc.mf6cc_parent = route->inbound; inet_addr2str(&route->source, origin, INET_ADDRSTR_LEN); inet_addr2str(&route->group, group, INET_ADDRSTR_LEN); IF_ZERO(&mf6cc.mf6cc_ifset); for (i = 0; i < NELEMS(route->ttl); i++) { if (route->ttl[i]) { IF_SET(i, &mf6cc.mf6cc_ifset); } } if (setsockopt(sd6, IPPROTO_IPV6, op, &mf6cc, sizeof(mf6cc))) { if (ENOENT == errno) smclog(LOG_DEBUG, "failed removing IPv6 multicast route (%s,%s), " "does not exist.", origin, group); else smclog(LOG_WARNING, "failed %s IPv6 multicast route (%s,%s): %s", cmd ? "adding" : "removing", origin, group, strerror(errno)); return 1; } smclog(LOG_DEBUG, "%s %s -> %s from VIF %d", cmd ? "Add" : "Del", origin, group, route->inbound); return 0; } static int kern_stats6(struct mroute *route, struct mroute_stats *ms) { struct sioc_sg_req6 sg_req = { 0 }; if (sd6 == -1) return errno = EAGAIN; sg_req.src = *inet_addr6_get(&route->source); sg_req.grp = *inet_addr6_get(&route->group); if (ioctl(sd6, SIOCGETSGCNT_IN6, &sg_req) < 0) { if (ms->ms_wrong_if) smclog(LOG_WARNING, "Failed getting MFC stats: %s", strerror(errno)); return errno; } ms->ms_pktcnt = sg_req.pktcnt; ms->ms_bytecnt = sg_req.bytecnt; ms->ms_wrong_if = sg_req.wrong_if; return 0; } #endif /* HAVE_IPV6_MULTICAST_HOST */ /* * Query kernel for route usage statistics */ int kern_stats(struct mroute *route, struct mroute_stats *ms) { if (!route || !ms) return errno = EINVAL; #ifdef HAVE_IPV6_MULTICAST_HOST if (route->group.ss_family == AF_INET6) return kern_stats6(route, ms); #endif return kern_stats4(route, ms); } int kern_mroute_add(struct mroute *route) { if (!route) return errno = EINVAL; #ifdef HAVE_IPV6_MULTICAST_HOST if (route->group.ss_family == AF_INET6) return kern_mroute6(1, route); #endif return kern_mroute4(1, route); } int kern_mroute_del(struct mroute *route) { if (!route) return errno = EINVAL; #ifdef HAVE_IPV6_MULTICAST_HOST if (route->group.ss_family == AF_INET6) return kern_mroute6(0, route); #endif return kern_mroute4(0, route); } /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/mroute.h0000644000175100001710000000534214146403320012556 00000000000000/* Generic kernel multicast routing API for Linux and *BSD */ #ifndef SMCROUTE_MROUTE_H_ #define SMCROUTE_MROUTE_H_ #include "config.h" #include #include #include /* Defines u_char, needed by netinet/in.h */ #include #include #include #ifdef HAVE_NETINET_IN_VAR_H #include #endif #include #include "queue.h" /* Needed by netinet/ip_mroute.h on FreeBSD */ #ifdef HAVE_LINUX_MROUTE_H #define _LINUX_IN_H /* For Linux <= 2.6.25 */ #include #include #endif #ifdef HAVE_LINUX_MROUTE6_H #include #endif #ifdef HAVE_LINUX_FILTER_H #include #endif #ifdef HAVE_NET_ROUTE_H #include #endif #ifdef HAVE_NETINET_IP_MROUTE_H #define _KERNEL #include #undef _KERNEL #else # ifdef __APPLE__ # include "ip_mroute.h" # endif #endif #ifdef HAVE_NETINET6_IP6_MROUTE_H #ifdef HAVE_SYS_PARAM_H #include #endif #include #endif #ifndef IN6_IS_ADDR_MULTICAST #define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff) #endif #include "inet.h" /* * IPv4 multicast route */ #ifndef MAXVIFS #define MAXVIFS 32 #endif /* * IPv6 multicast route */ #ifdef HAVE_IPV6_MULTICAST_ROUTING # ifndef MAXMIFS # define MAXMIFS MAXVIFS # endif /* Allocate data types to the max, on FreeBSD MAXMIFS > MAXVIFS */ # if MAXMIFS > MAXVIFS # define MAX_MC_VIFS MAXMIFS # else # define MAX_MC_VIFS MAXVIFS # endif #else #define MAX_MC_VIFS MAXVIFS #endif /* We're on a system w/o IPv6 routing, define to avoid other ifdefs */ #ifndef mifi_t typedef unsigned short mifi_t; #endif struct mroute { TAILQ_ENTRY(mroute) link; int unused; inet_addr_t source; /* originating host, may be inet_anyaddr() */ short src_len; /* source prefix len, or 0:disabled */ inet_addr_t group; /* multicast group */ short len; /* prefix len, or 0:disabled */ vifi_t inbound; /* incoming VIF */ uint8_t ttl[MAX_MC_VIFS];/* outgoing VIFs */ unsigned long valid_pkt; /* packet counter at last mroute4_dyn_expire() */ time_t last_use; /* timestamp of last forwarded packet */ }; int mroute_init (int do_vifs, int table_id, int cache_tmo); void mroute_exit (void); int mroute_add_vif (char *ifname, uint8_t mrdisc, uint8_t threshold); int mroute_del_vif (char *ifname); void mroute_expire (int max_idle); int mroute_add_route (struct mroute *mroute); int mroute_del_route (struct mroute *mroute); void mroute_reload_beg (void); void mroute_reload_end (int do_vifs); int mroute_show (int sd, int detail); #endif /* SMCROUTE_MROUTE_H_ */ smcroute-2.5.5/src/mcgroup.h0000644000175100001710000000147214146403320012717 00000000000000/* IGMP/MLD group subscription API */ #ifndef SMCROUTE_MCGROUP_H_ #define SMCROUTE_MCGROUP_H_ #include "inet.h" #include "queue.h" struct mcgroup { TAILQ_ENTRY(mcgroup) link; int unused; char ifname[IFNAMSIZ]; struct iface *iface; inet_addr_t source; uint8_t src_len; inet_addr_t group; uint8_t len; int sd; }; void mcgroup_reload_beg(void); void mcgroup_reload_end(void); void mcgroup_prune (char *ifname); void mcgroup_init (void); void mcgroup_exit (void); int mcgroup_action (int cmd, const char *ifname, inet_addr_t *source, int src_len, inet_addr_t *group, int len); int mcgroup_show (int sd, int detail); #endif /* SMCROUTE_MCGROUP_H_ */ /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/Makefile.am0000644000175100001710000000224014146403320013120 00000000000000AUTOMAKE_OPTIONS = subdir-objects sbin_PROGRAMS = smcrouted smcroutectl smcrouted_SOURCES = smcrouted.c conf.c conf.h mroute.c mroute.h iface.c \ iface.h inet.c inet.h ipc.c ipc.h kern.c kern.h \ log.c log.h mcgroup.c mcgroup.h msg.c msg.h \ notify.c notify.h pidfile.c queue.h script.c \ script.h socket.c socket.h timer.c timer.h util.h smcrouted_CFLAGS = -W -Wall -Wextra -Wno-deprecated-declarations -std=gnu99 smcrouted_CPPFLAGS = -D_ATFILE_SOURCE -D_INCOMPLETE_XOPEN_C063 smcrouted_CPPFLAGS += -DSYSCONFDIR=\"@sysconfdir@\" -DRUNSTATEDIR=\"@runstatedir@\" smcrouted_LDADD = $(LIBS) $(LIBOBJS) @LIB_RT@ @LIB_PTHREAD@ if USE_LIBCAP smcrouted_SOURCES += cap.c cap.h smcrouted_LDADD += -lcap endif if HAVE_LIBSYSTEMD smcrouted_SOURCES += systemd.c smcrouted_CFLAGS += $(libsystemd_CFLAGS) smcrouted_LDADD += $(libsystemd_LIBS) endif if USE_MRDISC smcrouted_SOURCES += mrdisc.c mrdisc.h endif smcroutectl_SOURCES = smcroutectl.c msg.h util.h smcroutectl_CFLAGS = -W -Wall -Wextra -std=gnu99 smcroutectl_CPPFLAGS = -DRUNSTATEDIR=\"@runstatedir@\" smcroutectl_LDADD = $(LIBS) $(LIBOBJS) smcroute-2.5.5/src/inet.c0000644000175100001710000001750514146403320012201 00000000000000/* Housekeeping IPv4/IPv6 wrapper functions * * Copyright (C) 2017-2021 Joachim Wiberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "inet.h" void inet_addr_set(inet_addr_t *addr, const struct in_addr *ina) { struct sockaddr_in *sin = (struct sockaddr_in *)addr; assert(addr && ina); sin->sin_family = AF_INET; #ifdef HAVE_SOCKADDR_IN_SIN_LEN sin->sin_len = sizeof(struct sockaddr_in); #endif sin->sin_addr = *ina; } struct in_addr *inet_addr_get(inet_addr_t *addr) { struct sockaddr_in *sin = (struct sockaddr_in *)addr; assert(addr); assert(sin->sin_family == AF_INET); return &sin->sin_addr; } #ifdef HAVE_IPV6_MULTICAST_HOST void inet_addr6_set(inet_addr_t *addr, const struct in6_addr *ina) { struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)addr; assert(addr && ina); sin6->sin6_family = AF_INET6; #ifdef HAVE_SOCKADDR_IN_SIN_LEN sin6->sin6_len = sizeof(struct sockaddr_in6); #endif sin6->sin6_addr = *ina; } struct sockaddr_in6 *inet_addr6_get(inet_addr_t *addr) { struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)addr; assert(addr); assert(sin6->sin6_family == AF_INET6); return sin6; } #endif /* HAVE_IPV6_MULTICAST_HOST */ void inet_anyaddr(sa_family_t family, inet_addr_t *addr) { struct sockaddr_in *sin = (struct sockaddr_in *)addr; #ifdef HAVE_IPV6_MULTICAST_HOST if (family == AF_INET6) { struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)addr; sin6->sin6_family = AF_INET6; #ifdef HAVE_SOCKADDR_IN_SIN_LEN sin6->sin6_len = sizeof(struct sockaddr_in6); #endif memcpy(&sin6->sin6_addr, &in6addr_any, sizeof(in6addr_any)); return; } #endif sin->sin_family = AF_INET; #ifdef HAVE_SOCKADDR_IN_SIN_LEN sin->sin_len = sizeof(struct sockaddr_in); #endif sin->sin_addr.s_addr = htonl(INADDR_ANY); } inet_addr_t inet_netaddr(inet_addr_t *addr, int len) { inet_addr_t net = *addr; uint32_t bits; int max_len; assert(addr); #ifdef HAVE_IPV6_MULTICAST_HOST if (addr->ss_family == AF_INET6) max_len = 128; else #endif max_len = 32; assert(len > 0 && len <= max_len); bits = max_len - len; #ifdef HAVE_IPV6_MULTICAST_HOST if (addr->ss_family == AF_INET6) { struct sockaddr_in6 *sin6 = inet_addr6_get(&net); struct in6_addr s6 = sin6->sin6_addr; uint32_t pos = 3; while (bits >= 32) { s6.s6_addr32[pos--] = 0; bits -= 32; } s6.s6_addr32[pos] = htonl(ntohl(s6.s6_addr32[pos]) & (0xffffffffu << bits)); sin6->sin6_addr = s6; } else #endif { struct in_addr *ina = inet_addr_get(&net); ina->s_addr = htonl(ntohl(ina->s_addr) & (0xffffffffu << bits)); } return net; } int inet_addr_cmp(inet_addr_t *a, inet_addr_t *b) { if (!a || !b) { errno = EINVAL; return 1; } if (a->ss_family == AF_INET && b->ss_family == AF_INET) { struct sockaddr_in *sa = (struct sockaddr_in *)a; struct sockaddr_in *sb = (struct sockaddr_in *)b; return sa->sin_addr.s_addr - sb->sin_addr.s_addr; } #ifdef HAVE_IPV6_MULTICAST_HOST if (a->ss_family == AF_INET6 && b->ss_family == AF_INET6) { struct sockaddr_in6 *sa = (struct sockaddr_in6 *)a; struct sockaddr_in6 *sb = (struct sockaddr_in6 *)b; return memcmp(sa, sb, sizeof(*sa)); } #endif errno = EAFNOSUPPORT; return 1; } const char *inet_addr2str(inet_addr_t *addr, char *str, size_t len) { struct sockaddr_in *sin = (struct sockaddr_in *)addr; #ifdef HAVE_IPV6_MULTICAST_HOST if (addr->ss_family == AF_INET6) { struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)addr; return inet_ntop(AF_INET6, &sin6->sin6_addr, str, len); } #endif return inet_ntop(AF_INET, &sin->sin_addr, str, len); } int inet_str2addr(const char *str, inet_addr_t *addr) { struct sockaddr_in *sin = (struct sockaddr_in *)addr; int rc; if (!str || !addr) { errno = EINVAL; return -1; } #ifdef HAVE_IPV6_MULTICAST_HOST if (strchr(str, ':')) { struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)addr; sin6->sin6_family = AF_INET6; #ifdef HAVE_SOCKADDR_IN_SIN_LEN sin6->sin6_len = sizeof(struct sockaddr_in6); #endif rc = inet_pton(AF_INET6, str, &sin6->sin6_addr); } else #endif { sin->sin_family = AF_INET; #ifdef HAVE_SOCKADDR_IN_SIN_LEN sin->sin_len = sizeof(struct sockaddr_in); #endif rc = inet_pton(AF_INET, str, &sin->sin_addr); } if (rc == 0 || rc == -1) return 1; return 0; } int is_multicast(inet_addr_t *addr) { struct sockaddr_in *sin = (struct sockaddr_in *)addr; #ifdef HAVE_IPV6_MULTICAST_HOST if (addr->ss_family == AF_INET6) { struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)addr; return IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr); } #endif return IN_MULTICAST(ntohl(sin->sin_addr.s_addr)); } int is_anyaddr(inet_addr_t *addr) { struct sockaddr_in *sin = (struct sockaddr_in *)addr; #ifdef HAVE_IPV6_MULTICAST_HOST if (addr->ss_family == AF_INET6) { struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)addr; return !memcmp(&sin6->sin6_addr, &in6addr_any, sizeof(in6addr_any)); } #endif return sin->sin_addr.s_addr == htonl(INADDR_ANY); } int inet_iter_init(struct inet_iter *iter, inet_addr_t *addr, int len) { int max_len; if (!iter) return errno = EINVAL; #ifdef HAVE_IPV6_MULTICAST_HOST if (addr->ss_family == AF_INET6) max_len = 128; else #endif max_len = 32; if (len < 0 || len > max_len) { iter->num = 0; return errno = EINVAL; } iter->orig = *addr; iter->len = len; iter->addr = inet_netaddr(addr, len); iter->num = 1 << (max_len - len); return 0; } int inet_iterator(struct inet_iter *iter, inet_addr_t *addr) { if (!iter) { errno = EINVAL; return 0; } if (iter->num-- == 0) return 0; *addr = iter->addr; /* prepared already */ #ifdef HAVE_IPV6_MULTICAST_HOST if (addr->ss_family == AF_INET6) { struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&iter->addr; struct in6_addr s6 = sin6->sin6_addr; uint32_t pos = 4; while (pos--) { uint32_t addr32 = ntohl(s6.s6_addr32[pos]); addr32++; s6.s6_addr32[pos] = htonl(addr32); if (addr32 > 0) break; } sin6->sin6_addr = s6; } else #endif { struct sockaddr_in *sin = (struct sockaddr_in *)&iter->addr; in_addr_t ina; ina = ntohl(sin->sin_addr.s_addr); sin->sin_addr.s_addr = htonl(++ina); } return 1; } #ifdef _UNIT_TEST #include #include int main(void) { char str[INET_ADDRSTR_LEN]; struct inet_iter iter; inet_addr_t addr; inet_anyaddr(AF_INET6, &addr); if (!is_anyaddr(&addr)) err(1, "FAIL"); puts("OK"); inet_str2addr("192.168.1.42", &addr); inet_iter_init(&iter, &addr, 24); printf("Got num: %u\n", iter.num); while (inet_iterator(&iter, &addr)) printf("%s num %u\n", inet_addr2str(&addr, str, sizeof(str)), iter.num); inet_str2addr("2001::1", &addr); inet_iter_init(&iter, &addr, 122); printf("Got num: %u -> initial str %s\n", iter.num, inet_addr2str(&addr, str, sizeof(str))); while (inet_iterator(&iter, &addr)) printf("%s num %u\n", inet_addr2str(&addr, str, sizeof(str)), iter.num); inet_str2addr("192.168.1.42", &addr); inet_iter_init(&iter, &addr, 1); printf("Got num: %u\n", iter.num); while (inet_iterator(&iter, &addr)) printf("%s num %u\n", inet_addr2str(&addr, str, sizeof(str)), iter.num); return 0; } #endif /** * Local Variables: * compile-command: "gcc -D_UNIT_TEST -I.. -I. -o unit_test inet.c && ./unit_test" * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/src/kern.h0000644000175100001710000000325414146403320012202 00000000000000/* Kernel API for join/leave multicast groups and add/del routes * * Copyright (C) 2011-2021 Joachim Wiberg * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef SMCROUTE_KERN_H_ #define SMCROUTE_KERN_H_ #include "mcgroup.h" #include "mroute.h" struct mroute_stats { unsigned long ms_pktcnt; unsigned long ms_bytecnt; unsigned long ms_wrong_if; }; int kern_join_leave (int sd, int cmd, struct mcgroup *mcg); int kern_mroute_init (int table_id, void (*cb)(int, void *), void *arg); int kern_mroute_exit (void); int kern_mroute6_init(int table_id, void (*cb)(int, void *), void *arg); int kern_mroute6_exit(void); int kern_vif_add (struct iface *iface); int kern_vif_del (struct iface *iface); int kern_mif_add (struct iface *iface); int kern_mif_del (struct iface *iface); int kern_mroute_add (struct mroute *route); int kern_mroute_del (struct mroute *route); int kern_stats (struct mroute *route, struct mroute_stats *ms); #endif /* SMCROUTE_KERN_H_ */ smcroute-2.5.5/src/timer.h0000644000175100001710000000204314146403320012356 00000000000000/* Timer helper functions * * Copyright (C) 2017-2021 Joachim Wiberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef SMCROUTE_TIMER_H_ #define SMCROUTE_TIMER_H_ int timer_init (void); void timer_exit (void); int timer_add (int period, void (*cb)(void *), void *arg); int timer_del (void (*cb)(void *), void *arg); #endif /* SMCROUTE_TIMER_H_ */ smcroute-2.5.5/src/cap.h0000644000175100001710000000056514146403320012010 00000000000000/* Daemon capability API */ #ifndef SMCROUTE_CAP_H_ #define SMCROUTE_CAP_H_ #include "config.h" #ifdef ENABLE_LIBCAP void cap_drop_root (uid_t uid, gid_t gid); void cap_set_user (char *arg, uid_t *uid, gid_t *gid); #else #define cap_drop_root(uid, gid) #define cap_set_user(arg, uid, gid) warnx("Drop privs support not available.") #endif #endif /* SMCROUTE_CAP_H_ */ smcroute-2.5.5/src/mrdisc.c0000644000175100001710000002110514146403320012512 00000000000000/* Multicast Router Discovery Protocol, RFC4286 (IPv4 only) * * Copyright (C) 2017-2021 Joachim Wiberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __linux__ /* We use SO_BINDTODEVICE to be able to send MRDISC on interfaces that * may not have an IP address yet. I have not found any way of doing * this on FreeBSD. Best I could find was an aging patch for IP_SENDIF * https://forums.freebsd.org/threads/so_bindtodevice-undeclared-on-freebsd-12.73731/ * that never got merged. It's possible there are other ways to do the * same, but now you know as much as I do. */ #error Currently only works on Linux, patches for FreeBSD are most welcome. #endif #include "config.h" #include "queue.h" #include #include #include #include #include #include #include #include #include #include #include #include "log.h" #include "mrdisc.h" #include "socket.h" #include "timer.h" #include "util.h" #define MC_ALL_ROUTERS "224.0.0.2" #define MC_ALL_SNOOPERS "224.0.0.106" #define IGMP_MRDISC_ANNOUNCE 0x30 #define IGMP_MRDISC_SOLICIT 0x31 #define IGMP_MRDISC_TERM 0x32 struct ifsock { LIST_ENTRY(ifsock) link; int sd; char ifname[IFNAMSIZ]; vifi_t vif; }; static uint8_t interval = 20; static LIST_HEAD(ifslist, ifsock) ifsock_list = LIST_HEAD_INITIALIZER(); static struct ifsock *find(int sd) { struct ifsock *entry; LIST_FOREACH(entry, &ifsock_list, link) { if (entry->sd == sd) return entry; } return NULL; } /* Checksum routine for Internet Protocol family headers */ static unsigned short in_cksum(unsigned short *addr, int len) { unsigned short *w = addr; unsigned short answer = 0; int nleft = len; int sum = 0; /* * Our algorithm is simple, using a 32 bit accumulator (sum), we add * sequential 16 bit words to it, and at the end, fold back all the * carry bits from the top 16 bits into the lower 16 bits. */ while (nleft > 1) { sum += *w++; nleft -= 2; } /* mop up an odd byte, if necessary */ if (nleft == 1) { *(unsigned char *)(&answer) = *(unsigned char *)w; sum += answer; } /* add back carry outs from top 16 bits to low 16 bits */ sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */ sum += (sum >> 16); /* add carry */ answer = ~sum; /* truncate to 16 bits */ return answer; } static void compose_addr(struct sockaddr_in *sin, char *group) { memset(sin, 0, sizeof(*sin)); sin->sin_family = AF_INET; sin->sin_addr.s_addr = inet_addr(group); } static int inet_send(int sd, uint8_t type, uint8_t interval) { ssize_t num; struct igmp igmp; struct sockaddr dest; memset(&igmp, 0, sizeof(igmp)); igmp.igmp_type = type; igmp.igmp_code = interval; igmp.igmp_cksum = in_cksum((unsigned short *)&igmp, sizeof(igmp)); compose_addr((struct sockaddr_in *)&dest, MC_ALL_SNOOPERS); num = sendto(sd, &igmp, sizeof(igmp), 0, &dest, sizeof(dest)); if (num < 0) return -1; return 0; } /* If called with interval=0, only read() */ static int inet_recv(int sd, uint8_t interval) { char buf[1530]; ssize_t num; struct ip *ip; struct igmp *igmp; memset(buf, 0, sizeof(buf)); num = read(sd, buf, sizeof(buf)); if (num < 0) return -1; ip = (struct ip *)buf; igmp = (struct igmp *)(buf + (ip->ip_hl << 2)); if (igmp->igmp_type == IGMP_MRDISC_SOLICIT && interval > 0) { smclog(LOG_DEBUG, "Received mrdisc solicitation"); return inet_send(sd, IGMP_MRDISC_ANNOUNCE, interval); } return 0; } static int inet_open(char *ifname) { char loop; int sd, val, rc; struct ifreq ifr; struct ip_mreqn mreq; unsigned char ra[4] = { IPOPT_RA, 0x04, 0x00, 0x00 }; sd = socket_create(AF_INET, SOCK_RAW, IPPROTO_IGMP, mrdisc_recv, NULL); if (sd < 0) { smclog(LOG_ERR, "Cannot open socket: %s", strerror(errno)); return -1; } memset(&ifr, 0, sizeof(ifr)); snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s", ifname); if (setsockopt(sd, SOL_SOCKET, SO_BINDTODEVICE, (void *)&ifr, sizeof(ifr)) < 0) { if (ENODEV == errno) { smclog(LOG_WARNING, "Not a valid interface, %s, skipping ...", ifname); socket_close(sd); return -1; } smclog(LOG_ERR, "Cannot bind socket to interface %s: %s", ifname, strerror(errno)); socket_close(sd); return -1; } memset(&mreq, 0, sizeof(mreq)); mreq.imr_multiaddr.s_addr = inet_addr(MC_ALL_SNOOPERS); mreq.imr_ifindex = if_nametoindex(ifname); if (setsockopt(sd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq))) { smclog(LOG_ERR, "Failed joining group %s: %s", MC_ALL_SNOOPERS, strerror(errno)); return -1; } /* mrdisc solicitation messages goes to the All-Routers group */ mreq.imr_multiaddr.s_addr = inet_addr(MC_ALL_ROUTERS); mreq.imr_ifindex = if_nametoindex(ifname); if (setsockopt(sd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq))) { smclog(LOG_ERR, "Failed joining group %s: %s", MC_ALL_ROUTERS, strerror(errno)); return -1; } val = 1; rc = setsockopt(sd, IPPROTO_IP, IP_MULTICAST_TTL, &val, sizeof(val)); if (rc < 0) { smclog(LOG_ERR, "Cannot set TTL: %s", strerror(errno)); socket_close(sd); return -1; } loop = 0; rc = setsockopt(sd, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof(loop)); if (rc < 0) { smclog(LOG_ERR, "Cannot disable MC loop: %s", strerror(errno)); socket_close(sd); return -1; } rc = setsockopt(sd, IPPROTO_IP, IP_OPTIONS, &ra, sizeof(ra)); if (rc < 0) { smclog(LOG_ERR, "Cannot set IP OPTIONS: %s", strerror(errno)); socket_close(sd); return -1; } return sd; } static int inet_close(int sd) { return inet_send(sd, IGMP_MRDISC_TERM, 0) || socket_close(sd); } static void announce(struct ifsock *entry) { if (!entry) return; smclog(LOG_DEBUG, "Sending mrdisc announcement on %s", entry->ifname); if (inet_send(entry->sd, IGMP_MRDISC_ANNOUNCE, interval)) { if (ENETUNREACH == errno || ENETDOWN == errno) return; /* Link down, ignore. */ smclog(LOG_WARNING, "Failed sending IGMP control message 0x%x on %s, error %d: %s", IGMP_MRDISC_ANNOUNCE, entry->ifname, errno, strerror(errno)); } } int mrdisc_init(int period) { interval = period; if (timer_add(interval, mrdisc_send, NULL) < 0 && errno != EEXIST) { smclog(LOG_ERR, "Failed starting mrdisc announcement timer."); return -1; } return 0; } int mrdisc_exit(void) { struct ifsock *entry, *tmp; LIST_FOREACH_SAFE(entry, &ifsock_list, link, tmp) { inet_close(entry->sd); LIST_REMOVE(entry, link); free(entry); } return 0; } /* * Register possible interface for mrdisc */ int mrdisc_register(char *ifname, short vif) { struct ifsock *entry; LIST_FOREACH(entry, &ifsock_list, link) { if (!strcmp(entry->ifname, ifname)) goto reload; } entry = malloc(sizeof(*entry)); if (!entry) { smclog(LOG_ERR, "Out of memory in %s()", __func__); return -1; } entry->vif = vif; strlcpy(entry->ifname, ifname, sizeof(entry->ifname)); LIST_INSERT_HEAD(&ifsock_list, entry, link); entry->sd = inet_open(entry->ifname); if (entry->sd < 0) return -1; reload: announce(entry); return 0; } /* * Unregister mrdisc interface, regardless of refcnt */ int mrdisc_deregister(short vif) { struct ifsock *entry; LIST_FOREACH(entry, &ifsock_list, link) { if (entry->vif != vif) continue; inet_close(entry->sd); LIST_REMOVE(entry, link); free(entry); return 0; } return 0; } void mrdisc_send(void *arg) { struct ifsock *entry; (void)arg; LIST_FOREACH(entry, &ifsock_list, link) announce(entry); } void mrdisc_recv(int sd, void *arg) { struct ifsock *entry; (void)arg; /* Verify we are reading from an active socket */ entry = find(sd); if (!entry) { smclog(LOG_WARNING, "Bug in mrdisc, received frame on unknown socket %d", sd); return; } /* Only do a "dummy" read on inactive interfaces */ if (inet_recv(sd, interval)) smclog(LOG_WARNING, "Failed receiving IGMP control message from %s", entry->ifname); } /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */ smcroute-2.5.5/Makefile.am0000644000175100001710000000347314146403320012342 00000000000000## SMCRoute - A static multicast routing tool -*-Makefile-*- ACLOCAL_AMFLAGS = -I m4 SUBDIRS = man src DISTCLEANFILES = *~ DEADJOE semantic.cache *.gdb *.elf core core.* *.d dist_sbin_SCRIPTS = smcroute doc_DATA = README.md COPYING smcroute.conf EXTRA_DIST = README.md ChangeLog.md autogen.sh smcroute.conf smcroute.default smcroute.init if ENABLE_TEST SUBDIRS += test endif if HAVE_SYSTEMD systemd_DATA = smcroute.service endif ## Check if tagged in git release-hook: @if [ ! `git tag -l $(PACKAGE_VERSION) | grep $(PACKAGE_VERSION)` ]; then \ echo; \ printf "\e[1m\e[41mCannot find release tag $(PACKAGE_VERSION)\e[0m\n"; \ printf "\e[1m\e[5mDo release anyway?\e[0m "; read yorn; \ if [ "$$yorn" != "y" -a "$$yorn" != "Y" ]; then \ printf "OK, aborting release.\n"; \ exit 1; \ fi; \ echo; \ else \ echo; \ printf "\e[1m\e[42mFound GIT release tag $(PACKAGE_VERSION)\e[0m\n"; \ printf "\e[1m\e[44m>>Remember to push tags!\e[0m\n"; \ echo; \ fi ## Target to run when building a release release: release-hook distcheck @for file in $(DIST_ARCHIVES); do \ md5sum $$file > ../$$file.md5; \ sha256sum $$file > ../$$file.sha256; \ done @mv $(DIST_ARCHIVES) ../ @echo @echo "Resulting release files =======================================================================" @for file in $(DIST_ARCHIVES); do \ printf "%-30s Distribution tarball\n" $$file; \ printf "%-30s " $$file.md5; cat ../$$file.md5 | cut -f1 -d' '; \ printf "%-30s " $$file.sha256; cat ../$$file.sha256 | cut -f1 -d' '; \ done # Workaround for systemd unit file duing distcheck DISTCHECK_CONFIGURE_FLAGS = --with-systemd=$$dc_install_base/$(systemd) --enable-mrdisc --enable-test