From owner-svn-src-all@FreeBSD.ORG Tue Jun 30 22:40:52 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE3AA106564A; Tue, 30 Jun 2009 22:40:52 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 59A128FC28; Tue, 30 Jun 2009 22:40:52 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n5UMdipB023433; Tue, 30 Jun 2009 16:39:44 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 30 Jun 2009 16:40:09 -0600 (MDT) Message-Id: <20090630.164009.2130804684.imp@bsdimp.com> To: marc@msys.ch From: "M. Warner Losh" In-Reply-To: <7B9C309F-63E3-4CB8-9871-DE2DEE010096@msys.ch> References: <0E6D4FB2-A485-40ED-A856-ACC311A90EFE@msys.ch> <20090630.141340.289711551.imp@bsdimp.com> <7B9C309F-63E3-4CB8-9871-DE2DEE010096@msys.ch> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, mbr@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r195200 - in head/usr.sbin: . wake X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 22:40:53 -0000 In message: <7B9C309F-63E3-4CB8-9871-DE2DEE010096@msys.ch> Marc Balmer writes: : : Am 30.06.2009 um 22:13 schrieb M. Warner Losh: : : > In message: <0E6D4FB2-A485-40ED-A856-ACC311A90EFE@msys.ch> : > Marc Balmer writes: : > : : > : Am 30.06.2009 um 21:36 schrieb M. Warner Losh: : > : : > : > wake really is too generic a name for this. Why didn't the wol : > port : > : > get committed anyway, it seems to be better than this... : > : : > : wake is a short, mnemonic and imperative name that describes what : > the : > : command does. It is exactly the same command as in NetBSD. : > : > And the discussions in the NetBSD src discussion mailing lists have : > resolved the issue with finality? : : well, yes. the name stays, as martin put it so correctly "the one : who does : the work chooses the name". And we use this name since 2006 on various : OSs. And I think it is not a weak name, I can not think of any other : sensible : use of this command name, really. That's a crock. You're rushing things into FreeBSD before they have even been settled in NetBSD using NetBSD as a justification? I wouldn't call that playing well with others. Especially since there was no socialization of this issue within FreeBSD before the commit. I didn't see any discussion about this at all. You can't dictate to the community: you have to convince them through sound technical argument. One that you've not made. I hate to be blunt, but this leaves a bad taste in everybody's mouth, even if at the end of the day you get your way. Warner : > Warner : > : > : > : > Warner : > : > : > : > : > : > In message: <200906301851.n5UIpNJQ089171@svn.freebsd.org> : > : > Martin Blapp writes: : > : > : Author: mbr : > : > : Date: Tue Jun 30 18:51:22 2009 : > : > : New Revision: 195200 : > : > : URL: http://svn.freebsd.org/changeset/base/195200 : > : > : : > : > : Log: : > : > : Add wake, a tool to send Wake on LAN frames to hosts on a : > local : > : > Ethernet network : > : > : : > : > : Submitted by: Marc Balmer : > : > : Reviewed by: rwatson : > : > : Approved by: re : > : > : : > : > : M usr.sbin/Makefile : > : > : A usr.sbin/wake : > : > : AM usr.sbin/wake/wake.c : > : > : AM usr.sbin/wake/Makefile : > : > : AM usr.sbin/wake/wake.8 : > : > : : > : > : Added: : > : > : head/usr.sbin/wake/ : > : > : head/usr.sbin/wake/Makefile (contents, props changed) : > : > : head/usr.sbin/wake/wake.8 (contents, props changed) : > : > : head/usr.sbin/wake/wake.c (contents, props changed) : > : > : Modified: : > : > : head/usr.sbin/Makefile : > : > : : > : > : Modified: head/usr.sbin/Makefile : > : > : : > : > = : > : > = : > : > = : > : > = : > : > = : > : > = : > : > = : > : > = : > : > : > ====================================================================== : > : > : --- head/usr.sbin/Makefile Tue Jun 30 17:27:53 2009 (r195199) : > : > : +++ head/usr.sbin/Makefile Tue Jun 30 18:51:22 2009 (r195200) : > : > : @@ -190,6 +190,7 @@ SUBDIR= ${_ac} \ : > : > : ${_usbconfig} \ : > : > : ${_vidcontrol} \ : > : > : vipw \ : > : > : + wake \ : > : > : watch \ : > : > : watchdogd \ : > : > : ${_wlandebug} \ : > : > : : > : > : Added: head/usr.sbin/wake/Makefile : > : > : : > : > = : > : > = : > : > = : > : > = : > : > = : > : > = : > : > = : > : > = : > : > : > ====================================================================== : > : > : --- /dev/null 00:00:00 1970 (empty, because file is newly added) : > : > : +++ head/usr.sbin/wake/Makefile Tue Jun 30 18:51:22 2009 : > (r195200) : > : > : @@ -0,0 +1,8 @@ : > : > : +# $FreeBSD$ : > : > : + : > : > : +PROG= wake : > : > : +MAN= wake.8 : > : > : + : > : > : +WARNS?= 2 : > : > : + : > : > : +.include : > : > : : > : > : Added: head/usr.sbin/wake/wake.8 : > : > : : > : > = : > : > = : > : > = : > : > = : > : > = : > : > = : > : > = : > : > = : > : > : > ====================================================================== : > : > : --- /dev/null 00:00:00 1970 (empty, because file is newly added) : > : > : +++ head/usr.sbin/wake/wake.8 Tue Jun 30 18:51:22 2009 (r195200) : > : > : @@ -0,0 +1,61 @@ : > : > : +.\" : > : > : +.\" $FreeBSD$ : > : > : +.\" : > : > : +.\" Copyright (c) 2009 Marc Balmer : > : > : +.\" : > : > : +.\" Permission to use, copy, modify, and distribute this : > software : > : > for any : > : > : +.\" purpose with or without fee is hereby granted, provided : > that : > : > the above : > : > : +.\" copyright notice and this permission notice appear in all : > : > copies. : > : > : +.\" : > : > : +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS : > ALL : > : > WARRANTIES : > : > : +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED : > WARRANTIES : > : > OF : > : > : +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR : > BE : > : > LIABLE FOR : > : > : +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR : > : > ANY DAMAGES : > : > : +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, : > : > WHETHER IN AN : > : > : +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, : > : > ARISING OUT OF : > : > : +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS : > SOFTWARE. : > : > : +.\" : > : > : +.Dd June 27 2009 : > : > : +.Dt WAKE 8 : > : > : +.Os : > : > : +.Sh NAME : > : > : +.Nm wake : > : > : +.Nd send Wake on LAN frames to hosts on a local Ethernet : > network : > : > : +.Sh SYNOPSIS : > : > : +.Nm : > : > : +.Ar interface : > : > : +.Op Ar lladdr ... : > : > : +.Sh DESCRIPTION : > : > : +The : > : > : +.Nm : > : > : +program is used to send Wake on LAN (WoL) frames over a local : > : > : +Ethernet network to one or more hosts using their link layer : > : > (hardware) : > : > : +addresses. : > : > : +WoL functionality is generally enabled in a machine's BIOS : > : > : +and can be used to power on machines from a remote system : > without : > : > : +having physical access to them. : > : > : +.Pp : > : > : +.Ar interface : > : > : +is the network interface of the local machine. : > : > : +.Ar lladdr : > : > : +are the link layer addresses of the remote machines : > : > : +and can be specified as the actual hardware address : > : > : +(six hexadecimal numbers separated by colons) : > : > : +or a hostname entry in : > : > : +.Pa /etc/ethers . : > : > : +Link layer addresses can be determined and set on : > : > : +.Fx : > : > : +machines using : > : > : +.Xr ifconfig 8 . : > : > : +.Sh FILES : > : > : +.Bl -tag -width "/etc/ethers" -compact : > : > : +.It /etc/ethers : > : > : +Ethernet host name database. : > : > : +.El : > : > : +.Sh SEE ALSO : > : > : +.Xr ethers 5 , : > : > : +.Xr ifconfig 8 : > : > : +.Sh AUTHORS : > : > : +.Nm : > : > : +was written by : > : > : +.Ar Marc Balmer Aq marc@msys.ch . : > : > : : > : > : Added: head/usr.sbin/wake/wake.c : > : > : : > : > = : > : > = : > : > = : > : > = : > : > = : > : > = : > : > = : > : > = : > : > : > ====================================================================== : > : > : --- /dev/null 00:00:00 1970 (empty, because file is newly added) : > : > : +++ head/usr.sbin/wake/wake.c Tue Jun 30 18:51:22 2009 (r195200) : > : > : @@ -0,0 +1,174 @@ : > : > : +/* : > : > : + * Copyright (C) 2006, 2007, 2008, 2009 Marc Balmer > : > : > : + * Copyright (C) 2000 Eugene M. Kim. All rights reserved. : > : > : + * : > : > : + * Redistribution and use in source and binary forms, with or : > : > without : > : > : + * modification, are permitted provided that the following : > : > conditions : > : > : + * are met: : > : > : + * : > : > : + * 1. Redistributions of source code must retain the above : > : > copyright : > : > : + * notice, this list of conditions and the following : > disclaimer. : > : > : + * 2. Author's name may not be used endorse or promote products : > : > derived : > : > : + * from this software without specific prior written : > permission. : > : > : + * : > : > : + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY : > : > EXPRESS OR : > : > : + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE : > IMPLIED : > : > : + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR : > : > PURPOSE ARE : > : > : + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY : > : > DIRECT, : > : > : + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL : > : > DAMAGES : > : > : + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE : > : > GOODS OR : > : > : + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS : > : > INTERRUPTION) : > : > : + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN : > : > CONTRACT, : > : > : + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR : > OTHERWISE) : > : > ARISING : > : > : + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF : > ADVISED OF : > : > THE : > : > : + * POSSIBILITY OF SUCH DAMAGE. : > : > : + */ : > : > : + : > : > : +#include : > : > : +__FBSDID("$FreeBSD$"); : > : > : + : > : > : +#include : > : > : +#include : > : > : +#include : > : > : +#include : > : > : +#include : > : > : +#include : > : > : +#include : > : > : +#include : > : > : + : > : > : +#include : > : > : +#include : > : > : + : > : > : +#include : > : > : +#include : > : > : +#include : > : > : +#include : > : > : +#include : > : > : +#include : > : > : +#include : > : > : +#include : > : > : +#include : > : > : +#include : > : > : + : > : > : +#define _PATH_BPF "/dev/bpf" : > : > : + : > : > : +#ifndef SYNC_LEN : > : > : +#define SYNC_LEN 6 : > : > : +#endif : > : > : + : > : > : +#ifndef DESTADDR_COUNT : > : > : +#define DESTADDR_COUNT 16 : > : > : +#endif : > : > : + : > : > : +void usage(void); : > : > : + : > : > : +int wake(const char *iface, const char *host); : > : > : +int bind_if_to_bpf(char const *ifname, int bpf); : > : > : +int get_ether(char const *text, struct ether_addr *addr); : > : > : +int send_wakeup(int bpf, struct ether_addr const *addr); : > : > : + : > : > : +void : > : > : +usage(void) : > : > : +{ : > : > : + (void)fprintf(stderr, "usage: wake interface lladdr\n"); : > : > : + exit(0); : > : > : +} : > : > : + : > : > : +int : > : > : +wake(const char *iface, const char *host) : > : > : +{ : > : > : + int res, bpf; : > : > : + struct ether_addr macaddr; : > : > : + : > : > : + bpf = open(_PATH_BPF, O_RDWR); : > : > : + if (bpf == -1) { : > : > : + printf("no bpf\n"); : > : > : + return -1; : > : > : + } : > : > : + if (bind_if_to_bpf(iface, bpf) == -1 || : > : > : + get_ether(host, &macaddr) == -1) { : > : > : + (void)close(bpf); : > : > : + return -1; : > : > : + } : > : > : + res = send_wakeup(bpf, &macaddr); : > : > : + (void)close(bpf); : > : > : + return res; : > : > : +} : > : > : + : > : > : +int : > : > : +bind_if_to_bpf(char const *ifname, int bpf) : > : > : +{ : > : > : + struct ifreq ifr; : > : > : + u_int dlt; : > : > : + : > : > : + if (strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)) >= : > : > : + sizeof(ifr.ifr_name)) : > : > : + return -1; : > : > : + if (ioctl(bpf, BIOCSETIF, &ifr) == -1) : > : > : + return -1; : > : > : + if (ioctl(bpf, BIOCGDLT, &dlt) == -1) : > : > : + return -1; : > : > : + if (dlt != DLT_EN10MB) : > : > : + return -1; : > : > : + return 0; : > : > : +} : > : > : + : > : > : +int : > : > : +get_ether(char const *text, struct ether_addr *addr) : > : > : +{ : > : > : + struct ether_addr *paddr; : > : > : + : > : > : + paddr = ether_aton(text); : > : > : + if (paddr != NULL) { : > : > : + *addr = *paddr; : > : > : + return 0; : > : > : + } : > : > : + if (ether_hostton(text, addr)) : > : > : + return -1; : > : > : + return 0; : > : > : +} : > : > : + : > : > : +int : > : > : +send_wakeup(int bpf, struct ether_addr const *addr) : > : > : +{ : > : > : + struct { : > : > : + struct ether_header hdr; : > : > : + u_char data[SYNC_LEN + ETHER_ADDR_LEN * DESTADDR_COUNT]; : > : > : + } pkt; : > : > : + u_char *p; : > : > : + int i; : > : > : + ssize_t bw; : > : > : + ssize_t len; : > : > : + : > : > : + (void)memset(pkt.hdr.ether_dhost, 0xff, : > : > sizeof(pkt.hdr.ether_dhost)); : > : > : + pkt.hdr.ether_type = htons(0); : > : > : + (void)memset(pkt.data, 0xff, SYNC_LEN); : > : > : + for (p = pkt.data + SYNC_LEN, i = 0; i < DESTADDR_COUNT; : > : > : + p += ETHER_ADDR_LEN, i++) : > : > : + bcopy(addr->octet, p, ETHER_ADDR_LEN); : > : > : + p = (u_char *)&pkt; : > : > : + len = sizeof(pkt); : > : > : + bw = 0; : > : > : + while (len) { : > : > : + if ((bw = write(bpf, &pkt, sizeof(pkt))) == -1) : > : > : + return -1; : > : > : + len -= bw; : > : > : + p += bw; : > : > : + } : > : > : + return 0; : > : > : +} : > : > : + : > : > : +int : > : > : +main(int argc, char *argv[]) : > : > : +{ : > : > : + int n; : > : > : + : > : > : + if (argc < 3) : > : > : + usage(); : > : > : + : > : > : + for (n = 2; n < argc; n++) : > : > : + if (wake(argv[1], argv[n])) : > : > : + warnx("error sending Wake on LAN frame over %s to %s", : > : > : + argv[1], argv[n]); : > : > : + return 0; : > : > : +} : > : > : : > : > _______________________________________________ : > : > svn-src-all@freebsd.org mailing list : > : > http://lists.freebsd.org/mailman/listinfo/svn-src-all : > : > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org : > " : > : : > : : :