Date: Tue, 4 Jan 100 16:06:54 -0500 (EST) From: Bill Paul <wpaul@skynet.ctr.columbia.edu> To: mreimer@vpop.net (Matthew Reimer) Cc: hackers@freebsd.org Subject: Re: Porting ether-wake.c from Linux Message-ID: <200001042106.QAA06130@skynet.ctr.columbia.edu> In-Reply-To: <38724BC2.767E9055@vpop.net> from "Matthew Reimer" at Jan 4, 0 11:36:34 am
next in thread | previous in thread | raw e-mail | index | archive | help
Of all the gin joints in all the towns in all the world, Matthew Reimer had to walk into mine and say: > Does anyone have suggestions on how to port Donald Becker's ether-wake.c > from Linux (ftp://cesdis.gsfc.nasa.gov/pub/linux/misc/ether-wake.c)? > It's a little utility to send a Magic Packet to wake a machine (i.e., > Wake on LAN). > > I think the trick is being able to specify the ethernet address from > userland. ether-wake.c uses Linux's socket type SOCK_PACKET. What's an > equivalent way to do this with FreeBSD? BPF. Yes, you can write to BPF descriptors too, that's how rarpd works. (No, SOCK_RAW won't work: it doesn't let you specify the ethernet frame header, only the IP/TCP/UDP headers.) Now, if you want to not only send raw ethernet frames but also send them with arbitrary origin addresses (i.e. an address other than the host's actual station address), then you need to use the magic pseudo_AF_HDRCMPLT flag. (Uhm... though I don't remember how.) It's not clear if you need this or not (I don't think you do), but if you do, now you know. -Bill -- ============================================================================= -Bill Paul (212) 854-6020 | System Manager, Master of Unix-Fu Work: wpaul@ctr.columbia.edu | Center for Telecommunications Research Home: wpaul@skynet.ctr.columbia.edu | Columbia University, New York City ============================================================================= "It is not I who am crazy; it is I who am mad!" - Ren Hoek, "Space Madness" ============================================================================= To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001042106.QAA06130>