Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 04 Jan 2000 11:36:34 -0800
From:      Matthew Reimer <mreimer@vpop.net>
To:        freebsd-hackers@freebsd.org
Subject:   Porting ether-wake.c from Linux
Message-ID:  <38724BC2.767E9055@vpop.net>

next in thread | raw e-mail | index | archive | help
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?

Matt


        /* Note: PF_INET, SOCK_DGRAM, IPPROTO_UDP would allow
SIOCGIFHWADDR to
           work as non-root, but we need SOCK_PACKET to specify the
Ethernet
           destination address. */
        if ((s = socket(AF_INET, SOCK_PACKET, SOCK_PACKET)) < 0) {
                if (errno == EPERM)
                        fprintf(stderr, "ether-wake must run as
root\n");
                else
                        perror("ether-wake: socket");
                if (! debug)
                        return 2;


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?38724BC2.767E9055>