1 diff -up net-tools-1.60/config.in.hfi net-tools-1.60/config.in
2 --- net-tools-1.60/config.in.hfi 2010-09-16 17:20:04.000000000 +0200
3 +++ net-tools-1.60/config.in 2010-09-16 19:17:35.000000000 +0200
4 @@ -83,6 +83,7 @@ bool '(Cisco)-HDLC/LAPB support' HAVE_HW
5 bool 'IrDA support' HAVE_HWIRDA y
6 bool 'Econet hardware support' HAVE_HWEC n
7 bool 'InfiniBand hardware support' HAVE_HWIB y
8 +bool 'HFI support' HAVE_HWHFI y
12 diff -up net-tools-1.60/lib/hfi.c.hfi net-tools-1.60/lib/hfi.c
13 --- net-tools-1.60/lib/hfi.c.hfi 2010-09-16 19:17:58.000000000 +0200
14 +++ net-tools-1.60/lib/hfi.c 2010-09-16 19:19:49.000000000 +0200
19 +#include <sys/types.h>
20 +#include <sys/socket.h>
21 +#include <net/if_arp.h>
28 +#include "net-support.h"
29 +#include "pathnames.h"
33 +extern struct hwtype hfi_hwtype;
35 +#define HF_ALEN 6 /* from hf_if.h */
37 +/* Display an HFI address in readable format. */
38 +static char *pr_hfi(unsigned char *ptr)
40 + static char buff[64];
42 + snprintf(buff, sizeof(buff), "%02X:%02X:%02X:%02X:%02X:%02X",
43 + (ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377),
44 + (ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377)
50 +/* Input an HFI address and convert to binary. */
51 +static int in_hfi(char *bufp, struct sockaddr *sap)
58 + sap->sa_family = hfi_hwtype.type;
63 + while ((*bufp != '\0') && (i < HF_ALEN)) {
68 + else if (c >= 'a' && c <= 'f')
70 + else if (c >= 'A' && c <= 'F')
74 + fprintf(stderr, _("in_hfi(%s): invalid hfi address!\n"), orig);
83 + else if (c >= 'a' && c <= 'f')
84 + val |= c - 'a' + 10;
85 + else if (c >= 'A' && c <= 'F')
86 + val |= c - 'A' + 10;
87 + else if (c == ':' || c == 0)
91 + fprintf(stderr, _("in_hfi(%s): invalid hfi address!\n"), orig);
98 + *ptr++ = (unsigned char) (val & 0377);
101 + /* We might get a semicolon here - not required. */
102 + if (*bufp == ':') {
103 + if (i == HF_ALEN) {
105 + fprintf(stderr, _("in_hfi(%s): trailing : ignored!\n"),
114 + /* That's it. Any trailing junk? */
115 + if ((i == HF_ALEN) && (*bufp != '\0')) {
117 + fprintf(stderr, _("in_hfi(%s): trailing junk!\n"), orig);
123 + fprintf(stderr, "in_hfi(%s): %s\n", orig, pr_hfi(sap->sa_data));
129 +#if !defined(ARPHRD_HFI)
130 +#define ARPHRD_HFI 37 /* goes into if_arp.h */
133 +struct hwtype hfi_hwtype =
135 + "hfi", NULL, /*"HFI", */ ARPHRD_HFI, HF_ALEN,
136 + pr_hfi, in_hfi, NULL
140 +#endif /* HAVE_HWHFI */
141 diff -up net-tools-1.60/lib/hw.c.hfi net-tools-1.60/lib/hw.c
142 --- net-tools-1.60/lib/hw.c.hfi 2010-09-16 17:20:04.000000000 +0200
143 +++ net-tools-1.60/lib/hw.c 2010-09-16 19:21:28.000000000 +0200
144 @@ -42,6 +42,7 @@ extern struct hwtype adaptive_hwtype;
145 extern struct hwtype strip_hwtype;
147 extern struct hwtype ether_hwtype;
148 +extern struct hwtype hfi_hwtype;
149 extern struct hwtype fddi_hwtype;
150 extern struct hwtype hippi_hwtype;
151 extern struct hwtype tr_hwtype;
152 @@ -146,6 +147,9 @@ static struct hwtype *hwtypes[] =
162 @@ -222,6 +226,9 @@ void hwinit()
164 ec_hwtype.title = _("Econet");
167 + hfi_hwtype.title = _("HFI");
170 ib_hwtype.title = _("InfiniBand");
172 diff -up net-tools-1.60/lib/Makefile.hfi net-tools-1.60/lib/Makefile
173 --- net-tools-1.60/lib/Makefile.hfi 2010-09-16 17:20:04.000000000 +0200
174 +++ net-tools-1.60/lib/Makefile 2010-09-16 19:22:34.000000000 +0200
179 -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
180 +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 hfi.o
181 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
182 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
183 AFSROBJS = inet_sr.o inet6_sr.o netrom_sr.o ipx_sr.o setroute.o x25_sr.o