115 |
if (eap) { |
if (eap) { |
116 |
*eaddr = *eap; |
*eaddr = *eap; |
117 |
bb_debug_msg("The target station address is %s\n\n", ether_ntoa(eaddr)); |
bb_debug_msg("The target station address is %s\n\n", ether_ntoa(eaddr)); |
118 |
#if !defined(__UCLIBC__) |
#if !defined(__UCLIBC_MAJOR__) \ |
119 |
|
|| __UCLIBC_MAJOR__ > 0 \ |
120 |
|
|| __UCLIBC_MINOR__ > 9 \ |
121 |
|
|| (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ >= 30) |
122 |
} else if (ether_hostton(hostid, eaddr) == 0) { |
} else if (ether_hostton(hostid, eaddr) == 0) { |
123 |
bb_debug_msg("Station address for hostname %s is %s\n\n", hostid, ether_ntoa(eaddr)); |
bb_debug_msg("Station address for hostname %s is %s\n\n", hostid, ether_ntoa(eaddr)); |
124 |
#endif |
#endif |
167 |
byte_cnt = sscanf(ethoptarg, "%u.%u.%u.%u", |
byte_cnt = sscanf(ethoptarg, "%u.%u.%u.%u", |
168 |
&passwd[0], &passwd[1], &passwd[2], &passwd[3]); |
&passwd[0], &passwd[1], &passwd[2], &passwd[3]); |
169 |
if (byte_cnt < 4) { |
if (byte_cnt < 4) { |
170 |
bb_error_msg("cannot read Wake-On-LAN pass"); |
bb_error_msg("can't read Wake-On-LAN pass"); |
171 |
return 0; |
return 0; |
172 |
} |
} |
173 |
// TODO: check invalid numbers >255?? |
// TODO: check invalid numbers >255?? |
222 |
{ |
{ |
223 |
struct ifreq if_hwaddr; |
struct ifreq if_hwaddr; |
224 |
|
|
225 |
strncpy(if_hwaddr.ifr_name, ifname, sizeof(if_hwaddr.ifr_name)); |
strncpy_IFNAMSIZ(if_hwaddr.ifr_name, ifname); |
226 |
ioctl_or_perror_and_die(s, SIOCGIFHWADDR, &if_hwaddr, "SIOCGIFHWADDR on %s failed", ifname); |
ioctl_or_perror_and_die(s, SIOCGIFHWADDR, &if_hwaddr, "SIOCGIFHWADDR on %s failed", ifname); |
227 |
|
|
228 |
memcpy(outpack+6, if_hwaddr.ifr_hwaddr.sa_data, 6); |
memcpy(outpack+6, if_hwaddr.ifr_hwaddr.sa_data, 6); |
258 |
#if defined(PF_PACKET) |
#if defined(PF_PACKET) |
259 |
{ |
{ |
260 |
struct ifreq ifr; |
struct ifreq ifr; |
261 |
strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); |
strncpy_IFNAMSIZ(ifr.ifr_name, ifname); |
262 |
xioctl(s, SIOCGIFINDEX, &ifr); |
xioctl(s, SIOCGIFINDEX, &ifr); |
263 |
memset(&whereto, 0, sizeof(whereto)); |
memset(&whereto, 0, sizeof(whereto)); |
264 |
whereto.sll_family = AF_PACKET; |
whereto.sll_family = AF_PACKET; |