/[packages]/cauldron/net-tools/current/SOURCES/net-tools-1.60-ifconfig_ib.patch
ViewVC logotype

Contents of /cauldron/net-tools/current/SOURCES/net-tools-1.60-ifconfig_ib.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 318 - (show annotations) (download)
Fri Jan 7 23:30:25 2011 UTC (13 years, 3 months ago) by tmb
File size: 5453 byte(s)
imported package net-tools
1 --- net-tools-1.60/config.in.ifconfig_ib 2000-05-21 16:32:12.000000000 +0200
2 +++ net-tools-1.60/config.in 2005-02-09 10:36:26.000000000 +0100
3 @@ -82,6 +82,7 @@
4 bool '(Cisco)-HDLC/LAPB support' HAVE_HWHDLCLAPB n
5 bool 'IrDA support' HAVE_HWIRDA y
6 bool 'Econet hardware support' HAVE_HWEC n
7 +bool 'InfiniBand hardware support' HAVE_HWIB y
8 *
9 *
10 * Other Features.
11 --- net-tools-1.60/lib/hw.c.ifconfig_ib 2000-05-20 20:27:25.000000000 +0200
12 +++ net-tools-1.60/lib/hw.c 2005-02-09 10:36:26.000000000 +0100
13 @@ -73,6 +73,8 @@
14
15 extern struct hwtype ec_hwtype;
16
17 +extern struct hwtype ib_hwtype;
18 +
19 static struct hwtype *hwtypes[] =
20 {
21
22 @@ -144,6 +146,9 @@
23 #if HAVE_HWX25
24 &x25_hwtype,
25 #endif
26 +#if HAVE_HWIB
27 + &ib_hwtype,
28 +#endif
29 &unspec_hwtype,
30 NULL
31 };
32 @@ -217,6 +222,9 @@
33 #if HAVE_HWEC
34 ec_hwtype.title = _("Econet");
35 #endif
36 +#if HAVE_HWIB
37 + ib_hwtype.title = _("InfiniBand");
38 +#endif
39 sVhwinit = 1;
40 }
41
42 --- net-tools-1.60/lib/ib.c.ifconfig_ib 2005-02-09 10:36:26.000000000 +0100
43 +++ net-tools-1.60/lib/ib.c 2005-02-09 10:42:21.000000000 +0100
44 @@ -0,0 +1,147 @@
45 +/*
46 + * lib/ib.c This file contains an implementation of the "Infiniband"
47 + * support functions.
48 + *
49 + * Version: $Id: ib.c,v 1.1 2005/02/06 11:00:47 tduffy Exp $
50 + *
51 + * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
52 + * Copyright 1993 MicroWalt Corporation
53 + * Tom Duffy <tduffy@sun.com>
54 + *
55 + * This program is free software; you can redistribute it
56 + * and/or modify it under the terms of the GNU General
57 + * Public License as published by the Free Software
58 + * Foundation; either version 2 of the License, or (at
59 + * your option) any later version.
60 + */
61 +#include "config.h"
62 +
63 +#if HAVE_HWIB
64 +#include <sys/types.h>
65 +#include <sys/socket.h>
66 +#include <net/if_arp.h>
67 +/*#include <linux/if_infiniband.h> - not in gcc-kernheaders*/
68 +#include <stdlib.h>
69 +#include <stdio.h>
70 +#include <errno.h>
71 +#include <ctype.h>
72 +#include <string.h>
73 +#include <unistd.h>
74 +#include "net-support.h"
75 +#include "pathnames.h"
76 +#include "intl.h"
77 +#include "util.h"
78 +
79 +extern struct hwtype ib_hwtype;
80 +
81 +#define INFINIBAND_ALEN 20
82 +
83 +/* Display an InfiniBand address in readable format. */
84 +static char *pr_ib(unsigned char *ptr)
85 +{
86 + static char buff[128];
87 + char *pos;
88 + unsigned int i;
89 +
90 + pos = buff;
91 + for (i = 0; i < INFINIBAND_ALEN; i++) {
92 + pos += sprintf(pos, "%02X:", (*ptr++ & 0377));
93 + }
94 + buff[strlen(buff) - 1] = '\0';
95 +
96 + /* snprintf(buff, sizeof(buff), "%02X:%02X:%02X:%02X:%02X:%02X",
97 + (ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377),
98 + (ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377)
99 + );
100 + */
101 + return (buff);
102 +}
103 +
104 +
105 +/* Input an Infiniband address and convert to binary. */
106 +static int in_ib(char *bufp, struct sockaddr *sap)
107 +{
108 + unsigned char *ptr;
109 + char c, *orig;
110 + int i;
111 + unsigned val;
112 +
113 + sap->sa_family = ib_hwtype.type;
114 + ptr = sap->sa_data;
115 +
116 + i = 0;
117 + orig = bufp;
118 + while ((*bufp != '\0') && (i < INFINIBAND_ALEN)) {
119 + val = 0;
120 + c = *bufp++;
121 + if (isdigit(c))
122 + val = c - '0';
123 + else if (c >= 'a' && c <= 'f')
124 + val = c - 'a' + 10;
125 + else if (c >= 'A' && c <= 'F')
126 + val = c - 'A' + 10;
127 + else {
128 +#ifdef DEBUG
129 + fprintf(stderr, _("in_ib(%s): invalid infiniband address!\n"), orig);
130 +#endif
131 + errno = EINVAL;
132 + return (-1);
133 + }
134 + val <<= 4;
135 + c = *bufp;
136 + if (isdigit(c))
137 + val |= c - '0';
138 + else if (c >= 'a' && c <= 'f')
139 + val |= c - 'a' + 10;
140 + else if (c >= 'A' && c <= 'F')
141 + val |= c - 'A' + 10;
142 + else if (c == ':' || c == 0)
143 + val >>= 4;
144 + else {
145 +#ifdef DEBUG
146 + fprintf(stderr, _("in_ib(%s): invalid infiniband address!\n"), orig);
147 +#endif
148 + errno = EINVAL;
149 + return (-1);
150 + }
151 + if (c != 0)
152 + bufp++;
153 + *ptr++ = (unsigned char) (val & 0377);
154 + i++;
155 +
156 + /* We might get a semicolon here - not required. */
157 + if (*bufp == ':') {
158 + if (i == INFINIBAND_ALEN) {
159 +#ifdef DEBUG
160 + fprintf(stderr, _("in_ib(%s): trailing : ignored!\n"),
161 + orig)
162 +#endif
163 + ; /* nothing */
164 + }
165 + bufp++;
166 + }
167 + }
168 +
169 + /* That's it. Any trailing junk? */
170 + if ((i == INFINIBAND_ALEN) && (*bufp != '\0')) {
171 +#ifdef DEBUG
172 + fprintf(stderr, _("in_ib(%s): trailing junk!\n"), orig);
173 + errno = EINVAL;
174 + return (-1);
175 +#endif
176 + }
177 +#ifdef DEBUG
178 + fprintf(stderr, "in_ib(%s): %s\n", orig, pr_ib(sap->sa_data));
179 +#endif
180 +
181 + return (0);
182 +}
183 +
184 +
185 +struct hwtype ib_hwtype =
186 +{
187 + "infiniband", NULL, ARPHRD_INFINIBAND, INFINIBAND_ALEN,
188 + pr_ib, in_ib, NULL
189 +};
190 +
191 +#endif /* HAVE_HWIB */
192 --- net-tools-1.60/lib/Makefile.ifconfig_ib 2000-10-28 12:59:42.000000000 +0200
193 +++ net-tools-1.60/lib/Makefile 2005-02-09 10:36:26.000000000 +0100
194 @@ -16,7 +16,7 @@
195 #
196
197
198 -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
199 +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
200 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
201 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
202 AFSROBJS = inet_sr.o inet6_sr.o netrom_sr.o ipx_sr.o setroute.o x25_sr.o

  ViewVC Help
Powered by ViewVC 1.1.30