Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/networking/ifplugd.c
- Timestamp:
- Jan 1, 2014, 12:47:38 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mindi-busybox/networking/ifplugd.c
r2725 r3232 7 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 8 */ 9 10 //usage:#define ifplugd_trivial_usage 11 //usage: "[OPTIONS]" 12 //usage:#define ifplugd_full_usage "\n\n" 13 //usage: "Network interface plug detection daemon\n" 14 //usage: "\n -n Don't daemonize" 15 //usage: "\n -s Don't log to syslog" 16 //usage: "\n -i IFACE Interface" 17 //usage: "\n -f/-F Treat link detection error as link down/link up" 18 //usage: "\n (otherwise exit on error)" 19 //usage: "\n -a Don't up interface at each link probe" 20 //usage: "\n -M Monitor creation/destruction of interface" 21 //usage: "\n (otherwise it must exist)" 22 //usage: "\n -r PROG Script to run" 23 //usage: "\n -x ARG Extra argument for script" 24 //usage: "\n -I Don't exit on nonzero exit code from script" 25 //usage: "\n -p Don't run \"up\" script on startup" 26 //usage: "\n -q Don't run \"down\" script on exit" 27 //usage: "\n -l Always run script on startup" 28 //usage: "\n -t SECS Poll time in seconds" 29 //usage: "\n -u SECS Delay before running script after link up" 30 //usage: "\n -d SECS Delay after link down" 31 //usage: "\n -m MODE API mode (mii, priv, ethtool, wlan, iff, auto)" 32 //usage: "\n -k Kill running daemon" 33 9 34 #include "libbb.h" 10 35 … … 13 38 #include <linux/mii.h> 14 39 #include <linux/ethtool.h> 15 #include <net/ethernet.h> 40 #ifdef HAVE_NET_ETHERNET_H 41 # include <net/ethernet.h> 42 #endif 16 43 #include <linux/netlink.h> 17 44 #include <linux/rtnetlink.h> … … 132 159 static smallint detect_link_mii(void) 133 160 { 134 struct ifreq ifreq; 135 struct mii_ioctl_data *mii = (void *)&ifreq.ifr_data; 136 137 set_ifreq_to_ifname(&ifreq); 138 139 if (network_ioctl(SIOCGMIIPHY, &ifreq, "SIOCGMIIPHY") < 0) { 161 /* char buffer instead of bona-fide struct avoids aliasing warning */ 162 char buf[sizeof(struct ifreq)]; 163 struct ifreq *const ifreq = (void *)buf; 164 165 struct mii_ioctl_data *mii = (void *)&ifreq->ifr_data; 166 167 set_ifreq_to_ifname(ifreq); 168 169 if (network_ioctl(SIOCGMIIPHY, ifreq, "SIOCGMIIPHY") < 0) { 140 170 return IFSTATUS_ERR; 141 171 } … … 143 173 mii->reg_num = 1; 144 174 145 if (network_ioctl(SIOCGMIIREG, &ifreq, "SIOCGMIIREG") < 0) {175 if (network_ioctl(SIOCGMIIREG, ifreq, "SIOCGMIIREG") < 0) { 146 176 return IFSTATUS_ERR; 147 177 } … … 152 182 static smallint detect_link_priv(void) 153 183 { 154 struct ifreq ifreq; 155 struct mii_ioctl_data *mii = (void *)&ifreq.ifr_data; 156 157 set_ifreq_to_ifname(&ifreq); 158 159 if (network_ioctl(SIOCDEVPRIVATE, &ifreq, "SIOCDEVPRIVATE") < 0) { 184 /* char buffer instead of bona-fide struct avoids aliasing warning */ 185 char buf[sizeof(struct ifreq)]; 186 struct ifreq *const ifreq = (void *)buf; 187 188 struct mii_ioctl_data *mii = (void *)&ifreq->ifr_data; 189 190 set_ifreq_to_ifname(ifreq); 191 192 if (network_ioctl(SIOCDEVPRIVATE, ifreq, "SIOCDEVPRIVATE") < 0) { 160 193 return IFSTATUS_ERR; 161 194 } … … 163 196 mii->reg_num = 1; 164 197 165 if (network_ioctl(SIOCDEVPRIVATE+1, &ifreq, "SIOCDEVPRIVATE+1") < 0) {198 if (network_ioctl(SIOCDEVPRIVATE+1, ifreq, "SIOCDEVPRIVATE+1") < 0) { 166 199 return IFSTATUS_ERR; 167 200 } … … 519 552 520 553 #if ENABLE_FEATURE_PIDFILE 521 pidfile_name = xasprintf( _PATH_VARRUN"ifplugd.%s.pid", G.iface);554 pidfile_name = xasprintf(CONFIG_PID_FILE_PATH "/ifplugd.%s.pid", G.iface); 522 555 pid_from_pidfile = read_pid(pidfile_name); 523 556
Note:
See TracChangeset
for help on using the changeset viewer.