logoalt Hacker News

ysleepytoday at 5:29 PM3 repliesview on HN

I was kinda hoping to get the nitty gritty of how the NIC does the packet matching, how, it wakes up the system via PCIe and how switches route the frames to the port which has/had the client.

Nothing against the article though, but maybe someone knows a good writeup.


Replies

jonah-archivetoday at 5:51 PM

The original paper proposing the technology is actually very good (and surprisingly still online!): https://www.amd.com/content/dam/amd/en/documents/archived-te...

show 3 replies
ErroneousBoshtoday at 8:11 PM

Shift registers. It's all done with shift registers.

Terr_today at 6:15 PM

Ditto, I clicked and was disappointed.

"How to send a magic packet in $LANG" isn't very interesting to me. There are plenty of guides for it, and I remember actually doing it 20+ years ago with a short PHP script.

Even at the time, the task didn't seem like "enough" for a show-the-world blog post. A dramatically shortened version (no validation, error handling, logging, etc.) for your amusement:

    // Given $macAddress and $addr and $port
    $macAddress = str_replace(":","",$macAddress);
    $macAddress = str_replace("-","",$macAddress);

    $header = pack('H12','FFFFFFFFFFFF');
    $payload = pack("H12",$macAddress);
    $packet = $header . str_repeat($payload,16);

    $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
    socket_set_option($sock, 1, 6, TRUE);
    socket_sendto($sock, $payload, strlen($payload), 0, $addr, $port);
    socket_close($sock);
show 1 reply