From bf2ecf30834e06e1c0434b114c4a402f8493e0dc Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Sun, 6 Aug 2017 20:03:36 -0400 Subject: Add wake That payload can appear anywhere within an ethernet frame. Wake-on-LAN is funny. --- curtis/.bin/wake.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 curtis/.bin/wake.c (limited to 'curtis') diff --git a/curtis/.bin/wake.c b/curtis/.bin/wake.c new file mode 100755 index 00000000..2f314975 --- /dev/null +++ b/curtis/.bin/wake.c @@ -0,0 +1,41 @@ +#if 0 +exec cc -Wall -Wextra -Wpedantic $@ -o $(dirname $0)/wake $0 +#endif + +#include +#include +#include +#include +#include +#include + +#define MAC 0x04, 0x7D, 0x7B, 0xD5, 0x6A, 0x53 + +const uint8_t payload[] = { + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + MAC, MAC, MAC, MAC, MAC, MAC, MAC, MAC, + MAC, MAC, MAC, MAC, MAC, MAC, MAC, MAC, +}; + +int main() { + int sock = socket(PF_INET, SOCK_DGRAM, 0); + if (sock < 0) err(EX_OSERR, "socket"); + + int on = 1; + int error = setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on)); + if (error) err(EX_OSERR, "setsockopt"); + + struct sockaddr_in addr = { + .sin_family = AF_INET, + .sin_port = 9, + .sin_addr.s_addr = INADDR_BROADCAST, + }; + + ssize_t len = sendto( + sock, payload, sizeof(payload), 0, + (struct sockaddr *)&addr, sizeof(addr) + ); + if (len < 0) err(EX_IOERR, "sendto"); + + return EX_OK; +} -- cgit 1.4.1 rm class='right' method='get' action='/cgit-pink/log/ui-ssdiff.h'>
Commit message (Expand)Author
2013-05-28ui-summary: do not free refJason A. Donenfeld
2013-05-28filters: toggle perl utf8 situationJason A. Donenfeld
2013-05-27CGIT-0.9.2Jason A. Donenfeld
2013-05-27README: add trailing slash to homepageJason A. Donenfeld
2013-05-27cgitrc.5: improve example configJason A. Donenfeld
2013-05-27filters: import more modern scriptsJason A. Donenfeld
2013-05-26readme: use string_list instead of space deliminationsJason A. Donenfeld
2013-05-25ui-summary: Disallow directory traversalJason A. Donenfeld
2013-05-25cgitrc.5: information on directory traversal and multiple readme filesJason A. Donenfeld
2013-05-25readme: Accept multiple candidates and test them.Jason A. Donenfeld
2013-05-25ui-summary: Pass filename to about-filterJason A. Donenfeld
2013-05-25ui-summary: Use default branch for readme if : prefixJason A. Donenfeld
2013-05-25cgit.c: Do not reset HOME after unsetting it.Jason A. Donenfeld
2013-05-25cgit.c: sync repo config printing with struct cgit_repoJason A. Donenfeld
2013-05-25git: update to 1.8.3John Keeping
2013-05-22cache.c: cache ls_cache output properlyJohn Keeping
2013-05-22tests: introduce strip_header() helper functionJohn Keeping
2013-05-22shared.c: use die_errno() where appropriateJohn Keeping
2013-05-22html.c: die when write failsJohn Keeping
2013-05-22ui-log: add <span/> around commit decorationsJohn Keeping
2013-05-22Makefile: fix parallel "make test"John Keeping
2013-05-18cache.c: fix cache_lsJohn Keeping
2013-05-13t0109: "function" is a bash-ismJohn Keeping
2013-05-13New mailing list.Jason A. Donenfeld
2013-04-30ui-snapshot: do not access $HOMEJason A. Donenfeld
2013-04-27t0001: validate Git -rcN version numbers correctlyJohn Keeping
2013-04-27git: update to 1.8.2.2John Keeping
2013-04-17scan-tree: fix regression in section-from-path=-1John Keeping
2013-04-15t0001: ignore ".dirty" suffix on Git versionJohn Keeping
2013-04-15tests: set TEST_OUTPUT_DIRECTORY to the CGit test directoryJohn Keeping
2013-04-15t0109: test more URLsJohn Keeping
2013-04-10cgitrc.5.txt: Specify when scan-path must be defined before.Jason A. Donenfeld
2013-04-10ui-snapshot.c: Prepend "V" when guessing ref namesLukas Fleischer
2013-04-10t0107: Skip ZIP tests if unzip(1) isn't availableLukas Fleischer
2013-04-10tests/: Do not use `sed -i`Lukas Fleischer
2013-04-10Add branch-sort and repo.branch-sort options.Jason A. Donenfeld
2013-04-10t0109: chain operations with &&John Keeping
2013-04-10cgit.c: Do not restore unset environment variablesLukas Fleischer
2013-04-09t0107: Use `tar -z` for gzip'ed archivesLukas Fleischer