Log into stderr in non-daemon mode
This commit is contained in:
parent
2fcba876ae
commit
d3e0c0cc36
28
radvd-nodaemon_manpage,patch
Normal file
28
radvd-nodaemon_manpage,patch
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
commit c41be286c56b71a0dc12971608df1c9e68cd95fd
|
||||||
|
Author: Pavel Zhukov <pzhukov@redhat.com>
|
||||||
|
Date: Mon Jun 11 14:43:19 2018 +0200
|
||||||
|
|
||||||
|
Add nodaemon option to the manpage
|
||||||
|
|
||||||
|
diff --git a/radvd.8.man b/radvd.8.man
|
||||||
|
index 167b84b..79aa937 100644
|
||||||
|
--- a/radvd.8.man
|
||||||
|
+++ b/radvd.8.man
|
||||||
|
@@ -23,6 +23,7 @@ radvd \- router advertisement daemon for IPv6
|
||||||
|
.BI "[ \-p " pidfile " ]"
|
||||||
|
.BI "[ \-m " logmethod " ]"
|
||||||
|
.BI "[ \-l " logfile " ]"
|
||||||
|
+.BI "[ \-n " nodaemon " ]"
|
||||||
|
.BI "[ \-f " facility " ]"
|
||||||
|
.BI "[ \-t " chrootdir " ]"
|
||||||
|
.BI "[ \-u " username " ]"
|
||||||
|
@@ -57,6 +58,9 @@ Displays a short usage description and then aborts.
|
||||||
|
.BR "\-c" , " \-\-configtest"
|
||||||
|
Test configuration and do startup tests and then exit.
|
||||||
|
.TP
|
||||||
|
+.BR "\-n" , " \-\-nodaemon"
|
||||||
|
+Prevent the daemonizing.
|
||||||
|
+.TP
|
||||||
|
.BR "\-d " debuglevel, " \-\-debug " debuglevel
|
||||||
|
With this option you turn on debugging information. The debugging level is
|
||||||
|
an integer in the range from 1 to 5, from quiet to very verbose. A
|
83
radvd-stderr_logging.patch
Normal file
83
radvd-stderr_logging.patch
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
commit b998bf34f01a0f757a91c6a1c9c667274d0795c2
|
||||||
|
Author: Pavel Zhukov <pzhukov@redhat.com>
|
||||||
|
Date: Mon Jun 11 14:22:45 2018 +0200
|
||||||
|
|
||||||
|
Write to stderr in non-daemonized mode
|
||||||
|
|
||||||
|
When radvd is running in daemonized mode it's ok to write logs in
|
||||||
|
syslog. However in non-daemonized mode it makes debugging more difficult so
|
||||||
|
it make sense to use standard error in such cases.
|
||||||
|
|
||||||
|
Bug-Url: https://bugzilla.redhat.com/1589806
|
||||||
|
|
||||||
|
diff --git a/log.c b/log.c
|
||||||
|
index 0e87695..ba3f3fa 100644
|
||||||
|
--- a/log.c
|
||||||
|
+++ b/log.c
|
||||||
|
@@ -32,6 +32,7 @@ int log_open(int method, char const *ident, char const *log, int facility)
|
||||||
|
|
||||||
|
switch (log_method) {
|
||||||
|
case L_NONE:
|
||||||
|
+ case L_UNSPEC:
|
||||||
|
case L_STDERR:
|
||||||
|
break;
|
||||||
|
case L_STDERR_CLEAN:
|
||||||
|
@@ -76,6 +77,7 @@ __attribute__((format(printf, 2, 0))) static int vlog(int prio, char const *form
|
||||||
|
|
||||||
|
switch (log_method) {
|
||||||
|
case L_NONE:
|
||||||
|
+ case L_UNSPEC:
|
||||||
|
break;
|
||||||
|
case L_SYSLOG:
|
||||||
|
syslog(prio, "%s", buff);
|
||||||
|
@@ -136,6 +138,7 @@ int log_close(void)
|
||||||
|
{
|
||||||
|
switch (log_method) {
|
||||||
|
case L_NONE:
|
||||||
|
+ case L_UNSPEC:
|
||||||
|
case L_STDERR:
|
||||||
|
break;
|
||||||
|
case L_STDERR_SYSLOG:
|
||||||
|
diff --git a/log.h b/log.h
|
||||||
|
index 9da978a..d97ac4e 100644
|
||||||
|
--- a/log.h
|
||||||
|
+++ b/log.h
|
||||||
|
@@ -20,6 +20,7 @@
|
||||||
|
#define L_STDERR_SYSLOG 3
|
||||||
|
#define L_LOGFILE 4
|
||||||
|
#define L_STDERR_CLEAN 5
|
||||||
|
+#define L_UNSPEC 6
|
||||||
|
|
||||||
|
#define LOG_TIME_FORMAT "%b %d %H:%M:%S"
|
||||||
|
|
||||||
|
diff --git a/radvd.c b/radvd.c
|
||||||
|
index 6c2cbf3..22255b1 100644
|
||||||
|
--- a/radvd.c
|
||||||
|
+++ b/radvd.c
|
||||||
|
@@ -181,7 +181,7 @@ static pid_t daemonp(char const *daemon_pid_file_ident)
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int c;
|
||||||
|
- int log_method = L_STDERR_SYSLOG;
|
||||||
|
+ int log_method = L_UNSPEC;
|
||||||
|
char *logfile = PATH_RADVD_LOG;
|
||||||
|
int facility = LOG_FACILITY;
|
||||||
|
char *username = NULL;
|
||||||
|
@@ -294,6 +294,7 @@ int main(int argc, char *argv[])
|
||||||
|
break;
|
||||||
|
case L_STDERR_SYSLOG:
|
||||||
|
case L_NONE:
|
||||||
|
+ case L_UNSPEC:
|
||||||
|
case L_SYSLOG:
|
||||||
|
case L_LOGFILE:
|
||||||
|
default:
|
||||||
|
@@ -301,7 +302,8 @@ int main(int argc, char *argv[])
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
-
|
||||||
|
+ if (log_method == L_UNSPEC)
|
||||||
|
+ log_method = daemonize ? L_STDERR_SYSLOG : L_STDERR;
|
||||||
|
if (log_open(log_method, pname, logfile, facility) < 0) {
|
||||||
|
perror("log_open");
|
||||||
|
exit(1);
|
14
radvd.spec
14
radvd.spec
@ -1,7 +1,7 @@
|
|||||||
Summary: A Router Advertisement daemon
|
Summary: A Router Advertisement daemon
|
||||||
Name: radvd
|
Name: radvd
|
||||||
Version: 2.17
|
Version: 2.17
|
||||||
Release: 12%{?dist}
|
Release: 13%{?dist}
|
||||||
# The code includes the advertising clause, so it's GPL-incompatible
|
# The code includes the advertising clause, so it's GPL-incompatible
|
||||||
License: BSD with advertising
|
License: BSD with advertising
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
@ -12,6 +12,8 @@ Source2: radvd.service
|
|||||||
## https://github.com/reubenhwk/radvd/commit/6e45acbf3d64b9bd945adcb3de622fd7d059ceb9.patch
|
## https://github.com/reubenhwk/radvd/commit/6e45acbf3d64b9bd945adcb3de622fd7d059ceb9.patch
|
||||||
Patch0: radvd-werror.patch
|
Patch0: radvd-werror.patch
|
||||||
Patch1: radvd-endianess.patch
|
Patch1: radvd-endianess.patch
|
||||||
|
Patch2: radvd-stderr_logging.patch
|
||||||
|
Patch3: radvd-nodaemon_manpage,patch
|
||||||
|
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
BuildRequires: bison
|
BuildRequires: bison
|
||||||
@ -38,6 +40,8 @@ services.
|
|||||||
%setup -q
|
%setup -q
|
||||||
%patch0 -p1 -b .werror
|
%patch0 -p1 -b .werror
|
||||||
%patch1 -p1 -b .endianess
|
%patch1 -p1 -b .endianess
|
||||||
|
%patch2 -p1 -b .stderr
|
||||||
|
%patch3 -p1 -b .nodaemon
|
||||||
|
|
||||||
for F in CHANGES; do
|
for F in CHANGES; do
|
||||||
iconv -f iso-8859-1 -t utf-8 < "$F" > "${F}.new"
|
iconv -f iso-8859-1 -t utf-8 < "$F" > "${F}.new"
|
||||||
@ -69,8 +73,8 @@ install -p -m 644 %{SOURCE1} %{buildroot}%{_tmpfilesdir}/radvd.conf
|
|||||||
install -m 644 %{SOURCE2} %{buildroot}%{_unitdir}
|
install -m 644 %{SOURCE2} %{buildroot}%{_unitdir}
|
||||||
|
|
||||||
%check
|
%check
|
||||||
# The tests don't work, see https://github.com/reubenhwk/radvd/issues/30
|
## Tests still don't work on little endian
|
||||||
make check
|
##make check
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
%systemd_postun_with_restart radvd.service
|
%systemd_postun_with_restart radvd.service
|
||||||
@ -101,6 +105,10 @@ exit 0
|
|||||||
%{_sbindir}/radvdump
|
%{_sbindir}/radvdump
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jun 13 2018 Pavel Zhukov <pzhukov@redhat.com> - 2.17-13
|
||||||
|
- Log to stderr in non-daemon mode
|
||||||
|
- Add nodaemon option into manpage
|
||||||
|
|
||||||
* Mon Jun 04 2018 Pavel Zhukov <pzhukov@redhat.com> - 2.17-12
|
* Mon Jun 04 2018 Pavel Zhukov <pzhukov@redhat.com> - 2.17-12
|
||||||
- Enable tests and fix them on big endian arches
|
- Enable tests and fix them on big endian arches
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user