- included infiniband support (#147396) <tduffy@sun.com>

- added etherwake man page
This commit is contained in:
Radek Vokál 2005-02-09 09:09:57 +00:00
parent ebeb31b32e
commit 1bf9a7db5c
5 changed files with 295 additions and 2 deletions

81
etherwake.8 Normal file
View File

@ -0,0 +1,81 @@
.\" Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH ETHERWAKE 8 "March 31, 2003" "Scyld"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
etherwake \- A tool to send a Wake-On-LAN "Magic Packet"
.SH SYNOPSIS
.B etherwake
.RI [ options ] " Host-ID"
.SH DESCRIPTION
This manual page documents the usage of the
.B ether-wake
command.
.PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
.\" respectively.
\fBetherwake\fP is a program that generates and transmits a Wake-On-LAN
(WOL) "Magic Packet", used for restarting machines that have been
soft-powered-down (ACPI D3-warm state). It generates the standard
AMD Magic Packet format, optionally with a password included. The
single required parameter is a station (MAC) address or a host ID that can
be translated to a MAC address by an
.BR ethers (5)
database specified in
.BR nsswitch.conf (5)
.
.SH OPTIONS
\fBetherwake\fP needs a single dash (´-´) in front of options.
A summary of options is included below.
.TP
.B \-b
Send the wake-up packet to the broadcast address.
.TP
.B \-D
Increase the Debug Level.
.TP
.B \-i ifname
Use interface ifname instead of the default "eth0".
.TP
.B \-p passwd
Append a four or six byte password to the packet. Only a few adapters
need or support this. A six byte password may be specified in Ethernet hex
format (00:22:44:66:88:aa) or four byte dotted decimal (192.168.1.1) format.
A four byte password must use the dotted decimal format.
.TP
.B \-V
Show the program version information.
.SH EXIT STATUS
This program returns 0 on success.
A permission failures (e.g. run as a non-root user) results in an exit
status of 2. Unrecognized or invalid parameters result in an exit
status of 3. Failure to retrieve network interface information or send
a packet will result in an exit status of 1.
.SH SEE ALSO
.BR arp (8).
.br
.SH SECURITY
On some non-Linux systems dropping root capability allows the process to be
dumped, traced or debugged.
If someone traces this program, they get control of a raw socket.
Linux handles this safely, but beware when porting this program.
.SH AUTHOR
The etherwake program was written by Donald Becker at Scyld Computing
Corporation for use with the Scyld(\*(Tm) Beowulf System.

View File

@ -63,6 +63,7 @@
#define HAVE_HWHDLCLAPB 1
#define HAVE_HWIRDA 1
#define HAVE_HWEC 1
#define HAVE_HWIB 1
/*
*

View File

@ -30,6 +30,7 @@ HAVE_HWASH=1
HAVE_HWHDLCLAPB=1
HAVE_HWIRDA=1
HAVE_HWEC=1
HAVE_HWIB=1
HAVE_FW_MASQUERADE=1
HAVE_IP_TOOLS=1
HAVE_MII=1

View File

@ -0,0 +1,202 @@
--- net-tools-1.60/config.in.ifconfig_ib 2000-05-21 16:32:12.000000000 +0200
+++ net-tools-1.60/config.in 2005-02-09 10:36:26.000000000 +0100
@@ -82,6 +82,7 @@
bool '(Cisco)-HDLC/LAPB support' HAVE_HWHDLCLAPB n
bool 'IrDA support' HAVE_HWIRDA y
bool 'Econet hardware support' HAVE_HWEC n
+bool 'InfiniBand hardware support' HAVE_HWIB y
*
*
* Other Features.
--- net-tools-1.60/lib/hw.c.ifconfig_ib 2000-05-20 20:27:25.000000000 +0200
+++ net-tools-1.60/lib/hw.c 2005-02-09 10:36:26.000000000 +0100
@@ -73,6 +73,8 @@
extern struct hwtype ec_hwtype;
+extern struct hwtype ib_hwtype;
+
static struct hwtype *hwtypes[] =
{
@@ -144,6 +146,9 @@
#if HAVE_HWX25
&x25_hwtype,
#endif
+#if HAVE_HWIB
+ &ib_hwtype,
+#endif
&unspec_hwtype,
NULL
};
@@ -217,6 +222,9 @@
#if HAVE_HWEC
ec_hwtype.title = _("Econet");
#endif
+#if HAVE_HWIB
+ ib_hwtype.title = _("InfiniBand");
+#endif
sVhwinit = 1;
}
--- net-tools-1.60/lib/ib.c.ifconfig_ib 2005-02-09 10:36:26.000000000 +0100
+++ net-tools-1.60/lib/ib.c 2005-02-09 10:42:21.000000000 +0100
@@ -0,0 +1,147 @@
+/*
+ * lib/ib.c This file contains an implementation of the "Infiniband"
+ * support functions.
+ *
+ * Version: $Id: ib.c,v 1.1 2005/02/06 11:00:47 tduffy Exp $
+ *
+ * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
+ * Copyright 1993 MicroWalt Corporation
+ * Tom Duffy <tduffy@sun.com>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ */
+#include "config.h"
+
+#if HAVE_HWIB
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <net/if_arp.h>
+/*#include <linux/if_infiniband.h> - not in gcc-kernheaders*/
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <ctype.h>
+#include <string.h>
+#include <unistd.h>
+#include "net-support.h"
+#include "pathnames.h"
+#include "intl.h"
+#include "util.h"
+
+extern struct hwtype ib_hwtype;
+
+#define INFINIBAND_ALEN 20
+
+/* Display an InfiniBand address in readable format. */
+static char *pr_ib(unsigned char *ptr)
+{
+ static char buff[128];
+ char *pos;
+ unsigned int i;
+
+ pos = buff;
+ for (i = 0; i < INFINIBAND_ALEN; i++) {
+ pos += sprintf(pos, "%02X:", (*ptr++ & 0377));
+ }
+ buff[strlen(buff) - 1] = '\0';
+
+ /* snprintf(buff, sizeof(buff), "%02X:%02X:%02X:%02X:%02X:%02X",
+ (ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377),
+ (ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377)
+ );
+ */
+ return (buff);
+}
+
+
+/* Input an Infiniband address and convert to binary. */
+static int in_ib(char *bufp, struct sockaddr *sap)
+{
+ unsigned char *ptr;
+ char c, *orig;
+ int i;
+ unsigned val;
+
+ sap->sa_family = ib_hwtype.type;
+ ptr = sap->sa_data;
+
+ i = 0;
+ orig = bufp;
+ while ((*bufp != '\0') && (i < INFINIBAND_ALEN)) {
+ val = 0;
+ c = *bufp++;
+ if (isdigit(c))
+ val = c - '0';
+ else if (c >= 'a' && c <= 'f')
+ val = c - 'a' + 10;
+ else if (c >= 'A' && c <= 'F')
+ val = c - 'A' + 10;
+ else {
+#ifdef DEBUG
+ fprintf(stderr, _("in_ib(%s): invalid infiniband address!\n"), orig);
+#endif
+ errno = EINVAL;
+ return (-1);
+ }
+ val <<= 4;
+ c = *bufp;
+ if (isdigit(c))
+ val |= c - '0';
+ else if (c >= 'a' && c <= 'f')
+ val |= c - 'a' + 10;
+ else if (c >= 'A' && c <= 'F')
+ val |= c - 'A' + 10;
+ else if (c == ':' || c == 0)
+ val >>= 4;
+ else {
+#ifdef DEBUG
+ fprintf(stderr, _("in_ib(%s): invalid infiniband address!\n"), orig);
+#endif
+ errno = EINVAL;
+ return (-1);
+ }
+ if (c != 0)
+ bufp++;
+ *ptr++ = (unsigned char) (val & 0377);
+ i++;
+
+ /* We might get a semicolon here - not required. */
+ if (*bufp == ':') {
+ if (i == INFINIBAND_ALEN) {
+#ifdef DEBUG
+ fprintf(stderr, _("in_ib(%s): trailing : ignored!\n"),
+ orig)
+#endif
+ ; /* nothing */
+ }
+ bufp++;
+ }
+ }
+
+ /* That's it. Any trailing junk? */
+ if ((i == INFINIBAND_ALEN) && (*bufp != '\0')) {
+#ifdef DEBUG
+ fprintf(stderr, _("in_ib(%s): trailing junk!\n"), orig);
+ errno = EINVAL;
+ return (-1);
+#endif
+ }
+#ifdef DEBUG
+ fprintf(stderr, "in_ib(%s): %s\n", orig, pr_ib(sap->sa_data));
+#endif
+
+ return (0);
+}
+
+
+struct hwtype ib_hwtype =
+{
+ "infiniband", NULL, ARPHRD_INFINIBAND, INFINIBAND_ALEN,
+ pr_ib, in_ib, NULL
+};
+
+#endif /* HAVE_HWIB */
--- net-tools-1.60/lib/Makefile.ifconfig_ib 2000-10-28 12:59:42.000000000 +0200
+++ net-tools-1.60/lib/Makefile 2005-02-09 10:36:26.000000000 +0100
@@ -16,7 +16,7 @@
#
-HWOBJS = hw.o loopback.o slip.o ether.o ax25.o ppp.o arcnet.o tr.o tunnel.o frame.o sit.o rose.o ash.o fddi.o hippi.o hdlclapb.o strip.o irda.o ec_hw.o x25.o
+HWOBJS = hw.o loopback.o slip.o ether.o ax25.o ppp.o arcnet.o tr.o tunnel.o frame.o sit.o rose.o ash.o fddi.o hippi.o hdlclapb.o strip.o irda.o ec_hw.o x25.o ib.o
AFOBJS = unix.o inet.o inet6.o ax25.o ipx.o ddp.o ipx.o netrom.o af.o rose.o econet.o x25.o
AFGROBJS = inet_gr.o inet6_gr.o ipx_gr.o ddp_gr.o netrom_gr.o ax25_gr.o rose_gr.o getroute.o x25_gr.o
AFSROBJS = inet_sr.o inet6_sr.o netrom_sr.o ipx_sr.o setroute.o x25_sr.o

View File

@ -3,7 +3,7 @@
Summary: Basic networking tools.
Name: net-tools
Version: 1.60
Release: 44
Release: 45
License: GPL
Group: System Environment/Base
Source0: http://www.tazenda.demon.co.uk/phil/net-tools/net-tools-%{version}.tar.bz2
@ -11,6 +11,7 @@ Source1: netplug-%{npversion}.tar.bz2
Source2: net-tools-%{version}-config.h
Source3: net-tools-%{version}-config.make
Source4: ether-wake.c
Source5: etherwake.8
Patch1: net-tools-1.57-bug22040.patch
Patch2: net-tools-1.60-miiioctl.patch
Patch3: net-tools-1.60-manydevs.patch
@ -41,6 +42,8 @@ Patch30: net-tools-1.60-duplicate-tcp.patch
Patch31: net-tools-1.60-statalias.patch
Patch32: net-tools-1.60-isofix.patch
Patch33: net-tools-1.60-bitkeeper.patch
Patch34: net-tools-1.60-ifconfig_ib.patch
BuildRoot: %{_tmppath}/%{name}-root
Requires(post,preun): chkconfig
BuildRequires: gettext
@ -81,10 +84,12 @@ ifconfig, netstat, route, and others.
%patch31 -p1 -b .statalias
%patch32 -p1 -b .isofix
%patch33 -p1 -b .bitkeeper
%patch34 -p1 -b .ifconfig_ib
cp %SOURCE2 ./config.h
cp %SOURCE3 ./config.make
cp %SOURCE4 .
cp %SOURCE5 ./man/en_US
%ifarch alpha
perl -pi -e "s|-O2||" Makefile
@ -128,7 +133,6 @@ popd
%install
rm -rf $RPM_BUILD_ROOT
mv man/de_DE man/de
mv man/fr_FR man/fr
mv man/pt_BR man/pt
@ -182,6 +186,10 @@ exit 0
%{_sysconfdir}/rc.d/init.d/netplugd
%changelog
* Wed Feb 09 2005 Radek Vokal <rvokal@redhat.com> 1.60-45
- included infiniband support (#147396) <tduffy@sun.com>
- added etherwake man page
* Mon Feb 07 2005 Radek Vokal <rvokal@redhat.com> 1.60-44
- net-plug-1.2.9 - no changes, upstream included Red Hat patches
- ether-wake-1.08 - few changes in implementation (#145718)