Lines 160-167
Link Here
|
160 |
ssize_t len; |
160 |
ssize_t len; |
161 |
int i; |
161 |
int i; |
162 |
(void)memset(pkt.hdr.ether_dhost, 0xff, sizeof(pkt.hdr.ether_dhost)); |
162 |
/* Be useful */ |
163 |
pkt.hdr.ether_type = htons(0); |
163 |
printf("Sending magic packet to "); |
|
|
164 |
for(i = 0; i < ETHER_ADDR_LEN - 1; i++) |
165 |
printf("%.2X:", addr->octet[i]); |
166 |
printf("%.2X\n", addr->octet[ETHER_ADDR_LEN-1]); |
167 |
|
168 |
/* The packet MUST be sent to the target MAC address */ |
169 |
memcpy(pkt.hdr.ether_dhost, addr, ETHER_ADDR_LEN); |
170 |
|
171 |
/* EtherType 0x0842 is at least semi-recognizable for WOL */ |
172 |
pkt.hdr.ether_type = htons(0x0842); |
173 |
|
164 |
(void)memset(pkt.data, 0xff, SYNC_LEN); |
174 |
(void)memset(pkt.data, 0xff, SYNC_LEN); |
165 |
for (p = pkt.data + SYNC_LEN, i = 0; i < DESTADDR_COUNT; |
175 |
for (p = pkt.data + SYNC_LEN, i = 0; i < DESTADDR_COUNT; |
166 |
p += ETHER_ADDR_LEN, i++) |
176 |
p += ETHER_ADDR_LEN, i++) |