1 From b3402a68a4d29e9b1ae4e012e39a7bcb14fea3cf Mon Sep 17 00:00:00 2001
2 From: Yousong Zhou <yszhou4tech@gmail.com>
3 Date: Thu, 30 Apr 2015 13:57:36 +0800
4 Subject: [PATCH 207/210] xl2tpd: introduce new option -l for using syslog as
7 Defaults to old behaviour if no -l option was specified. Also update
8 manual doc to reflect this change.
10 doc/xl2tpd.8 | 5 +++++
13 xl2tpd.c | 13 ++++++++++++-
14 4 files changed, 19 insertions(+), 2 deletions(-)
16 diff --git a/doc/xl2tpd.8 b/doc/xl2tpd.8
17 index 915b247..7afccac 100644
20 @@ -20,6 +20,11 @@ This option prevents xl2tpd from detaching from the terminal and
25 +This option tells xl2tpd to use syslog for logging even when \fB\-D\fR
30 Tells xl2tpd to use an alternate config file. Default is
31 /etc/xl2tpd/xl2tpd.conf. Fallback configuration file is
32 diff --git a/file.h b/file.h
33 index 89987ae..92df046 100644
36 @@ -151,6 +151,7 @@ struct global
37 char pidfile[STRLEN]; /* File containing the pid number*/
38 char controlfile[STRLEN]; /* Control file name (named pipe) */
39 int daemon; /* Use daemon mode? */
40 + int syslog; /* Use syslog for logging? */
41 int accesscontrol; /* Use access control? */
42 int forceuserspace; /* Force userspace? */
43 int packet_dump; /* Dump (print) all packets? */
44 diff --git a/misc.c b/misc.c
45 index 3092401..cccf4ca 100644
48 @@ -57,7 +57,7 @@ void l2tp_log (int level, const char *fmt, ...)
49 vsnprintf (buf, sizeof (buf), fmt, args);
52 - if(gconfig.daemon) {
53 + if(gconfig.syslog) {
55 SYSLOG_CALL( syslog (level, "%s", buf) );
57 diff --git a/xl2tpd.c b/xl2tpd.c
58 index 017adfd..1937690 100644
61 @@ -1594,7 +1594,7 @@ void do_control ()
63 printf("\nxl2tpd version: %s\n", SERVER_VERSION);
64 printf("Usage: xl2tpd [-c <config file>] [-s <secret file>] [-p <pid file>]\n"
65 - " [-C <control file>] [-D]\n"
66 + " [-C <control file>] [-D] [-l]\n"
67 " [-v, --version]\n");
70 @@ -1605,6 +1605,7 @@ void init_args(int argc, char *argv[])
75 memset(gconfig.altauthfile,0,STRLEN);
76 memset(gconfig.altconfigfile,0,STRLEN);
77 memset(gconfig.authfile,0,STRLEN);
78 @@ -1642,6 +1643,9 @@ void init_args(int argc, char *argv[])
79 else if (! strncmp(argv[i],"-D",2)) {
82 + else if (! strncmp(argv[i],"-l",2)) {
85 else if (! strncmp(argv[i],"-s",2)) {
88 @@ -1667,6 +1671,13 @@ void init_args(int argc, char *argv[])
94 + * defaults to syslog if no log facility was explicitly
95 + * specified and we are about to daemonize
97 + if (gconfig.syslog < 0)
98 + gconfig.syslog = gconfig.daemon;