X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=tools%2Fsrc%2Fwol.c;h=f2bd51b2208f20e4eb488c27fc65eba6d1557236;hb=ca8d501af4011c67698def199c7608c911d85a9c;hp=f2c95d83d2aef53210ee2ec7aa91c67b3fb860c4;hpb=2e97681ac255d63a072b8b78366b5e349eb31bae;p=carl9170fw.git diff --git a/tools/src/wol.c b/tools/src/wol.c index f2c95d8..f2bd51b 100644 --- a/tools/src/wol.c +++ b/tools/src/wol.c @@ -25,10 +25,12 @@ #include #include +#include +#include + #include #include /* ETH_P_ALL */ #include /* sockaddr_ll */ -#include /* IFNAMSIZ */ static int monitor_init(const char *ifname) { @@ -187,16 +189,18 @@ int main(int argc, char **args) 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);