From 3a46885c17ba051ced802e3d35b9ddc6bf10edf6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 12 Apr 2004 13:58:11 +0000 Subject: preparation for 0.24 git-svn-id: file:///home/lennart/svn/public/ifplugd/trunk@109 2bf48fe7-cfc1-0310-909f-d9042e1e0fef --- src/ifplugd.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'src/ifplugd.c') diff --git a/src/ifplugd.c b/src/ifplugd.c index 28f1ce5..d9aa708 100644 --- a/src/ifplugd.c +++ b/src/ifplugd.c @@ -19,8 +19,6 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define _GNU_SOURCE - #include #include #include @@ -87,7 +85,7 @@ int disabled = 0; interface_status_t failure_status = IFSTATUS_ERR; -enum { API_AUTO, API_ETHTOOL, API_MII, API_PRIVATE, API_WLAN } api_mode = API_AUTO; +enum { API_AUTO, API_ETHTOOL, API_MII, API_PRIVATE, API_WLAN, API_IFF } api_mode = API_AUTO; interface_status_t (*detect_beat_func)(int, char*); interface_status_t (*cached_detect_beat_func)(int, char*) = NULL; @@ -256,17 +254,23 @@ 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_mii(fd, iface)) != IFSTATUS_ERR) { - cached_detect_beat_func = interface_detect_beat_mii; - daemon_log(LOG_INFO, "Using detection mode: SIOCGMIIPHY"); + 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"); return status; } + + if ((status = interface_detect_beat_mii(fd, iface)) != IFSTATUS_ERR) { + cached_detect_beat_func = interface_detect_beat_mii; + daemon_log(LOG_INFO, "Using detection mode: SIOCGMIIPHY"); + return status; + } if ((status = interface_detect_beat_wlan(fd, iface)) != IFSTATUS_ERR) { cached_detect_beat_func = interface_detect_beat_wlan; @@ -400,7 +404,8 @@ void work(void) { case API_ETHTOOL: detect_beat_func = interface_detect_beat_ethtool; break; case API_MII: detect_beat_func = interface_detect_beat_mii; break; case API_PRIVATE: detect_beat_func = interface_detect_beat_priv; break; - case API_WLAN: detect_beat_func = interface_detect_beat_wlan;break; + case API_WLAN: detect_beat_func = interface_detect_beat_wlan; break; + case API_IFF: detect_beat_func = interface_detect_beat_iff; break; default: detect_beat_func = detect_beat_auto; @@ -609,6 +614,7 @@ void usage(char *p) { case API_MII: m = "mii"; break; case API_PRIVATE: m = "priv"; break; case API_WLAN: m = "wlan"; break; + case API_IFF: m = "iff"; break; default: m = "auto"; } @@ -763,6 +769,7 @@ void parse_args(int argc, char *argv[]) { case 'p': api_mode = API_PRIVATE; break; case 'w': api_mode = API_WLAN; break; case 'a': api_mode = API_AUTO; break; + case 'i': api_mode = API_IFF; break; default: daemon_log(LOG_ERR, "Unknown API mode: %s", optarg); exit(2); -- cgit