From 6abfd933e73966931fb37471f15f91ffc42c23b6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 17 Oct 2003 00:09:23 +0000 Subject: many fixes git-svn-id: file:///home/lennart/svn/public/ifplugd/trunk@52 2bf48fe7-cfc1-0310-909f-d9042e1e0fef --- configure.ac | 4 +- doc/README.html.in | 55 ++++++++++++--------- man/Makefile.am | 4 +- man/ifplugd.8.xml.in | 4 +- man/ifplugd.conf.5.xml.in | 4 +- man/ifstatus.8.xml.in | 4 +- man/man.css | 30 ------------ man/man.xsl | 120 ---------------------------------------------- man/xmltoman.css | 30 ++++++++++++ man/xmltoman.xsl | 120 ++++++++++++++++++++++++++++++++++++++++++++++ src/ifplugd.c | 13 +++-- 11 files changed, 199 insertions(+), 189 deletions(-) delete mode 100644 man/man.css delete mode 100644 man/man.xsl create mode 100644 man/xmltoman.css create mode 100644 man/xmltoman.xsl diff --git a/configure.ac b/configure.ac index 24e03e5..82b583d 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.17b], [mzvscyhtq (at) 0pointer (dot) de]) +AC_INIT([ifplugd], [0.18], [mzvscyhtq (at) 0pointer (dot) de]) AC_CONFIG_SRCDIR([src/ifplugd.c]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([foreign -Wall]) @@ -36,7 +36,7 @@ if test "x$GCC" = "xyes" ; then CFLAGS="$CFLAGS -pipe -Wall" fi -if test -d /usr/local/stow ; then +if type -p stow > /dev/null && test -d /usr/local/stow ; then AC_MSG_NOTICE([*** Found /usr/local/stow: installing to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***]) AC_PREFIX_DEFAULT([/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}]) fi diff --git a/doc/README.html.in b/doc/README.html.in index ca9d27e..b3f0b4d 100644 --- a/doc/README.html.in +++ b/doc/README.html.in @@ -1,4 +1,4 @@ - + @@ -42,6 +42,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

News

+
Fri Oct 17 2003:

Version +0.18 released, changes include: Some bugs fixed

+
Fri Sep 13 2003:

Version 0.17b released, changes include: typo and date fix

@@ -70,10 +74,10 @@ suspending/resuming, many fixes

configure your ethernet device when a cable is plugged in and automatically unconfigure it if the cable is pulled. This is useful on laptops with onboard network adapters, since it will only configure -the interface when a cable is really connected. +the interface when a cable is really connected.

-

ifplugd is a rather simplistic approach to this target since it relies -on your distribution's native interface configuration system.

+

ifplugd ifplugd interfaces with your distribution's native network + configuration utilities.

Some features:

@@ -89,11 +93,12 @@ on your distribution's native interface configuration system.

  • Syslog support
  • -
  • Simplistic C source code, just 19k binary (+11k for libdaemon)
  • +
  • Small program - the binary is just 19 KB (plus 11 KB for libdaemon).
  • Multiple ethernet interface support
  • -
  • May ignore short unplugged whiles (-d option) or plugged whiles (-u +
  • Can be configured to ignore short "unplugged" periods + (-d option) or short "plugged" periods(-u option)
  • Support for wireless networking. Whenever an AP is detected the @@ -104,17 +109,17 @@ network is configured.
  • Status

    -

    Version 0.14 is stable and has all the sensible features its users could think of.

    +

    Version @PACKAGE_VERSION@ is stable and has all the sensible features its users could think of.

    Documentation

    -

    Have a look on the man pages ifplugd(8), ifstatus(8), ifplugd.conf(5). (A XSLT capable browser is required)

    +

    Have a look on the man pages ifplugd(8), ifstatus(8), ifplugd.conf(5). (An XSLT capable browser is required)

    Configuration

    Edit /etc/ifplugd/ifplugd.conf for configuration changes. This file is a bourne shell script sourced by the init script -and used to generate a suiting command line. You may specify more than +and used to start ifplugd with appropriate arguments. You may specify more than one ethernet interface in INTERFACES. For each interface a seperate instance of ifplugd is spawned. The arguments specified in ARGS are append to ifplugd's command line. Have a look on @@ -123,10 +128,11 @@ about the available options.

    The network interface which is controlled by ifplugd should not be configured automatically by your distribution's network -subsystem, since ifplugd will do this for you if needed. On -Debian remove interface names beginning with eth or -wlan from the auto option line in -/etc/network/interfaces.

    +subsystem, since ifplugd will do this for you if needed. + +

    On Debian systems, any interfaces named in ifplugd's +INTERFACES environment variable should not also be listed in +an "auto" stanza in /etc/network/interfaces.

    Troubleshooting

    @@ -147,11 +153,11 @@ detect the network cable for a short period of time before and after the suspend. When using the -f switch, this will be treated as "no link beat", thus the network is shutdown after a timeout. During this timeout the machine changes to suspended -state. When it is resumed again, the timeout will be run out, the -network is deconfigured, however, as the next cable detection -succeeds, the network is configured again immediately. To fix this -problem, ifplugd should be disabled before the APM suspend -and enabled back after the suspend. This may be done by using +state. When it is resumed again, the timeout period will have expired +and so the network is deconfigured, however, as the next cable +detection succeeds, the network is configured again immediately. To +fix this problem, ifplugd should be disabled before the APM +suspend and enabled back after the suspend. This may be done by using apmd and adding a script to /etc/apm/{suspend,resume}.d which simply calls /etc/init.d/ifplugd suspend, resp. /etc/init.d/ifplugd @@ -213,8 +219,13 @@ exist on
  • Q: There are already laptop-net's ifd and miid, why did you write your own daemon?

    -

    A: laptop-net simply sucks and I didn't know of miid when I wrote - ifplugd. However, ifplugd is far better than miid. For a +

    A: laptop-net was too integrated with its profile +system and didn't work on my hardware when I had a look on it. It +seemed easier to me to write a simple but feature complete replacement +than using laptop-net without most of the special features disabled. I +didn't know about miid when I wrote + ifplugd, but in any case ifplugd is much better +than miid. For a comparison of miid and ifplugd, have a look on http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=162763&repeatmerged=yes

  • @@ -260,7 +271,7 @@ on their source codes for learning how to use the link beat ioctls.

    Oliver Kurth for packaging ifplugd for Debian and ifplugd's manpage

    -

    Asgeir Nilsen, Sean Reifschneider, R. Steve McKown, David Mitchell for patches

    +

    Thomas Hood, Asgeir Nilsen, Sean Reifschneider, R. Steve McKown, David Mitchell for patches

    Frederic Lepied for integrating ifplugd into Mandrake Linux

    @@ -277,7 +288,7 @@ manpage

    Packages for Mandrake Linux may be found in the Cooker distribution; Gentoo packages are available as well


    -
    Lennart Poettering <@PACKAGE_BUGREPORT@>, July 2003
    +
    Lennart Poettering <@PACKAGE_BUGREPORT@>, October 2003
    $Id$
    diff --git a/man/Makefile.am b/man/Makefile.am index 742e3bf..b6e4c3a 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am 22 2003-06-15 16:36:33Z lennart $ +# $Id$ # This file is part of ifplugd. # @@ -20,7 +20,7 @@ man_MANS = ifplugd.8 ifplugd.conf.5 ifstatus.8 noinst_DATA = ifplugd.8.xml ifplugd.conf.5.xml ifstatus.8.xml -EXTRA_DIST = $(man_MANS) ifplugd.8.xml.in ifplugd.conf.5.xml.in ifstatus.8.xml.in man.css man.xsl +EXTRA_DIST = $(man_MANS) ifplugd.8.xml.in ifplugd.conf.5.xml.in ifstatus.8.xml.in xmltoman.css xmltoman.xsl CLEANFILES = ifplugd.8.xml ifplugd.conf.5.xml ifstatus.8.xml diff --git a/man/ifplugd.8.xml.in b/man/ifplugd.8.xml.in index d259608..dbb2255 100644 --- a/man/ifplugd.8.xml.in +++ b/man/ifplugd.8.xml.in @@ -1,6 +1,6 @@ - - + + diff --git a/man/ifplugd.conf.5.xml.in b/man/ifplugd.conf.5.xml.in index 563a489..0728701 100644 --- a/man/ifplugd.conf.5.xml.in +++ b/man/ifplugd.conf.5.xml.in @@ -1,6 +1,6 @@ - - + + diff --git a/man/ifstatus.8.xml.in b/man/ifstatus.8.xml.in index 61b246a..bbcf14b 100644 --- a/man/ifstatus.8.xml.in +++ b/man/ifstatus.8.xml.in @@ -1,6 +1,6 @@ - - + + diff --git a/man/man.css b/man/man.css deleted file mode 100644 index 0892e4f..0000000 --- a/man/man.css +++ /dev/null @@ -1,30 +0,0 @@ -/* $Id$ */ - -/*** - This file is part of ifplugd. - - ifplugd 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. - - ifplugd 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 ifplugd; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -***/ - -body { color: black; background-color: white; margin: 0.5cm; } -a:link, a:visited { color: #900000; } -h1 { text-transform:uppercase; font-size: 18pt; color: #00009F; } -p { margin-left:1cm; margin-right:1cm; } -.cmd { font-family:monospace; } -.file { font-family:monospace; } -.arg { text-transform:uppercase; font-family:monospace; font-style: italic; } -.opt { font-family:monospace; font-weight: bold; } -.manref { font-family:monospace; } -.option .optdesc { margin-left:2cm; } diff --git a/man/man.xsl b/man/man.xsl deleted file mode 100644 index e633de1..0000000 --- a/man/man.xsl +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - - - - - - <xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>) - - - - -

    Name

    -

    - - - - -

    - - - -
    - - -

    - -

    -
    - - -

    - -

    -
    - - - - - - - - - - - - - - -
    - -
    -
    - - -

    Synopsis

    - -
    - - -

    Synopsis

    - -
    - - -

    Description

    - -
    - - -

    Options

    - -
    - - -

    - -
    - - -
    -
    - - - - - () - - - () - - - - - - - - -
    diff --git a/man/xmltoman.css b/man/xmltoman.css new file mode 100644 index 0000000..0892e4f --- /dev/null +++ b/man/xmltoman.css @@ -0,0 +1,30 @@ +/* $Id$ */ + +/*** + This file is part of ifplugd. + + ifplugd 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. + + ifplugd 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 ifplugd; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +***/ + +body { color: black; background-color: white; margin: 0.5cm; } +a:link, a:visited { color: #900000; } +h1 { text-transform:uppercase; font-size: 18pt; color: #00009F; } +p { margin-left:1cm; margin-right:1cm; } +.cmd { font-family:monospace; } +.file { font-family:monospace; } +.arg { text-transform:uppercase; font-family:monospace; font-style: italic; } +.opt { font-family:monospace; font-weight: bold; } +.manref { font-family:monospace; } +.option .optdesc { margin-left:2cm; } diff --git a/man/xmltoman.xsl b/man/xmltoman.xsl new file mode 100644 index 0000000..e633de1 --- /dev/null +++ b/man/xmltoman.xsl @@ -0,0 +1,120 @@ + + + + + + + + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + + + + + + <xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>) + + + + +

    Name

    +

    + + - + +

    + + + +
    + + +

    + +

    +
    + + +

    + +

    +
    + + + + + + + + + + + + + + +
    + +
    +
    + + +

    Synopsis

    + +
    + + +

    Synopsis

    + +
    + + +

    Description

    + +
    + + +

    Options

    + +
    + + +

    + +
    + + +
    +
    + + + + + () + + + () + + + + + + + + +
    diff --git a/src/ifplugd.c b/src/ifplugd.c index 18c883b..322870f 100644 --- a/src/ifplugd.c +++ b/src/ifplugd.c @@ -221,8 +221,6 @@ int action(interface_status_t status) { daemon_log(LOG_WARNING, "Killing child."); kill(pid, SIGTERM); } - - break; } } @@ -579,7 +577,7 @@ void work(void) { } cleanup: - if (!no_shutdown_script && status == IFSTATUS_UP) { + if (!no_shutdown_script && (status == IFSTATUS_UP || (status == IFSTATUS_DOWN && t))) { setenv(IFPLUGD_ENV_PREVIOUS, strstatus(status), 1); setenv(IFPLUGD_ENV_CURRENT, strstatus(-1), 1); action(IFSTATUS_DOWN); @@ -833,12 +831,13 @@ void parse_args(int argc, char *argv[]) { if (_check) { pid_t pid = daemon_pid_file_is_running(); - if (pid == (pid_t) -1) + if (pid == (pid_t) -1 || pid == 0) { printf("ifplugd not running.\n"); - else + exit(255); + } else { printf("ifplugd process for device %s running as pid %u.\n", interface, pid); - - exit(pid == 0 ? 255 : 0); + exit(0); + } } } -- cgit