summaryrefslogtreecommitdiff
path: root/networking/ifplugd.c
diff options
context:
space:
mode:
authorDenys Vlasenko2009-05-01 09:04:25 +0200
committerDenys Vlasenko2009-05-01 09:04:25 +0200
commit9c35a1cfb642c1d02cdfdc2290d9310606bdd72f (patch)
tree57965b1c8a01526471a67f249462ecc08a9ad72a /networking/ifplugd.c
parent44d1989997a9546d587921cf792f68040fac882c (diff)
downloadbusybox-9c35a1cfb642c1d02cdfdc2290d9310606bdd72f.zip
busybox-9c35a1cfb642c1d02cdfdc2290d9310606bdd72f.tar.gz
ifplugd: fix warnings
Diffstat (limited to 'networking/ifplugd.c')
-rw-r--r--networking/ifplugd.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/networking/ifplugd.c b/networking/ifplugd.c
index c9f603f..62bc9d6 100644
--- a/networking/ifplugd.c
+++ b/networking/ifplugd.c
@@ -9,6 +9,7 @@
#include "libbb.h"
#include <linux/if.h>
+#include <linux/mii.h>
#include <linux/ethtool.h>
#include <net/ethernet.h>
#include <linux/netlink.h>
@@ -310,6 +311,7 @@ static void maybe_up_new_iface(void)
static smallint detect_link_mii(void)
{
struct ifreq ifreq;
+ struct mii_ioctl_data *mii = (void *)&ifreq.ifr_data;
set_ifreq_to_ifname(&ifreq);
@@ -318,20 +320,20 @@ static smallint detect_link_mii(void)
return IFSTATUS_ERR;
}
- ((unsigned short*)&ifreq.ifr_data)[1] = 1;
+ mii->reg_num = 1;
if (network_ioctl(SIOCGMIIREG, &ifreq) < 0) {
bb_perror_msg("SIOCGMIIREG failed");
return IFSTATUS_ERR;
}
- return (((unsigned short*)&ifreq.ifr_data)[3] & 0x0004) ?
- IFSTATUS_UP : IFSTATUS_DOWN;
+ return (mii->val_out & 0x0004) ? IFSTATUS_UP : IFSTATUS_DOWN;
}
static smallint detect_link_priv(void)
{
struct ifreq ifreq;
+ struct mii_ioctl_data *mii = (void *)&ifreq.ifr_data;
set_ifreq_to_ifname(&ifreq);
@@ -340,15 +342,14 @@ static smallint detect_link_priv(void)
return IFSTATUS_ERR;
}
- ((unsigned short*) &ifreq.ifr_data)[1] = 1;
+ mii->reg_num = 1;
if (network_ioctl(SIOCDEVPRIVATE+1, &ifreq) < 0) {
bb_perror_msg("SIOCDEVPRIVATE+1 failed");
return IFSTATUS_ERR;
}
- return (((unsigned short*)&ifreq.ifr_data)[3] & 0x0004) ?
- IFSTATUS_UP : IFSTATUS_DOWN;
+ return (mii->val_out & 0x0004) ? IFSTATUS_UP : IFSTATUS_DOWN;
}
static smallint detect_link_ethtool(void)
@@ -591,6 +592,7 @@ static NOINLINE int netlink_open(void)
return fd;
}
+#if ENABLE_FEATURE_PIDFILE
static NOINLINE pid_t read_pid(const char *filename)
{
int len;
@@ -604,6 +606,7 @@ static NOINLINE pid_t read_pid(const char *filename)
}
return 0;
}
+#endif
int ifplugd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int ifplugd_main(int argc UNUSED_PARAM, char **argv)