#include <sys/types.h>
#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <net/if.h>
+
#include <linux/types.h>
#include <linux/if_ether.h> /* ETH_P_ALL */
#include <linux/if_packet.h> /* sockaddr_ll */
-#include <linux/if.h> /* IFNAMSIZ */
static int monitor_init(const char *ifname)
{
return EXIT_FAILURE;
if (verbose)
- fprintf(stdout, "Generating WOL packet for ["MAC_STR"].\n", MAC_ARG2(mac));
+ fprintf(stdout, "Generating %d WOL packet for ["MAC_STR"].\n", num, MAC_ARG2(mac));
prepare_wol(wol_magic_tmpl, mac);
while (num--) {
err = inject_frame(sock, wol_magic_tmpl, sizeof(wol_magic_tmpl));
- if (err < 0)
+ if (err < 0) {
fprintf(stderr, "failed to send WOL packet.\n");
- else if (verbose)
+ break;
+ } else if (verbose) {
fprintf(stdout, "WOL packet sent.\n");
+ }
}
close(sock);