From 65c009df1c2b3432cb3686a6a3941965fabcbbfd Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 10 May 2004 21:32:00 +0000 Subject: preliminary work for ifplugd 0.25 git-svn-id: file:///home/lennart/svn/public/ifplugd/trunk@110 2bf48fe7-cfc1-0310-909f-d9042e1e0fef --- configure.ac | 2 +- doc/README.html.in | 9 ++++++++- man/ifplugstatus.8.xml.in | 11 ++++++----- src/ifplugd.c | 12 +++--------- src/ifplugstatus.c | 21 ++++++++++----------- 5 files changed, 28 insertions(+), 27 deletions(-) diff --git a/configure.ac b/configure.ac index c803c43..e435477 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.59) -AC_INIT([ifplugd],[0.24],[mzvscyhtq (at) 0pointer (dot) de]) +AC_INIT([ifplugd],[0.25],[mzvscyhtq (at) 0pointer (dot) de]) AC_CONFIG_SRCDIR([src/ifplugd.c]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([foreign -Wall]) diff --git a/doc/README.html.in b/doc/README.html.in index d0ceace..ae833b5 100644 --- a/doc/README.html.in +++ b/doc/README.html.in @@ -42,6 +42,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

News

+
Mon May 10 2004:

Version 0.25 released, +changes include: Revert to more classic link checking support. The new +checking order is: ETHTOOL, MII, WLAN, IFF. The obsolete API "PRIV" is +no longer checked by the automatic API detection code. However, you may enable +it forcibly by passing -w priv on the command line.

+
Mon Apr 12 2004:

Version 0.24 released, changes include: add IFF_RUNNING link check support and make it the default. This might break some setups. You may workaround this by passing -m to the daemon for selecting a different API. Please report breakages!

@@ -324,7 +331,7 @@ manpage

New! There is a joint ifplugd and waproamd mailing list available.


-
Lennart Poettering <@PACKAGE_BUGREPORT@>, April 2004
+
Lennart Poettering <@PACKAGE_BUGREPORT@>, May 2004
$Id$
diff --git a/man/ifplugstatus.8.xml.in b/man/ifplugstatus.8.xml.in index 684ba02..755d64c 100644 --- a/man/ifplugstatus.8.xml.in +++ b/man/ifplugstatus.8.xml.in @@ -39,13 +39,14 @@

The APIs are tried in the following order:

-

First the cleanest API: IFF_RUNNING (aka ifconfig API)

-

Second the newest API: SIOCETHTOOL (aka ethtool API)

-

Third the next older API: SIOCGMIIREG (aka mii-diag API)

+

First the newest API: SIOCETHTOOL (aka ethtool API)

+

Second the next older API: SIOCGMIIREG (aka mii-diag API)

Than the WLAN API: wireless extension (aka iwconfig API)

-

Finally the oldest API: SIOCPRIV (aka mii-tool API)

+

Followed by the cleanest API: IFF_RUNNING (aka ifconfig API)

-

It may be used in shell script since it returns the +

The oldest API (SIOCPRIV aka mii-tool API) is not tested since it is obsolete.

+ +

ifplugstatus may be used in shell script since it returns the current status as return value. It is especially useful to detect the available APIs on the used network driver. (Option -v)

diff --git a/src/ifplugd.c b/src/ifplugd.c index d9aa708..624d991 100644 --- a/src/ifplugd.c +++ b/src/ifplugd.c @@ -254,12 +254,6 @@ interface_status_t detect_beat_auto(int fd, char *iface) { if (cached_detect_beat_func && (status = cached_detect_beat_func(fd, iface)) != IFSTATUS_ERR) return status; - if ((status = interface_detect_beat_iff(fd, iface)) != IFSTATUS_ERR) { - cached_detect_beat_func = interface_detect_beat_iff; - daemon_log(LOG_INFO, "Using detection mode: IFF_RUNNING"); - return status; - } - if ((status = interface_detect_beat_ethtool(fd, iface)) != IFSTATUS_ERR) { cached_detect_beat_func = interface_detect_beat_ethtool; daemon_log(LOG_INFO, "Using detection mode: SIOCETHTOOL"); @@ -278,9 +272,9 @@ interface_status_t detect_beat_auto(int fd, char *iface) { return status; } - if ((status = interface_detect_beat_priv(fd, iface)) != IFSTATUS_ERR) { - cached_detect_beat_func = interface_detect_beat_priv; - daemon_log(LOG_INFO, "Using detection mode: SIOCDEVPRIVATE"); + if ((status = interface_detect_beat_iff(fd, iface)) != IFSTATUS_ERR) { + cached_detect_beat_func = interface_detect_beat_iff; + daemon_log(LOG_INFO, "Using detection mode: IFF_RUNNING"); return status; } diff --git a/src/ifplugstatus.c b/src/ifplugstatus.c index e4db11b..04c59b9 100644 --- a/src/ifplugstatus.c +++ b/src/ifplugstatus.c @@ -51,11 +51,6 @@ int handle(char *iface) { if (verbose > 0) { printf("%s:\n", iface); - if ((s = interface_detect_beat_iff(fd, iface)) == IFSTATUS_ERR) - printf(" IFF_RUNNING failed.\n"); - else - printf(" IFF_RUNNING: %s\n", s == IFSTATUS_UP ? "link beat detected" : "unplugged"); - if ((s = interface_detect_beat_ethtool(fd, iface)) == IFSTATUS_ERR) printf(" SIOCETHTOOL failed (%s)\n", strerror(errno)); else @@ -71,18 +66,22 @@ int handle(char *iface) { else printf(" Wireless: %s\n", s == IFSTATUS_UP ? "link beat detected" : "unplugged"); + if ((s = interface_detect_beat_iff(fd, iface)) == IFSTATUS_ERR) + printf(" IFF_RUNNING failed.\n"); + else + printf(" IFF_RUNNING: %s\n", s == IFSTATUS_UP ? "link beat detected" : "unplugged"); + if ((s = interface_detect_beat_priv(fd, iface)) == IFSTATUS_ERR) printf(" SIOCDEVPRIVATE failed (%s)\n", strerror(errno)); else printf(" SIOCDEVPRIVATE: %s\n", s == IFSTATUS_UP ? "link beat detected" : "unplugged"); } else { - - if ((s = interface_detect_beat_iff(fd, iface)) == IFSTATUS_ERR) - if ((s = interface_detect_beat_ethtool(fd, iface)) == IFSTATUS_ERR) - if ((s = interface_detect_beat_mii(fd, iface)) == IFSTATUS_ERR) - if ((s = interface_detect_beat_wlan(fd, iface)) == IFSTATUS_ERR) - s = interface_detect_beat_priv(fd, iface); + + if ((s = interface_detect_beat_ethtool(fd, iface)) == IFSTATUS_ERR) + if ((s = interface_detect_beat_mii(fd, iface)) == IFSTATUS_ERR) + if ((s = interface_detect_beat_wlan(fd, iface)) == IFSTATUS_ERR) + s = interface_detect_beat_iff(fd, iface); switch(s) { case IFSTATUS_UP: -- cgit