Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardobranco777 committed Feb 18, 2024
1 parent c08e3a6 commit 09a8b7c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions wol.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ xdigit (char c)
if (c >= '0' && c <= '9')
return (c - '0');
else if (c >= 'A' && c <= 'F')
return (c - 'A');
return (10 + c - 'A');
else if (c >= 'a' && c <= 'f')
return (c - 'a');
return (10 + c - 'a');
return -1;
}

Expand Down Expand Up @@ -73,6 +73,9 @@ wake_on_lan(const char *mac_address) {
if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &(int){1}, sizeof(int)) < 0)
err(1, "%s", "setsockopt");

printf("Sending to %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);

for (int i = 0; i < MAX_TRIES; ++i)
if (sendto(sock, payload, sizeof(payload), 0, (struct sockaddr*)&sa, sizeof(sa)) < 0)
err(1, "sendto");
Expand Down

0 comments on commit 09a8b7c

Please sign in to comment.