Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/networking/ether-wake.c
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/networking/ether-wake.c
r3232 r3621 63 63 * doing so only works with adapters configured for unicast+broadcast Rx 64 64 * filter. That configuration consumes more power. 65 */65 */ 66 66 67 67 //usage:#define ether_wake_trivial_usage 68 //usage: "[-b] [-i iface] [-p aa:bb:cc:dd[:ee:ff]] MAC"68 //usage: "[-b] [-i IFACE] [-p aa:bb:cc:dd[:ee:ff]/a.b.c.d] MAC" 69 69 //usage:#define ether_wake_full_usage "\n\n" 70 70 //usage: "Send a magic packet to wake up sleeping machines.\n" 71 71 //usage: "MAC must be a station address (00:11:22:33:44:55) or\n" 72 72 //usage: "a hostname with a known 'ethers' entry.\n" 73 //usage: "\n -b Send wake-up packet to the broadcast address"74 //usage: "\n -i ifaceInterface to use (default eth0)"75 //usage: "\n -p pass Append four or six byte password PWto the packet"73 //usage: "\n -b Broadcast the packet" 74 //usage: "\n -i IFACE Interface to use (default eth0)" 75 //usage: "\n -p PASSWORD Append four or six byte PASSWORD to the packet" 76 76 77 77 #include "libbb.h" … … 122 122 if (eap) { 123 123 bb_debug_msg("The target station address is %s\n\n", ether_ntoa(eap)); 124 #if !defined(__UCLIBC_MAJOR__) \ 125 || __UCLIBC_MAJOR__ > 0 \ 126 || __UCLIBC_MINOR__ > 9 \ 127 || (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ >= 30) 124 #if !defined(__UCLIBC__) || UCLIBC_VERSION >= KERNEL_VERSION(0, 9, 30) 128 125 } else if (ether_hostton(hostid, eaddr) == 0) { 129 126 bb_debug_msg("Station address for hostname %s is %s\n\n", hostid, ether_ntoa(eaddr)); … … 134 131 } 135 132 136 static int get_fill(unsigned char *pkt, struct ether_addr *eaddr, int broadcast) 133 #define PKT_HEADER_SIZE (20 + 16*6) 134 static int fill_pkt_header(unsigned char *pkt, struct ether_addr *eaddr, int broadcast) 137 135 { 138 136 int i; … … 157 155 } 158 156 159 return 20 + 16*6; /* length of packet */157 return PKT_HEADER_SIZE; /* length of packet */ 160 158 } 161 159 … … 199 197 int s; /* Raw socket */ 200 198 int pktsize; 201 unsigned char outpack[ 1000];199 unsigned char outpack[PKT_HEADER_SIZE + 6 /* max passwd size */ + 16 /* paranoia */]; 202 200 203 201 struct ether_addr eaddr; … … 221 219 222 220 /* fill out the header of the packet */ 223 pktsize = get_fill(outpack, &eaddr, flags /* & 1 OPT_BROADCAST */);221 pktsize = fill_pkt_header(outpack, &eaddr, flags /* & 1 OPT_BROADCAST */); 224 222 225 223 bb_debug_dump_packet(outpack, pktsize);
Note:
See TracChangeset
for help on using the changeset viewer.