diff --git a/Makefile.am b/Makefile.am index 15c136b85..8b838be6a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = lib src test support/systemd +SUBDIRS = lib src support test bin_PROGRAMS = nextepc-mmed nextepc-hssd nextepc-sgwd nextepc-pgwd nextepc-pcrfd nextepc-epcd @@ -34,26 +34,6 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/lib/core/include \ -I$(top_srcdir)/src -sysconf_DATA = \ - support/nextepc.conf - -freeDiameterdir = ${sysconfdir}/freeDiameter -freeDiameter_DATA = \ - support/freeDiameter/mme.conf \ - support/freeDiameter/hss.conf \ - support/freeDiameter/pgw.conf \ - support/freeDiameter/pcrf.conf -dist_freeDiameter_DATA = \ - support/freeDiameter/cacert.pem \ - support/freeDiameter/mme.key.pem \ - support/freeDiameter/mme.cert.pem \ - support/freeDiameter/hss.key.pem \ - support/freeDiameter/hss.cert.pem \ - support/freeDiameter/pgw.key.pem \ - support/freeDiameter/pgw.cert.pem \ - support/freeDiameter/pcrf.key.pem \ - support/freeDiameter/pcrf.cert.pem - install-data-hook: $(MKDIR_P) $(DESTDIR)/$(localstatedir)/log $(MKDIR_P) $(DESTDIR)/$(localstatedir)/run diff --git a/acinclude.m4 b/acinclude.m4 index af1c6f1e4..5cbf496f9 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -88,3 +88,21 @@ AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_COMPILE_FLAGS + +# adl_RECURSIVE_EVAL(VALUE, RESULT) +# ================================= +# Interpolate the VALUE in loop until it doesn't change, +# and set the result to $RESULT. +# WARNING: It's easy to get an infinite loop with some unsane input. +# For example ${datadir} becomes ${datarootdir}, and then ${prefix}/share, and +# finally ${prefix} is replaced by the prefix. +AC_DEFUN([adl_RECURSIVE_EVAL], +[_lcl_receval="$1" +$2=`(test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" + _lcl_receval_old='' + while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do + _lcl_receval_old="[$]_lcl_receval" + eval _lcl_receval="\"[$]_lcl_receval\"" + done + echo "[$]_lcl_receval")`]) diff --git a/configure.ac b/configure.ac index 5a369d769..50d320c44 100644 --- a/configure.ac +++ b/configure.ac @@ -189,23 +189,9 @@ AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL], [`echo $PACKAGE_VERSION | $SED 's/^\([[^\.]]\+\)\.\([[^\.]]\+\)\.\([[^\.]]\+\).*/\3/'`], [Patch version of this package]) -# adl_RECURSIVE_EVAL(VALUE, RESULT) -# ================================= -# Interpolate the VALUE in loop until it doesn't change, -# and set the result to $RESULT. -# WARNING: It's easy to get an infinite loop with some unsane input. -# For example ${datadir} becomes ${datarootdir}, and then ${prefix}/share, and -# finally ${prefix} is replaced by the prefix. -AC_DEFUN([adl_RECURSIVE_EVAL], -[_lcl_receval="$1" -$2=`(test "x$prefix" = xNONE && prefix="$ac_default_prefix" - test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" - _lcl_receval_old='' - while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do - _lcl_receval_old="[$]_lcl_receval" - eval _lcl_receval="\"[$]_lcl_receval\"" - done - echo "[$]_lcl_receval")`]) +################################## +#### Checks for Directories. ##### +################################## adl_RECURSIVE_EVAL(["${libdir}"], [LIB_DIR]) adl_RECURSIVE_EVAL(["${sysconfdir}"], [SYSCONF_DIR]) @@ -237,6 +223,28 @@ AC_ARG_WITH( ] ) +case $host in + *-apple-darwin*) + ;; + *) + AC_SUBST(logrotate_conf_dir) + ;; +esac +AC_ARG_WITH( + logrotate-conf-dir, + AS_HELP_STRING( + [--with-logrotateconfdir=DIR], + [logrotate conf directory @<:@LOGROTATE_CONF_DIR@:>@ + Defaults to the correct value for debian /etc/logrotate.d/] + ), + [ + logrotate_conf_dir="$withval" + ], + [ + logrotate_conf_dir="/etc/logrotate.d/" + ] +) + ################################## #### Checks for header files. #### ################################## @@ -497,14 +505,18 @@ AC_CONFIG_FILES([src/sgw/Makefile]) AC_CONFIG_FILES([src/pgw/Makefile]) AC_CONFIG_FILES([src/pcrf/Makefile]) AC_CONFIG_FILES([src/Makefile]) -AC_CONFIG_FILES([test/Makefile]) -AC_CONFIG_FILES([support/nextepc.conf]) AC_CONFIG_FILES([support/freeDiameter/mme.conf]) AC_CONFIG_FILES([support/freeDiameter/hss.conf]) AC_CONFIG_FILES([support/freeDiameter/pgw.conf]) AC_CONFIG_FILES([support/freeDiameter/pcrf.conf]) #AC_CONFIG_FILES([support/freeDiameter/dict_legacy_xml.conf]) +AC_CONFIG_FILES([support/freeDiameter/Makefile]) AC_CONFIG_FILES([support/systemd/Makefile]) +AC_CONFIG_FILES([support/logrotate/nextepc]) +AC_CONFIG_FILES([support/logrotate/Makefile]) +AC_CONFIG_FILES([support/nextepc.conf]) +AC_CONFIG_FILES([support/Makefile]) +AC_CONFIG_FILES([test/Makefile]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/lib/logger/logger.c b/lib/logger/logger.c index 6cba99683..dda8a45af 100644 --- a/lib/logger/logger.c +++ b/lib/logger/logger.c @@ -93,7 +93,9 @@ int logger_start(const char *path) int ret, count = 0; size_t nbytes; ssize_t r; +#if 0 /* deprecated by logrotate */ file_info_t finfo; +#endif int us; fd_set readfd; struct timeval timer_val; @@ -195,6 +197,7 @@ int logger_start(const char *path) (long)r, (long)nbytes); } +#if 0 /* Deprecated by logrotate */ if (count % FILE_CHECK_CYCLE == 0) { file_info_get(&finfo, FILE_INFO_SIZE, g_file); @@ -203,6 +206,7 @@ int logger_start(const char *path) log_file_backup(); } } +#endif count++; } diff --git a/main.c b/main.c index 861c6e2a8..6682cf172 100644 --- a/main.c +++ b/main.c @@ -48,6 +48,7 @@ static int check_signal(int signum) } case SIGHUP: { + d_info("SIGHUP received"); logger_restart(); break; } diff --git a/support/Makefile.am b/support/Makefile.am new file mode 100644 index 000000000..885149caf --- /dev/null +++ b/support/Makefile.am @@ -0,0 +1,8 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = freeDiameter systemd logrotate + +sysconf_DATA = nextepc.conf + +MAINTAINERCLEANFILES = Makefile.in +MOSTLYCLEANFILES = *.stackdump diff --git a/support/freeDiameter/Makefile.am b/support/freeDiameter/Makefile.am new file mode 100644 index 000000000..ca707b869 --- /dev/null +++ b/support/freeDiameter/Makefile.am @@ -0,0 +1,23 @@ +freeDiameterdir = ${sysconfdir}/freeDiameter + +freeDiameter_DATA = \ + mme.conf \ + hss.conf \ + pgw.conf \ + pcrf.conf \ + $(NULL) + +dist_freeDiameter_DATA = \ + cacert.pem \ + mme.key.pem \ + mme.cert.pem \ + hss.key.pem \ + hss.cert.pem \ + pgw.key.pem \ + pgw.cert.pem \ + pcrf.key.pem \ + pcrf.cert.pem \ + $(NULL) + +MAINTAINERCLEANFILES = Makefile.in +MOSTLYCLEANFILES = *.stackdump diff --git a/support/logrotate/Makefile.am b/support/logrotate/Makefile.am new file mode 100644 index 000000000..0d44770c2 --- /dev/null +++ b/support/logrotate/Makefile.am @@ -0,0 +1,5 @@ +confdir = ${logrotate_conf_dir} +conf_DATA = nextepc + +MAINTAINERCLEANFILES = Makefile.in +MOSTLYCLEANFILES = *.stackdump diff --git a/support/logrotate/nextepc.in b/support/logrotate/nextepc.in new file mode 100644 index 000000000..289f89dde --- /dev/null +++ b/support/logrotate/nextepc.in @@ -0,0 +1,15 @@ +@LOCALSTATE_DIR@/log/nextepc.log { + daily + sharedscripts + missingok + compress + rotate 14 + + postrotate + for i in nextepc-pcrfd nextepc-pgwd nextepc-sgwd nextepc-hssd nextepc-mmed nextepc-epcd; do + if [ -e @LOCALSTATE_DIR@/run/$i.pid ] ; then + kill -HUP `cat @LOCALSTATE_DIR@/run/$i.pid` + fi + done + endscript +} diff --git a/support/systemd/Makefile.am b/support/systemd/Makefile.am index 880af345c..508e116d7 100644 --- a/support/systemd/Makefile.am +++ b/support/systemd/Makefile.am @@ -11,3 +11,6 @@ unitdir = ${systemd_unit_dir} unit_DATA = $(unitfiles) EXTRA_DIST = $(unitfiles) + +MAINTAINERCLEANFILES = Makefile.in +MOSTLYCLEANFILES = *.stackdump