summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2003-10-20 21:57:59 +0000
committerLennart Poettering <lennart@poettering.net>2003-10-20 21:57:59 +0000
commit1da17f616cbaed97a41f571397ae17c3ef4ff8e0 (patch)
tree4d5176f78e4f38ad143fcf1c9ce2719dd18ac602
parenta84b6b03c26321d724400525aa3705bdd2f86898 (diff)
0.19 finished
git-svn-id: file:///home/lennart/svn/public/ifplugd/trunk@58 2bf48fe7-cfc1-0310-909f-d9042e1e0fef
-rw-r--r--Makefile.am2
-rwxr-xr-xbootstrap.sh4
-rw-r--r--configure.ac3
-rw-r--r--doc/Makefile.am2
-rw-r--r--doc/README.html.in10
-rw-r--r--src/ifplugd.c36
6 files changed, 45 insertions, 12 deletions
diff --git a/Makefile.am b/Makefile.am
index a3d7173..c2524dd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -37,5 +37,5 @@ homepage: all dist
distcleancheck:
@:
-
+
.PHONY: homepage distcleancheck
diff --git a/bootstrap.sh b/bootstrap.sh
index 583cdea..7697c97 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# $Id: bootstrap.sh 20 2003-07-10 16:21:55Z lennart $
+# $Id$
# This file is part of ifplugd.
#
@@ -24,8 +24,6 @@ if [ "x$1" = "xam" ] ; then
else
set -ex
-# make maintainer-clean || true
-
rm -rf autom4te.cache
rm -f config.cache
diff --git a/configure.ac b/configure.ac
index 82b583d..4cd28a0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
AC_PREREQ(2.57)
-AC_INIT([ifplugd], [0.18], [mzvscyhtq (at) 0pointer (dot) de])
+AC_INIT([ifplugd], [0.19], [mzvscyhtq (at) 0pointer (dot) de])
AC_CONFIG_SRCDIR([src/ifplugd.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign -Wall])
@@ -48,6 +48,7 @@ AC_PROG_MAKE_SET
# Checks for libraries.
AC_CHECK_LIB([daemon], [daemon_fork],, [AC_MSG_ERROR([*** Sorry, you have to install libdaemon ***])])
+AC_CHECK_LIB([daemon], [daemon_pid_file_kill_wait],, [AC_MSG_WARN([*** libdaemon too old, --wait-on-kill is not going to be supported. Consider updating to libdaemon 0.3. ***])])
# Checks for header files.
AC_HEADER_STDC
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 61f2444..2536a1f 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,4 +1,4 @@
-# $Id: Makefile.am 22 2003-06-15 16:36:33Z lennart $
+# $Id$
# This file is part of ifplugd.
#
diff --git a/doc/README.html.in b/doc/README.html.in
index 62c8cd3..f827c0b 100644
--- a/doc/README.html.in
+++ b/doc/README.html.in
@@ -42,6 +42,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</p>
<h2><a name="news">News</a></h2>
+<div class="news-date">Mon Oct 20 2003: </div> <p class="news-text"><a
+href="@PACKAGE_URL@ifplugd-0.19.tar.gz">Version
+0.19</a> released, changes include: New option <tt>--wait-for-kill</tt>, this requires <a href="http://0pointer.de/lennart/projects/libdaemon/"><tt>libdaemon 0.3</tt></a></p>
+
<div class="news-date">Fri Oct 17 2003: </div> <p class="news-text"><a
href="@PACKAGE_URL@ifplugd-0.18.tar.gz">Version
0.18</a> released, changes include: Some bugs fixed</p>
@@ -101,8 +105,10 @@ the interface when a cable is really connected.</p>
(-d option) or short "plugged" periods(<tt>-u</tt>
option)</li>
- <li>Support for wireless networking. Whenever an AP is detected the
-network is configured.</li>
+ <li>Support for wireless networking. Whenever an association to an
+AP is detected the network is configured. Have a look on <a
+href="http://0pointer.de/lennart/projects/waproamd/"><tt>waproamd</tt></a>
+if you need a facility to configure WEP keys before AP associations succeed.</li>
<li>Compatibility mode for network devices which do not support cable detection (<tt>-F</tt> option)</li>
</ul>
diff --git a/src/ifplugd.c b/src/ifplugd.c
index 322870f..5ddf92e 100644
--- a/src/ifplugd.c
+++ b/src/ifplugd.c
@@ -77,6 +77,9 @@ int daemonize = 1,
use_beep = 1,
no_shutdown_script = 0,
wait_on_fork = 0,
+#ifdef DAEMON_PID_FILE_KILL_WAIT_AVAILABLE
+ wait_on_kill = 0,
+#endif
use_syslog = 1,
ignore_retval = 0,
initial_down = 0,
@@ -634,6 +637,9 @@ void usage(char *p) {
" -q --no-shutdown Don't run script on daemon quit (%s)\n"
" -l --initial-down Run \"down\" script on startup if now cable is detected (%s)\n"
" -w --wait-on-fork Wait until daemon fork finished (%s)\n"
+#ifdef DAEMON_PID_FILE_KILL_WAIT_AVAILABLE
+ " -W --wait-on-kill When run with -k, wait until the daemon died (%s)\n"
+#endif
" -x --extra-arg Specify an extra argument for action script\n"
" -M --monitor Use interface monitoring (%s)\n"
" -h --help Show this help\n"
@@ -660,6 +666,9 @@ void usage(char *p) {
no_shutdown_script ? "on" : "off",
initial_down ? "on" : "off",
wait_on_fork ? "on" : "off",
+#ifdef DAEMON_PID_FILE_KILL_WAIT_AVAILABLE
+ wait_on_kill ? "on" : "off",
+#endif
use_ifmonitor ? "on" : "off");
}
@@ -679,6 +688,9 @@ void parse_args(int argc, char *argv[]) {
{"delay-down", required_argument, 0, 'd'},
{"api-mode", required_argument, 0, 'm'},
{"wait-on-fork", no_argument, 0, 'w'},
+#ifdef DAEMON_PID_FILE_KILL_WAIT_AVAILABLE
+ {"wait-on-kill", no_argument, 0, 'W'},
+#endif
{"no-shutdown", no_argument, 0, 'q'},
{"help", no_argument, 0, 'h'},
{"kill", no_argument, 0, 'k'},
@@ -698,7 +710,7 @@ void parse_args(int argc, char *argv[]) {
for (;;) {
int c;
- if ((c = getopt_long(argc, argv, "asni:r:t:u:d:hkbfFvm:qwx:cISRzlM", long_options, &option_index)) < 0)
+ if ((c = getopt_long(argc, argv, "asni:r:t:u:d:hkbfFvm:qwx:cISRzlMW", long_options, &option_index)) < 0)
break;
switch (c) {
@@ -774,7 +786,12 @@ void parse_args(int argc, char *argv[]) {
case 'w':
wait_on_fork = !wait_on_fork;
break;
- case 'x':
+#ifdef DAEMON_PID_FILE_KILL_WAIT_AVAILABLE
+ case 'W':
+ wait_on_kill = !wait_on_kill;
+ break;
+#endif
+ case 'x':
extra_arg = strdup(optarg);
break;
case 'S':
@@ -809,7 +826,16 @@ void parse_args(int argc, char *argv[]) {
}
if (_kill || _resume || _suspend || _info) {
- if (daemon_pid_file_kill(_kill ? SIGINT : (_resume ? SIGUSR2 : (_info ? SIGHUP : SIGUSR1))) < 0) {
+ int rv;
+
+#ifdef DAEMON_PID_FILE_KILL_WAIT_AVAILABLE
+ if (_kill && wait_on_kill)
+ rv = daemon_pid_file_kill_wait(SIGINT, 5);
+ else
+#endif
+ rv = daemon_pid_file_kill(_kill ? SIGINT : (_resume ? SIGUSR2 : (_info ? SIGHUP : SIGUSR1)));
+
+ if (rv < 0) {
daemon_log(LOG_ERR, "Failed to kill daemon. (%s)", strerror(errno));
exit(6);
}
@@ -892,7 +918,9 @@ int main(int argc, char* argv[]) {
kill(pid, SIGTERM);
}
-
+ if (c)
+ daemon_log(LOG_ERR, "Daemon failed with error condition #%i. See syslog for details", c);
+
return c;
}
}