1 |
vapier 08/04/14 04:02:18 |
2 |
|
3 |
Added: 01_all_net-tools-1.60-2.6-compilefix.patch |
4 |
02_all_net-tools-1.60-gcc34.patch |
5 |
03_all_net-tools-1.60-cleanup-list-handling.patch |
6 |
04_all_net-tools-1.60-get_name.patch |
7 |
20_all_net-tools-1.54-ipvs.patch |
8 |
21_all_net-tools-1.57-bug22040.patch |
9 |
22_all_net-tools-1.60-manydevs.patch |
10 |
23_all_net-tools-1.60-miiioctl.patch |
11 |
24_all_net-tools-1.60-virtualname.patch |
12 |
25_all_net-tools-1.60-cycle.patch |
13 |
26_all_net-tools-1.60-overflow.patch |
14 |
27_all_net-tools-1.60-netstat_ulong.patch |
15 |
50_all_net-tools-1.60-multiline-string.patch |
16 |
51_all_net-tools-1.60-man.patch |
17 |
52_all_net-tools-1.60-numeric-ports.patch |
18 |
53_all_net-tools-1.60-appletalk.patch |
19 |
54_all_net-tools-1.60-wide.patch |
20 |
55_all_net-tools-1.60-Makefile.patch |
21 |
56_all_net-tools-1.60-ipv6-hostname.patch |
22 |
57_all_net-tools-1.60-ifconfig-infiniband.patch |
23 |
60_all_net-tools-1.60-headers.patch |
24 |
70_all_net-tools-1.60-unaligned.patch |
25 |
Log: |
26 |
relocate into versioned-subdir |
27 |
|
28 |
Revision Changes Path |
29 |
1.1 src/patchsets/net-tools/1.60/01_all_net-tools-1.60-2.6-compilefix.patch |
30 |
|
31 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/01_all_net-tools-1.60-2.6-compilefix.patch?rev=1.1&view=markup |
32 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/01_all_net-tools-1.60-2.6-compilefix.patch?rev=1.1&content-type=text/plain |
33 |
|
34 |
Index: 01_all_net-tools-1.60-2.6-compilefix.patch |
35 |
=================================================================== |
36 |
diff -ruN net-tools-1.60.orig/lib/x25_sr.c net-tools-1.60/lib/x25_sr.c |
37 |
--- net-tools-1.60.orig/lib/x25_sr.c 2000-05-20 15:38:10.000000000 +0200 |
38 |
+++ net-tools-1.60/lib/x25_sr.c 2003-10-18 20:33:31.927574928 +0200 |
39 |
@@ -22,6 +22,7 @@ |
40 |
#include <sys/socket.h> |
41 |
#include <sys/ioctl.h> |
42 |
#include <linux/x25.h> |
43 |
+#include <linux/version.h> |
44 |
#include <ctype.h> |
45 |
#include <errno.h> |
46 |
#include <netdb.h> |
47 |
@@ -77,7 +78,11 @@ |
48 |
rt.sigdigits=sigdigits; |
49 |
|
50 |
/* x25_route_struct.address isn't type struct sockaddr_x25, Why? */ |
51 |
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) |
52 |
memcpy(&rt.address, &sx25.sx25_addr, sizeof(x25_address)); |
53 |
+#else |
54 |
+ memcpy(&rt.address, &sx25.sx25_addr, sizeof(struct x25_address)); |
55 |
+#endif |
56 |
|
57 |
while (*args) { |
58 |
if (!strcmp(*args,"device") || !strcmp(*args,"dev")) { |
59 |
|
60 |
|
61 |
|
62 |
1.1 src/patchsets/net-tools/1.60/02_all_net-tools-1.60-gcc34.patch |
63 |
|
64 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/02_all_net-tools-1.60-gcc34.patch?rev=1.1&view=markup |
65 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/02_all_net-tools-1.60-gcc34.patch?rev=1.1&content-type=text/plain |
66 |
|
67 |
Index: 02_all_net-tools-1.60-gcc34.patch |
68 |
=================================================================== |
69 |
http://bugs.gentoo.org/show_bug.cgi?id=48167 |
70 |
|
71 |
--- ./hostname.c.orig 2001-04-08 17:04:23.000000000 +0000 |
72 |
+++ ./hostname.c 2004-04-17 01:31:11.686122040 +0000 |
73 |
@@ -98,6 +98,7 @@ |
74 |
fprintf(stderr, _("%s: name too long\n"), program_name); |
75 |
break; |
76 |
default: |
77 |
+ ; |
78 |
} |
79 |
exit(1); |
80 |
}; |
81 |
@@ -117,6 +118,7 @@ |
82 |
fprintf(stderr, _("%s: name too long\n"), program_name); |
83 |
break; |
84 |
default: |
85 |
+ ; |
86 |
} |
87 |
exit(1); |
88 |
}; |
89 |
@@ -174,6 +176,7 @@ |
90 |
printf("%s\n", hp->h_name); |
91 |
break; |
92 |
default: |
93 |
+ ; |
94 |
} |
95 |
} |
96 |
|
97 |
--- ./lib/inet_sr.c.orig 2000-02-20 21:46:45.000000000 +0000 |
98 |
+++ ./lib/inet_sr.c 2004-04-17 01:31:02.388535488 +0000 |
99 |
@@ -105,6 +105,7 @@ |
100 |
case 2: |
101 |
isnet = 0; break; |
102 |
default: |
103 |
+ ; |
104 |
} |
105 |
|
106 |
/* Fill in the other fields. */ |
107 |
|
108 |
|
109 |
|
110 |
1.1 src/patchsets/net-tools/1.60/03_all_net-tools-1.60-cleanup-list-handling.patch |
111 |
|
112 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/03_all_net-tools-1.60-cleanup-list-handling.patch?rev=1.1&view=markup |
113 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/03_all_net-tools-1.60-cleanup-list-handling.patch?rev=1.1&content-type=text/plain |
114 |
|
115 |
Index: 03_all_net-tools-1.60-cleanup-list-handling.patch |
116 |
=================================================================== |
117 |
diff -u -r1.1 -r1.3 |
118 |
--- nameif.c 18 Oct 2000 17:26:29 -0000 1.1 |
119 |
+++ nameif.c 6 Mar 2003 23:26:52 -0000 1.3 |
120 |
@@ -117,7 +117,8 @@ |
121 |
} |
122 |
|
123 |
struct change { |
124 |
- struct change *next,**pprev; |
125 |
+ struct change *next; |
126 |
+ int found; |
127 |
char ifname[IFNAMSIZ+1]; |
128 |
unsigned char mac[6]; |
129 |
}; |
130 |
@@ -139,10 +140,7 @@ |
131 |
ch->ifname, pos); |
132 |
if (parsemac(p,ch->mac) < 0) |
133 |
complain(_("cannot parse MAC `%s' at %s"), p, pos); |
134 |
- if (clist) |
135 |
- clist->pprev = &ch->next; |
136 |
ch->next = clist; |
137 |
- ch->pprev = &clist; |
138 |
clist = ch; |
139 |
return 0; |
140 |
} |
141 |
@@ -200,7 +198,7 @@ |
142 |
|
143 |
void usage(void) |
144 |
{ |
145 |
- fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}")); |
146 |
+ fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}\n")); |
147 |
exit(1); |
148 |
} |
149 |
|
150 |
@@ -277,21 +275,21 @@ |
151 |
ch = lookupmac(mac); |
152 |
if (!ch) |
153 |
continue; |
154 |
- |
155 |
- *ch->pprev = ch->next; |
156 |
+ |
157 |
+ ch->found = 1; |
158 |
if (strcmp(p, ch->ifname)) { |
159 |
if (setname(p, ch->ifname) < 0) |
160 |
complain(_("cannot change name of %s to %s: %s"), |
161 |
p, ch->ifname, strerror(errno)); |
162 |
} |
163 |
- free(ch); |
164 |
} |
165 |
fclose(ifh); |
166 |
|
167 |
while (clist) { |
168 |
struct change *ch = clist; |
169 |
clist = clist->next; |
170 |
- warning(_("interface '%s' not found"), ch->ifname); |
171 |
+ if (!ch->found) |
172 |
+ warning(_("interface '%s' not found"), ch->ifname); |
173 |
free(ch); |
174 |
} |
175 |
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 |
1.1 src/patchsets/net-tools/1.60/04_all_net-tools-1.60-get_name.patch |
182 |
|
183 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/04_all_net-tools-1.60-get_name.patch?rev=1.1&view=markup |
184 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/04_all_net-tools-1.60-get_name.patch?rev=1.1&content-type=text/plain |
185 |
|
186 |
Index: 04_all_net-tools-1.60-get_name.patch |
187 |
=================================================================== |
188 |
Stack smashing attack in if_readlist_proc() from ifconfig |
189 |
http://bugs.gentoo.org/show_bug.cgi?id=58633 |
190 |
|
191 |
diff -Nrup net-tools-1.60.orig/lib/interface.c net-tools-1.60/lib/interface.c |
192 |
--- net-tools-1.60.orig/lib/interface.c 2004-08-12 05:54:09.000000000 -0400 |
193 |
+++ net-tools-1.60/lib/interface.c 2004-08-12 06:03:20.000000000 -0400 |
194 |
@@ -203,28 +203,34 @@ out: |
195 |
|
196 |
static char *get_name(char *name, char *p) |
197 |
{ |
198 |
- while (isspace(*p)) |
199 |
- p++; |
200 |
- while (*p) { |
201 |
- if (isspace(*p)) |
202 |
- break; |
203 |
- if (*p == ':') { /* could be an alias */ |
204 |
- char *dot = p, *dotname = name; |
205 |
- *name++ = *p++; |
206 |
- while (isdigit(*p)) |
207 |
- *name++ = *p++; |
208 |
- if (*p != ':') { /* it wasn't, backup */ |
209 |
- p = dot; |
210 |
- name = dotname; |
211 |
- } |
212 |
- if (*p == '\0') |
213 |
- return NULL; |
214 |
- p++; |
215 |
- break; |
216 |
+ /* Extract <name>[:<alias>] from nul-terminated p where p matches |
217 |
+ <name>[:<alias>]: after leading whitespace. |
218 |
+ If match is not made, set name empty and return unchanged p */ |
219 |
+ int namestart=0, nameend=0, aliasend; |
220 |
+ while (isspace(p[namestart])) |
221 |
+ namestart++; |
222 |
+ nameend=namestart; |
223 |
+ while (p[nameend] && p[nameend]!=':' && !isspace(p[nameend])) |
224 |
+ nameend++; |
225 |
+ if (p[nameend]==':') { |
226 |
+ aliasend=nameend+1; |
227 |
+ while (p[aliasend] && isdigit(p[aliasend])) |
228 |
+ aliasend++; |
229 |
+ if (p[aliasend]==':') { |
230 |
+ nameend=aliasend; |
231 |
+ } |
232 |
+ if ((nameend-namestart)<IFNAMSIZ) { |
233 |
+ memcpy(name,&p[namestart],nameend-namestart); |
234 |
+ name[nameend-namestart]='\0'; |
235 |
+ p=&p[nameend+1]; |
236 |
+ } else { |
237 |
+ /* Interface name too large */ |
238 |
+ name[0]='\0'; |
239 |
} |
240 |
- *name++ = *p++; |
241 |
+ } else { |
242 |
+ /* first ':' not found - return empty */ |
243 |
+ name[0]='\0'; |
244 |
} |
245 |
- *name++ = '\0'; |
246 |
return p; |
247 |
} |
248 |
|
249 |
|
250 |
|
251 |
|
252 |
1.1 src/patchsets/net-tools/1.60/20_all_net-tools-1.54-ipvs.patch |
253 |
|
254 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/20_all_net-tools-1.54-ipvs.patch?rev=1.1&view=markup |
255 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/20_all_net-tools-1.54-ipvs.patch?rev=1.1&content-type=text/plain |
256 |
|
257 |
Index: 20_all_net-tools-1.54-ipvs.patch |
258 |
=================================================================== |
259 |
--- net-tools-1.54/lib/masq_info.c.orig Sun Jun 13 07:04:49 1999 |
260 |
+++ net-tools-1.54/lib/masq_info.c Tue Jun 27 10:37:09 2000 |
261 |
@@ -118,7 +118,9 @@ |
262 |
ms->src.sin_family = AF_INET; |
263 |
ms->dst.sin_family = AF_INET; |
264 |
|
265 |
- if (strcmp("TCP", buf) == 0) |
266 |
+ if (strcmp("IP", buf) == 0) |
267 |
+ ms->proto = "ip"; |
268 |
+ else if (strcmp("TCP", buf) == 0) |
269 |
ms->proto = "tcp"; |
270 |
else if (strcmp("UDP", buf) == 0) |
271 |
ms->proto = "udp"; |
272 |
|
273 |
|
274 |
|
275 |
1.1 src/patchsets/net-tools/1.60/21_all_net-tools-1.57-bug22040.patch |
276 |
|
277 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/21_all_net-tools-1.57-bug22040.patch?rev=1.1&view=markup |
278 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/21_all_net-tools-1.57-bug22040.patch?rev=1.1&content-type=text/plain |
279 |
|
280 |
Index: 21_all_net-tools-1.57-bug22040.patch |
281 |
=================================================================== |
282 |
--- net-tools-1.57/arp.c.orig Sun May 14 17:57:41 2000 |
283 |
+++ net-tools-1.57/arp.c Sat Nov 25 15:05:27 2000 |
284 |
@@ -618,6 +618,7 @@ |
285 |
fprintf(stderr, _(" arp [-v] [<HW>] [-i <if>] -Ds <hostname> <if> [netmask <nm>] pub <-''-\n\n")); |
286 |
|
287 |
fprintf(stderr, _(" -a display (all) hosts in alternative (BSD) style\n")); |
288 |
+ fprintf(stderr, _(" -e display (all) hosts in default (Linux) style\n")); |
289 |
fprintf(stderr, _(" -s, --set set a new ARP entry\n")); |
290 |
fprintf(stderr, _(" -d, --delete delete a specified entry\n")); |
291 |
fprintf(stderr, _(" -v, --verbose be verbose\n")); |
292 |
--- net-tools-1.57/man/en_US/arp.8.orig Sat Nov 25 15:13:26 2000 |
293 |
+++ net-tools-1.57/man/en_US/arp.8 Sat Nov 25 15:15:12 2000 |
294 |
@@ -3,7 +3,7 @@ |
295 |
arp \- manipulate the system ARP cache |
296 |
.SH SYNOPSIS |
297 |
.B arp |
298 |
-.RB [ \-vn ] |
299 |
+.RB [ \-evn ] |
300 |
.RB [ "\-H type" ] |
301 |
.RB [ "-i if" ] |
302 |
.B -a |
303 |
@@ -60,7 +60,7 @@ |
304 |
shows numerical addresses instead of trying to determine symbolic host, port |
305 |
or user names. |
306 |
.TP |
307 |
-.B "\-H type, \-\-hw-type type" |
308 |
+.B "\-H type, \-\-hw-type type, \-t type" |
309 |
When setting or reading the ARP cache, this optional parameter tells |
310 |
.B arp |
311 |
which class of entries it should check for. The default value of |
312 |
@@ -81,7 +81,8 @@ |
313 |
.B hostname |
314 |
parameter is not used, |
315 |
.B all |
316 |
-entries will be displayed. |
317 |
+entries will be displayed. |
318 |
+The entries will be displayed in alternate (BSD) style. |
319 |
.TP |
320 |
.B "\-d hostname, \-\-delete hostname" |
321 |
Remove any entry for the specified host. This can be used if the |
322 |
@@ -91,6 +92,9 @@ |
323 |
Use the interface |
324 |
.BR ifa "'s" |
325 |
hardware address. |
326 |
+.TP |
327 |
+.B "\-e" |
328 |
+Shows the entries in default (Linux) style. |
329 |
.TP |
330 |
.B "\-i If, \-\-device If" |
331 |
Select an interface. When dumping the ARP cache only entries matching |
332 |
|
333 |
|
334 |
|
335 |
1.1 src/patchsets/net-tools/1.60/22_all_net-tools-1.60-manydevs.patch |
336 |
|
337 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/22_all_net-tools-1.60-manydevs.patch?rev=1.1&view=markup |
338 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/22_all_net-tools-1.60-manydevs.patch?rev=1.1&content-type=text/plain |
339 |
|
340 |
Index: 22_all_net-tools-1.60-manydevs.patch |
341 |
=================================================================== |
342 |
--- lib/nstrcmp.c.bak Fri Apr 12 00:15:01 2002 |
343 |
+++ lib/nstrcmp.c Fri Apr 12 00:15:29 2002 |
344 |
@@ -16,8 +16,8 @@ |
345 |
b++; |
346 |
} |
347 |
if (isdigit(*a)) { |
348 |
- if (!isdigit(*b)) |
349 |
- return -1; |
350 |
+ if (!isdigit(*b)) |
351 |
+ return 1; |
352 |
while (a > astr) { |
353 |
a--; |
354 |
if (!isdigit(*a)) { |
355 |
|
356 |
|
357 |
|
358 |
1.1 src/patchsets/net-tools/1.60/23_all_net-tools-1.60-miiioctl.patch |
359 |
|
360 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/23_all_net-tools-1.60-miiioctl.patch?rev=1.1&view=markup |
361 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/23_all_net-tools-1.60-miiioctl.patch?rev=1.1&content-type=text/plain |
362 |
|
363 |
Index: 23_all_net-tools-1.60-miiioctl.patch |
364 |
=================================================================== |
365 |
--- net-tools-1.60/include/mii.h.bar Tue Jul 31 11:49:39 2001 |
366 |
+++ net-tools-1.60/include/mii.h Tue Jul 31 11:49:33 2001 |
367 |
@@ -11,11 +11,9 @@ |
368 |
|
369 |
/* network interface ioctl's for MII commands */ |
370 |
#ifndef SIOCGMIIPHY |
371 |
-#define SIOCGMIIPHY (SIOCDEVPRIVATE) /* Read from current PHY */ |
372 |
-#define SIOCGMIIREG (SIOCDEVPRIVATE+1) /* Read any PHY register */ |
373 |
-#define SIOCSMIIREG (SIOCDEVPRIVATE+2) /* Write any PHY register */ |
374 |
-#define SIOCGPARAMS (SIOCDEVPRIVATE+3) /* Read operational parameters */ |
375 |
-#define SIOCSPARAMS (SIOCDEVPRIVATE+4) /* Set operational parameters */ |
376 |
+#define SIOCGMIIPHY 0x8947 /* Read from current PHY */ |
377 |
+#define SIOCGMIIREG 0x8948 /* Read any PHY register */ |
378 |
+#define SIOCSMIIREG 0x8949 /* Write any PHY register */ |
379 |
#endif |
380 |
|
381 |
#include <linux/types.h> |
382 |
|
383 |
|
384 |
|
385 |
1.1 src/patchsets/net-tools/1.60/24_all_net-tools-1.60-virtualname.patch |
386 |
|
387 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/24_all_net-tools-1.60-virtualname.patch?rev=1.1&view=markup |
388 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/24_all_net-tools-1.60-virtualname.patch?rev=1.1&content-type=text/plain |
389 |
|
390 |
Index: 24_all_net-tools-1.60-virtualname.patch |
391 |
=================================================================== |
392 |
diff -uNr net-tools-1.60/lib/interface.c net-tools-1.60-2/lib/interface.c |
393 |
--- net-tools-1.60/lib/interface.c Sat Feb 10 14:31:15 2001 |
394 |
+++ net-tools-1.60-2/lib/interface.c Thu Jul 18 13:15:37 2002 |
395 |
@@ -579,7 +579,7 @@ |
396 |
|
397 |
void ife_print_short(struct interface *ptr) |
398 |
{ |
399 |
- printf("%-5.5s ", ptr->name); |
400 |
+ printf("%-9.8s ", ptr->name); |
401 |
printf("%5d %3d", ptr->mtu, ptr->metric); |
402 |
/* If needed, display the interface statistics. */ |
403 |
if (ptr->statistics_valid) { |
404 |
diff -uNr net-tools-1.60/netstat.c net-tools-1.60-2/netstat.c |
405 |
--- net-tools-1.60/netstat.c Sun Apr 15 10:41:17 2001 |
406 |
+++ net-tools-1.60-2/netstat.c Thu Jul 18 12:48:33 2002 |
407 |
@@ -1449,7 +1449,7 @@ |
408 |
} |
409 |
if (flag_exp < 2) { |
410 |
ife_short = 1; |
411 |
- printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n")); |
412 |
+ printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n")); |
413 |
} |
414 |
|
415 |
if (for_all_interfaces(do_if_print, &flag_all) < 0) { |
416 |
|
417 |
|
418 |
|
419 |
1.1 src/patchsets/net-tools/1.60/25_all_net-tools-1.60-cycle.patch |
420 |
|
421 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/25_all_net-tools-1.60-cycle.patch?rev=1.1&view=markup |
422 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/25_all_net-tools-1.60-cycle.patch?rev=1.1&content-type=text/plain |
423 |
|
424 |
Index: 25_all_net-tools-1.60-cycle.patch |
425 |
=================================================================== |
426 |
--- net-tools-1.60/lib/interface.c.cycle 2003-02-11 14:29:29.000000000 +0100 |
427 |
+++ net-tools-1.60/lib/interface.c 2003-02-11 14:29:29.000000000 +0100 |
428 |
@@ -90,6 +90,7 @@ |
429 |
static struct interface *int_list, *int_last; |
430 |
|
431 |
static int if_readlist_proc(char *); |
432 |
+static int if_readlist_rep(char *, struct interface *); |
433 |
|
434 |
static struct interface *add_interface(char *name) |
435 |
{ |
436 |
@@ -128,11 +129,13 @@ |
437 |
int for_all_interfaces(int (*doit) (struct interface *, void *), void *cookie) |
438 |
{ |
439 |
struct interface *ife; |
440 |
+ int err; |
441 |
|
442 |
if (!int_list && (if_readlist() < 0)) |
443 |
return -1; |
444 |
for (ife = int_list; ife; ife = ife->next) { |
445 |
- int err = doit(ife, cookie); |
446 |
+ if_readlist_rep(ife->name, ife); |
447 |
+ err = doit(ife, cookie); |
448 |
if (err) |
449 |
return err; |
450 |
} |
451 |
@@ -369,6 +372,42 @@ |
452 |
return err; |
453 |
} |
454 |
|
455 |
+ |
456 |
+static int if_readlist_rep(char *target, struct interface *ife) |
457 |
+{ |
458 |
+ FILE *fh; |
459 |
+ char buf[512]; |
460 |
+ int err; |
461 |
+ |
462 |
+ fh = fopen(_PATH_PROCNET_DEV, "r"); |
463 |
+ if (!fh) { |
464 |
+ fprintf(stderr, _("Warning: cannot open %s (%s). Limited output.\n"), |
465 |
+ _PATH_PROCNET_DEV, strerror(errno)); |
466 |
+ return if_readconf(); |
467 |
+ } |
468 |
+ fgets(buf, sizeof buf, fh); /* eat line */ |
469 |
+ fgets(buf, sizeof buf, fh); |
470 |
+ |
471 |
+ procnetdev_vsn = procnetdev_version(buf); |
472 |
+ |
473 |
+ err = 0; |
474 |
+ while (fgets(buf, sizeof buf, fh)) { |
475 |
+ char *s, name[IFNAMSIZ]; |
476 |
+ s = get_name(name, buf); |
477 |
+ get_dev_fields(s, ife); |
478 |
+ ife->statistics_valid = 1; |
479 |
+ if (target && !strcmp(target,name)) |
480 |
+ break; |
481 |
+ } |
482 |
+ if (ferror(fh)) { |
483 |
+ perror(_PATH_PROCNET_DEV); |
484 |
+ err = -1; |
485 |
+ } |
486 |
+ |
487 |
+ fclose(fh); |
488 |
+ return err; |
489 |
+} |
490 |
+ |
491 |
int if_readlist(void) |
492 |
{ |
493 |
int err = if_readlist_proc(NULL); |
494 |
--- net-tools-1.60/man/en_US/netstat.8.cycle 2001-01-07 13:43:57.000000000 +0100 |
495 |
+++ net-tools-1.60/man/en_US/netstat.8 2003-02-11 14:29:29.000000000 +0100 |
496 |
@@ -30,6 +30,7 @@ |
497 |
.RB [ \-\-program | \-p ] |
498 |
.RB [ \-\-verbose | \-v ] |
499 |
.RB [ \-\-continuous | \-c] |
500 |
+.RB [delay] |
501 |
.P |
502 |
.B netstat |
503 |
.RB { \-\-route | \-r } |
504 |
@@ -39,6 +40,7 @@ |
505 |
.RB [ \-\-numeric | \-n ] |
506 |
.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ] |
507 |
.RB [ \-\-continuous | \-c] |
508 |
+.RB [delay] |
509 |
.P |
510 |
.B netstat |
511 |
.RB { \-\-interfaces | \-i } |
512 |
@@ -50,12 +52,14 @@ |
513 |
.RB [ \-\-numeric | \-n ] |
514 |
.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ] |
515 |
.RB [ \-\-continuous | \-c] |
516 |
+.RB [delay] |
517 |
.P |
518 |
.B netstat |
519 |
.RB { \-\-groups | \-g } |
520 |
.RB [ \-\-numeric | \-n ] |
521 |
.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ] |
522 |
.RB [ \-\-continuous | \-c] |
523 |
+.RB [delay] |
524 |
.P |
525 |
.B netstat |
526 |
.RB { \-\-masquerade | \-M } |
527 |
@@ -63,12 +67,14 @@ |
528 |
.RB [ \-\-numeric | \-n ] |
529 |
.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ] |
530 |
.RB [ \-\-continuous | \-c] |
531 |
+.RB [delay] |
532 |
.P |
533 |
.B netstat |
534 |
.RB { \-\-statistics | -s } |
535 |
.RB [ \-\-tcp | \-t ] |
536 |
.RB [ \-\-udp | \-u ] |
537 |
.RB [ \-\-raw | \-w ] |
538 |
+.RB [delay] |
539 |
.P |
540 |
.B netstat |
541 |
.RB { \-\-version | \-V } |
542 |
@@ -170,6 +176,10 @@ |
543 |
Print routing information from the FIB. (This is the default.) |
544 |
.SS "\-C" |
545 |
Print routing information from the route cache. |
546 |
+.SS delay |
547 |
+Netstat will cycle printing through statistics every |
548 |
+.B delay |
549 |
+seconds. |
550 |
.IR UP . |
551 |
.P |
552 |
.SH OUTPUT |
553 |
--- net-tools-1.60/netstat.c.cycle 2003-02-11 14:29:29.000000000 +0100 |
554 |
+++ net-tools-1.60/netstat.c 2003-02-11 15:07:26.000000000 +0100 |
555 |
@@ -102,7 +102,7 @@ |
556 |
#endif |
557 |
|
558 |
/* prototypes for statistics.c */ |
559 |
-void parsesnmp(int, int, int); |
560 |
+int parsesnmp(int, int, int); |
561 |
void inittab(void); |
562 |
|
563 |
typedef enum { |
564 |
@@ -1440,6 +1440,8 @@ |
565 |
|
566 |
static int iface_info(void) |
567 |
{ |
568 |
+ static int count=0; |
569 |
+ |
570 |
if (skfd < 0) { |
571 |
if ((skfd = sockets_open(0)) < 0) { |
572 |
perror("socket"); |
573 |
@@ -1449,20 +1451,21 @@ |
574 |
} |
575 |
if (flag_exp < 2) { |
576 |
ife_short = 1; |
577 |
- printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n")); |
578 |
+ if(!(count % 8)) |
579 |
+ printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n")); |
580 |
} |
581 |
|
582 |
if (for_all_interfaces(do_if_print, &flag_all) < 0) { |
583 |
perror(_("missing interface information")); |
584 |
exit(1); |
585 |
} |
586 |
- if (flag_cnt) |
587 |
+ if (!flag_cnt) { |
588 |
free_interface_list(); |
589 |
- else { |
590 |
close(skfd); |
591 |
skfd = -1; |
592 |
} |
593 |
|
594 |
+ count++; |
595 |
return 0; |
596 |
} |
597 |
|
598 |
@@ -1478,7 +1481,7 @@ |
599 |
{ |
600 |
fprintf(stderr, _("usage: netstat [-veenNcCF] [<Af>] -r netstat {-V|--version|-h|--help}\n")); |
601 |
fprintf(stderr, _(" netstat [-vnNcaeol] [<Socket> ...]\n")); |
602 |
- fprintf(stderr, _(" netstat { [-veenNac] -i | [-cnNe] -M | -s }\n\n")); |
603 |
+ fprintf(stderr, _(" netstat { [-veenNac] -i | [-cnNe] -M | -s } [delay]\n\n")); |
604 |
|
605 |
fprintf(stderr, _(" -r, --route display routing table\n")); |
606 |
fprintf(stderr, _(" -i, --interfaces display interface table\n")); |
607 |
@@ -1514,6 +1517,7 @@ |
608 |
(int argc, char *argv[]) { |
609 |
int i; |
610 |
int lop; |
611 |
+ int reptimer = 1; |
612 |
struct option longopts[] = |
613 |
{ |
614 |
AFTRANS_OPTS, |
615 |
@@ -1655,6 +1659,12 @@ |
616 |
flag_sta++; |
617 |
} |
618 |
|
619 |
+ if(argc == optind + 1) { |
620 |
+ if((reptimer = atoi(argv[optind])) <= 0) |
621 |
+ usage(); |
622 |
+ flag_cnt++; |
623 |
+ } |
624 |
+ |
625 |
if (flag_int + flag_rou + flag_mas + flag_sta > 1) |
626 |
usage(); |
627 |
|
628 |
@@ -1666,7 +1676,7 @@ |
629 |
|
630 |
flag_arg = flag_tcp + flag_udp + flag_raw + flag_unx + flag_ipx |
631 |
+ flag_ax25 + flag_netrom + flag_igmp + flag_x25; |
632 |
- |
633 |
+ |
634 |
if (flag_mas) { |
635 |
#if HAVE_FW_MASQUERADE && HAVE_AFINET |
636 |
#if MORE_THAN_ONE_MASQ_AF |
637 |
@@ -1678,7 +1688,7 @@ |
638 |
flag_not & FLAG_NUM_PORT, flag_exp); |
639 |
if (i || !flag_cnt) |
640 |
break; |
641 |
- sleep(1); |
642 |
+ sleep(reptimer); |
643 |
} |
644 |
#else |
645 |
ENOSUPP("netstat.c", "FW_MASQUERADE"); |
646 |
@@ -1688,9 +1698,15 @@ |
647 |
} |
648 |
|
649 |
if (flag_sta) { |
650 |
+ for(;;) { |
651 |
inittab(); |
652 |
- parsesnmp(flag_raw, flag_tcp, flag_udp); |
653 |
- exit(0); |
654 |
+ i = parsesnmp(flag_raw, flag_tcp, flag_udp); |
655 |
+ |
656 |
+ if(i || !flag_cnt) |
657 |
+ break; |
658 |
+ sleep(reptimer); |
659 |
+ } |
660 |
+ return(i); |
661 |
} |
662 |
|
663 |
if (flag_rou) { |
664 |
@@ -1712,7 +1728,7 @@ |
665 |
i = route_info(afname, options); |
666 |
if (i || !flag_cnt) |
667 |
break; |
668 |
- sleep(1); |
669 |
+ sleep(reptimer); |
670 |
} |
671 |
return (i); |
672 |
} |
673 |
@@ -1721,7 +1737,7 @@ |
674 |
i = iface_info(); |
675 |
if (!flag_cnt || i) |
676 |
break; |
677 |
- sleep(1); |
678 |
+ sleep(reptimer); |
679 |
} |
680 |
return (i); |
681 |
} |
682 |
@@ -1847,7 +1863,7 @@ |
683 |
} |
684 |
if (!flag_cnt || i) |
685 |
break; |
686 |
- sleep(1); |
687 |
+ sleep(reptimer); |
688 |
prg_cache_clear(); |
689 |
} |
690 |
return (i); |
691 |
--- net-tools-1.60/statistics.c.cycle 2001-02-02 19:01:23.000000000 +0100 |
692 |
+++ net-tools-1.60/statistics.c 2003-02-11 14:29:29.000000000 +0100 |
693 |
@@ -338,7 +338,7 @@ |
694 |
} |
695 |
|
696 |
|
697 |
-void parsesnmp(int flag_raw, int flag_tcp, int flag_udp) |
698 |
+int parsesnmp(int flag_raw, int flag_tcp, int flag_udp) |
699 |
{ |
700 |
FILE *f; |
701 |
|
702 |
@@ -347,12 +347,14 @@ |
703 |
f = fopen("/proc/net/snmp", "r"); |
704 |
if (!f) { |
705 |
perror(_("cannot open /proc/net/snmp")); |
706 |
- return; |
707 |
+ return(1); |
708 |
} |
709 |
process_fd(f); |
710 |
|
711 |
- if (ferror(f)) |
712 |
+ if (ferror(f)) { |
713 |
perror("/proc/net/snmp"); |
714 |
+ return(1); |
715 |
+ } |
716 |
|
717 |
fclose(f); |
718 |
|
719 |
@@ -361,12 +363,14 @@ |
720 |
if (f) { |
721 |
process_fd(f); |
722 |
|
723 |
- if (ferror(f)) |
724 |
- perror("/proc/net/netstat"); |
725 |
+ if (ferror(f)) { |
726 |
+ perror("/proc/net/netstat"); |
727 |
+ return(1); |
728 |
+ } |
729 |
|
730 |
fclose(f); |
731 |
} |
732 |
- return; |
733 |
+ return(0); |
734 |
} |
735 |
|
736 |
|
737 |
|
738 |
|
739 |
|
740 |
1.1 src/patchsets/net-tools/1.60/26_all_net-tools-1.60-overflow.patch |
741 |
|
742 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/26_all_net-tools-1.60-overflow.patch?rev=1.1&view=markup |
743 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/26_all_net-tools-1.60-overflow.patch?rev=1.1&content-type=text/plain |
744 |
|
745 |
Index: 26_all_net-tools-1.60-overflow.patch |
746 |
=================================================================== |
747 |
diff -ur net-tools-1.60.orig/netstat.c net-tools-1.60/netstat.c |
748 |
--- net-tools-1.60.orig/netstat.c 2004-04-07 11:47:05.000000000 -0400 |
749 |
+++ net-tools-1.60/netstat.c 2004-04-07 16:47:15.000000000 -0400 |
750 |
@@ -777,7 +777,8 @@ |
751 |
local_addr[22 - strlen(buffer)] = '\0'; |
752 |
|
753 |
strcat(local_addr, ":"); |
754 |
- strcat(local_addr, buffer); |
755 |
+ strncat(local_addr, buffer, sizeof(local_addr)); |
756 |
+ local_addr[sizeof(local_addr)-1] = 0; |
757 |
snprintf(buffer, sizeof(buffer), "%s", |
758 |
get_sname(htons(rem_port), "tcp", flag_not & FLAG_NUM_PORT)); |
759 |
|
760 |
@@ -785,7 +786,8 @@ |
761 |
rem_addr[22 - strlen(buffer)] = '\0'; |
762 |
|
763 |
strcat(rem_addr, ":"); |
764 |
- strcat(rem_addr, buffer); |
765 |
+ strncat(rem_addr, buffer, sizeof(rem_addr)); |
766 |
+ rem_addr[sizeof(rem_addr)-1] = 0; |
767 |
timers[0] = '\0'; |
768 |
|
769 |
if (flag_opt) |
770 |
@@ -926,7 +928,8 @@ |
771 |
if ((strlen(local_addr) + strlen(buffer)) > 22) |
772 |
local_addr[22 - strlen(buffer)] = '\0'; |
773 |
strcat(local_addr, ":"); |
774 |
- strcat(local_addr, buffer); |
775 |
+ strncat(local_addr, buffer, sizeof(local_addr)); |
776 |
+ local_addr[sizeof(local_addr)-1] = 0; |
777 |
|
778 |
snprintf(buffer, sizeof(buffer), "%s", |
779 |
get_sname(htons(rem_port), "udp", flag_not & FLAG_NUM_PORT)); |
780 |
@@ -935,7 +938,8 @@ |
781 |
if ((strlen(rem_addr) + strlen(buffer)) > 22) |
782 |
rem_addr[22 - strlen(buffer)] = '\0'; |
783 |
strcat(rem_addr, ":"); |
784 |
- strcat(rem_addr, buffer); |
785 |
+ strncat(rem_addr, buffer, sizeof(rem_addr)); |
786 |
+ rem_addr[sizeof(rem_addr)-1] = 0; |
787 |
|
788 |
timers[0] = '\0'; |
789 |
if (flag_opt) |
790 |
@@ -1045,7 +1049,8 @@ |
791 |
if ((strlen(local_addr) + strlen(buffer)) > 22) |
792 |
local_addr[22 - strlen(buffer)] = '\0'; |
793 |
strcat(local_addr, ":"); |
794 |
- strcat(local_addr, buffer); |
795 |
+ strncat(local_addr, buffer, sizeof(local_addr)); |
796 |
+ local_addr[sizeof(local_addr)-1] = 0; |
797 |
|
798 |
snprintf(buffer, sizeof(buffer), "%s", |
799 |
get_sname(htons(rem_port), "raw", flag_not & FLAG_NUM_PORT)); |
800 |
@@ -1054,7 +1059,8 @@ |
801 |
if ((strlen(rem_addr) + strlen(buffer)) > 22) |
802 |
rem_addr[22 - strlen(buffer)] = '\0'; |
803 |
strcat(rem_addr, ":"); |
804 |
- strcat(rem_addr, buffer); |
805 |
+ strncat(rem_addr, buffer, sizeof(rem_addr)); |
806 |
+ rem_addr[sizeof(rem_addr)-1] = 0; |
807 |
|
808 |
timers[0] = '\0'; |
809 |
if (flag_opt) |
810 |
|
811 |
|
812 |
|
813 |
1.1 src/patchsets/net-tools/1.60/27_all_net-tools-1.60-netstat_ulong.patch |
814 |
|
815 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/27_all_net-tools-1.60-netstat_ulong.patch?rev=1.1&view=markup |
816 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/27_all_net-tools-1.60-netstat_ulong.patch?rev=1.1&content-type=text/plain |
817 |
|
818 |
Index: 27_all_net-tools-1.60-netstat_ulong.patch |
819 |
=================================================================== |
820 |
--- net-tools-1.60/netstat.c.netstat_ulong 2004-11-11 14:28:44.000000000 +0100 |
821 |
+++ net-tools-1.60/netstat.c 2004-11-11 14:31:14.099313000 +0100 |
822 |
@@ -273,7 +273,7 @@ |
823 |
strcpy(pn->name,name); |
824 |
} |
825 |
|
826 |
-static const char *prg_cache_get(int inode) |
827 |
+static const char *prg_cache_get(unsigned long inode) |
828 |
{ |
829 |
unsigned hi=PRG_HASHIT(inode); |
830 |
struct prg_node *pn; |
831 |
|
832 |
|
833 |
|
834 |
1.1 src/patchsets/net-tools/1.60/50_all_net-tools-1.60-multiline-string.patch |
835 |
|
836 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/50_all_net-tools-1.60-multiline-string.patch?rev=1.1&view=markup |
837 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/50_all_net-tools-1.60-multiline-string.patch?rev=1.1&content-type=text/plain |
838 |
|
839 |
Index: 50_all_net-tools-1.60-multiline-string.patch |
840 |
=================================================================== |
841 |
diff -Naurp net-tools-1.60.orig/mii-tool.c net-tools-1.60/mii-tool.c |
842 |
--- net-tools-1.60.orig/mii-tool.c 2000-05-21 10:31:17.000000000 -0400 |
843 |
+++ net-tools-1.60/mii-tool.c 2003-03-19 09:55:33.000000000 -0500 |
844 |
@@ -379,16 +379,16 @@ static void watch_one_xcvr(int skfd, cha |
845 |
/*--------------------------------------------------------------------*/ |
846 |
|
847 |
const char *usage = |
848 |
-"usage: %s [-VvRrwl] [-A media,... | -F media] [interface ...] |
849 |
- -V, --version display version information |
850 |
- -v, --verbose more verbose output |
851 |
- -R, --reset reset MII to poweron state |
852 |
- -r, --restart restart autonegotiation |
853 |
- -w, --watch monitor for link status changes |
854 |
- -l, --log with -w, write events to syslog |
855 |
- -A, --advertise=media,... advertise only specified media |
856 |
- -F, --force=media force specified media technology |
857 |
-media: 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD, |
858 |
+"usage: %s [-VvRrwl] [-A media,... | -F media] [interface ...]\n\ |
859 |
+ -V, --version display version information\n\ |
860 |
+ -v, --verbose more verbose output\n\ |
861 |
+ -R, --reset reset MII to poweron state\n\ |
862 |
+ -r, --restart restart autonegotiation\n\ |
863 |
+ -w, --watch monitor for link status changes\n\ |
864 |
+ -l, --log with -w, write events to syslog\n\ |
865 |
+ -A, --advertise=media,... advertise only specified media\n\ |
866 |
+ -F, --force=media force specified media technology\n\ |
867 |
+media: 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD,\n\ |
868 |
(to advertise both HD and FD) 100baseTx, 10baseT\n"; |
869 |
|
870 |
int main(int argc, char **argv) |
871 |
|
872 |
|
873 |
|
874 |
1.1 src/patchsets/net-tools/1.60/51_all_net-tools-1.60-man.patch |
875 |
|
876 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/51_all_net-tools-1.60-man.patch?rev=1.1&view=markup |
877 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/51_all_net-tools-1.60-man.patch?rev=1.1&content-type=text/plain |
878 |
|
879 |
Index: 51_all_net-tools-1.60-man.patch |
880 |
=================================================================== |
881 |
splite writes: |
882 |
The netstat(8) man page in sys-apps/net-tools states that the "-i" and |
883 |
"--interfaces" flags to netstat take an optional argument denoting a |
884 |
particular interface when it in fact does not. |
885 |
|
886 |
http://bugs.gentoo.org/show_bug.cgi?id=29677 |
887 |
|
888 |
--- man/en_US/netstat.8.orig 2003-09-26 10:08:19.000000000 -0500 |
889 |
+++ man/en_US/netstat.8 2003-09-26 10:25:39.000000000 -0500 |
890 |
@@ -44,7 +44,6 @@ |
891 |
.P |
892 |
.B netstat |
893 |
.RB { \-\-interfaces | \-i } |
894 |
-.RI [ iface ] |
895 |
.RB [ \-\-all | \-a ] |
896 |
.RB [ \-\-extend | \-e [ \-\-extend | \-e] ] |
897 |
.RB [ \-\-verbose | \-v ] |
898 |
@@ -107,9 +106,8 @@ |
899 |
Display the kernel routing tables. |
900 |
.SS "\-\-groups , \-g" |
901 |
Display multicast group membership information for IPv4 and IPv6. |
902 |
-.SS "\-\-interface=\fIiface \fR, \fB\-i" |
903 |
-Display a table of all network interfaces, or the specified |
904 |
-.IR iface ) . |
905 |
+.SS "\-\-interface , \-i" |
906 |
+Display a table of all network interfaces. |
907 |
.SS "\-\-masquerade , \-M" |
908 |
Display a list of masqueraded connections. |
909 |
.SS "\-\-statistics , \-s" |
910 |
|
911 |
|
912 |
|
913 |
1.1 src/patchsets/net-tools/1.60/52_all_net-tools-1.60-numeric-ports.patch |
914 |
|
915 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/52_all_net-tools-1.60-numeric-ports.patch?rev=1.1&view=markup |
916 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/52_all_net-tools-1.60-numeric-ports.patch?rev=1.1&content-type=text/plain |
917 |
|
918 |
Index: 52_all_net-tools-1.60-numeric-ports.patch |
919 |
=================================================================== |
920 |
Mads Martin Joergensen writes: |
921 |
According to the manual the option "--numeric-ports" should not |
922 |
affect host resolution, but it does. All connected hosts are displayed |
923 |
with numeric values instead of their FQDN. |
924 |
|
925 |
http://bugs.gentoo.org/show_bug.cgi?id=76756 |
926 |
|
927 |
--- net-tools-1.60/netstat.c |
928 |
+++ net-tools-1.60/netstat.c |
929 |
@@ -850,8 +850,8 @@ |
930 |
txq = 0L; |
931 |
} |
932 |
safe_strncpy(local_addr, ap->sprint((struct sockaddr *) &localaddr, |
933 |
- flag_not), sizeof(local_addr)); |
934 |
+ flag_not & FLAG_NUM_HOST), sizeof(local_addr)); |
935 |
- safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, flag_not), |
936 |
+ safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, flag_not & FLAG_NUM_HOST), |
937 |
sizeof(rem_addr)); |
938 |
if (flag_all || (flag_lst && !rem_port) || (!flag_lst && rem_port)) { |
939 |
snprintf(buffer, sizeof(buffer), "%s", |
940 |
@@ -1004,7 +1004,7 @@ |
941 |
if (flag_all || (notnull(remaddr) && !flag_lst) || (!notnull(remaddr) && flag_lst)) |
942 |
{ |
943 |
safe_strncpy(local_addr, ap->sprint((struct sockaddr *) &localaddr, |
944 |
- flag_not), sizeof(local_addr)); |
945 |
+ flag_not & FLAG_NUM_HOST), sizeof(local_addr)); |
946 |
snprintf(buffer, sizeof(buffer), "%s", |
947 |
get_sname(htons(local_port), "udp", |
948 |
flag_not & FLAG_NUM_PORT)); |
949 |
@@ -1016,7 +1016,7 @@ |
950 |
snprintf(buffer, sizeof(buffer), "%s", |
951 |
get_sname(htons(rem_port), "udp", flag_not & FLAG_NUM_PORT)); |
952 |
safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, |
953 |
- flag_not), sizeof(rem_addr)); |
954 |
+ flag_not & FLAG_NUM_HOST), sizeof(rem_addr)); |
955 |
if ((strlen(rem_addr) + strlen(buffer)) > 22) |
956 |
rem_addr[22 - strlen(buffer)] = '\0'; |
957 |
strcat(rem_addr, ":"); |
958 |
@@ -1126,7 +1126,7 @@ |
959 |
get_sname(htons(local_port), "raw", |
960 |
flag_not & FLAG_NUM_PORT)); |
961 |
safe_strncpy(local_addr, ap->sprint((struct sockaddr *) &localaddr, |
962 |
- flag_not), sizeof(local_addr)); |
963 |
+ flag_not & FLAG_NUM_HOST), sizeof(local_addr)); |
964 |
if ((strlen(local_addr) + strlen(buffer)) > 22) |
965 |
local_addr[22 - strlen(buffer)] = '\0'; |
966 |
strcat(local_addr, ":"); |
967 |
@@ -1135,7 +1135,7 @@ |
968 |
snprintf(buffer, sizeof(buffer), "%s", |
969 |
get_sname(htons(rem_port), "raw", flag_not & FLAG_NUM_PORT)); |
970 |
safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, |
971 |
- flag_not), sizeof(rem_addr)); |
972 |
+ flag_not & FLAG_NUM_HOST), sizeof(rem_addr)); |
973 |
if ((strlen(rem_addr) + strlen(buffer)) > 22) |
974 |
rem_addr[22 - strlen(buffer)] = '\0'; |
975 |
strcat(rem_addr, ":"); |
976 |
|
977 |
|
978 |
|
979 |
1.1 src/patchsets/net-tools/1.60/53_all_net-tools-1.60-appletalk.patch |
980 |
|
981 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/53_all_net-tools-1.60-appletalk.patch?rev=1.1&view=markup |
982 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/53_all_net-tools-1.60-appletalk.patch?rev=1.1&content-type=text/plain |
983 |
|
984 |
Index: 53_all_net-tools-1.60-appletalk.patch |
985 |
=================================================================== |
986 |
Ripped from debian's patchset |
987 |
|
988 |
--- net-tools-1.60.orig/lib/ddp_gr.c |
989 |
+++ net-tools-1.60/lib/ddp_gr.c |
990 |
@@ -1,3 +1,20 @@ |
991 |
+/* |
992 |
+ * lib/ddp_gr.c Prinbting of DDP (AppleTalk) routing table |
993 |
+ * used by the NET-LIB. |
994 |
+ * |
995 |
+ * NET-LIB |
996 |
+ * |
997 |
+ * Version: $Id: 53_all_net-tools-1.60-appletalk.patch,v 1.1 2008/04/14 04:02:17 vapier Exp $ |
998 |
+ * |
999 |
+ * Author: Ajax <ajax@×××××××××.org> |
1000 |
+ * |
1001 |
+ * Modification: |
1002 |
+ * 2002-06-02 integrated into main source by Bernd Eckenfels |
1003 |
+ * |
1004 |
+ */ |
1005 |
+ |
1006 |
+/* TODO: name lookups (/etc/atalk.names? NBP?) */ |
1007 |
+ |
1008 |
#include "config.h" |
1009 |
|
1010 |
#if HAVE_AFATALK |
1011 |
@@ -16,9 +33,61 @@ |
1012 |
#include "pathnames.h" |
1013 |
#include "intl.h" |
1014 |
|
1015 |
+/* stolen from inet_gr.c */ |
1016 |
+#define flags_decode(i,o) do { \ |
1017 |
+ o[0] = '\0'; \ |
1018 |
+ if (i & RTF_UP) strcat(o, "U"); \ |
1019 |
+ if (i & RTF_GATEWAY) strcat(o, "G"); \ |
1020 |
+ if (i & RTF_REJECT) strcat(o, "!"); \ |
1021 |
+ if (i & RTF_HOST) strcat(o, "H"); \ |
1022 |
+ if (i & RTF_REINSTATE) strcat(o, "R"); \ |
1023 |
+ if (i & RTF_DYNAMIC) strcat(o, "D"); \ |
1024 |
+ if (i & RTF_MODIFIED) strcat(o, "M"); \ |
1025 |
+ if (i & RTF_DEFAULT) strcat(o, "d"); \ |
1026 |
+ if (i & RTF_ALLONLINK) strcat(o, "a"); \ |
1027 |
+ if (i & RTF_ADDRCONF) strcat(o, "c"); \ |
1028 |
+ if (i & RTF_NONEXTHOP) strcat(o, "o"); \ |
1029 |
+ if (i & RTF_EXPIRES) strcat(o, "e"); \ |
1030 |
+ if (i & RTF_CACHE) strcat(o, "c"); \ |
1031 |
+ if (i & RTF_FLOW) strcat(o, "f"); \ |
1032 |
+ if (i & RTF_POLICY) strcat(o, "p"); \ |
1033 |
+ if (i & RTF_LOCAL) strcat(o, "l"); \ |
1034 |
+ if (i & RTF_MTU) strcat(o, "u"); \ |
1035 |
+ if (i & RTF_WINDOW) strcat(o, "w"); \ |
1036 |
+ if (i & RTF_IRTT) strcat(o, "i"); \ |
1037 |
+ if (i & RTF_NOTCACHED) strcat(o, "n"); \ |
1038 |
+ } while (0) |
1039 |
+ |
1040 |
int DDP_rprint(int options) |
1041 |
{ |
1042 |
- fprintf(stderr, _("Routing table for `ddp' not yet supported.\n")); |
1043 |
- return (1); |
1044 |
+ FILE *fp; |
1045 |
+ char *dest, *gw, *dev, *flags; |
1046 |
+ char oflags[32]; |
1047 |
+ char *hdr = "Destination Gateway Device Flags"; |
1048 |
+ |
1049 |
+ fp = fopen(_PATH_PROCNET_ATALK_ROUTE, "r"); |
1050 |
+ |
1051 |
+ if (!fp) { |
1052 |
+ perror("Error opening " _PATH_PROCNET_ATALK_ROUTE); |
1053 |
+ fprintf(stderr, "DDP (AppleTalk) not configured on this system.\n"); |
1054 |
+ return 1; |
1055 |
+ } |
1056 |
+ |
1057 |
+ fscanf(fp, "%as %as %as %as\n", &dest, &gw, &flags, &dev); |
1058 |
+ free(dest); free(gw); free(dev); free(flags); |
1059 |
+ |
1060 |
+ printf("%s\n", hdr); |
1061 |
+ |
1062 |
+ while (fscanf(fp, "%as %as %as %as\n", &dest, &gw, &flags, &dev) == 4) { |
1063 |
+ int iflags = atoi(flags); |
1064 |
+ flags_decode(iflags, oflags); |
1065 |
+ printf("%-16s%-16s%-16s%-s\n", dest, gw, dev, oflags); |
1066 |
+ free(dest); free(gw); free(dev); free(flags); |
1067 |
+ } |
1068 |
+ |
1069 |
+ fclose(fp); |
1070 |
+ |
1071 |
+ return 0; |
1072 |
+ |
1073 |
} |
1074 |
#endif |
1075 |
--- net-tools-1.60.orig/lib/pathnames.h |
1076 |
+++ net-tools-1.60/lib/pathnames.h |
1077 |
@@ -45,6 +44,7 @@ |
1078 |
#define _PATH_PROCNET_X25 "/proc/net/x25" |
1079 |
#define _PATH_PROCNET_X25_ROUTE "/proc/net/x25_routes" |
1080 |
#define _PATH_PROCNET_DEV_MCAST "/proc/net/dev_mcast" |
1081 |
+#define _PATH_PROCNET_ATALK_ROUTE "/proc/net/atalk_route" |
1082 |
|
1083 |
/* pathname for the netlink device */ |
1084 |
#define _PATH_DEV_ROUTE "/dev/route" |
1085 |
|
1086 |
|
1087 |
|
1088 |
1.1 src/patchsets/net-tools/1.60/54_all_net-tools-1.60-wide.patch |
1089 |
|
1090 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/54_all_net-tools-1.60-wide.patch?rev=1.1&view=markup |
1091 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/54_all_net-tools-1.60-wide.patch?rev=1.1&content-type=text/plain |
1092 |
|
1093 |
Index: 54_all_net-tools-1.60-wide.patch |
1094 |
=================================================================== |
1095 |
comabug@×××××.com writes: |
1096 |
|
1097 |
net-tools' netstat should have a -W flag like FreeBSD. |
1098 |
There is currently no way to get the full hostname from netstat |
1099 |
for local/remote hostnames. |
1100 |
|
1101 |
http://bugs.gentoo.org/show_bug.cgi?id=53731 |
1102 |
|
1103 |
diff -ru net-tools-1.60.orig/man/en_US/netstat.8 net-tools-1.60/man/en_US/netstat.8 |
1104 |
--- net-tools-1.60.orig/man/en_US/netstat.8 2001-01-07 13:43:57.000000000 +0100 |
1105 |
+++ net-tools-1.60/man/en_US/netstat.8 2004-06-12 19:30:55.566822928 +0200 |
1106 |
@@ -24,6 +24,7 @@ |
1107 |
.RB [ \-\-all | \-a ] |
1108 |
.RB [ \-\-numeric | \-n ] |
1109 |
.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ] |
1110 |
+.RB [ \-\-wide | \-W] |
1111 |
.RB [ \-\-symbolic | \-N ] |
1112 |
.RB [ \-\-extend | \-e [ \-\-extend | \-e] ] |
1113 |
.RB [ \-\-timers | \-o ] |
1114 |
@@ -55,6 +56,7 @@ |
1115 |
.RB { \-\-groups | \-g } |
1116 |
.RB [ \-\-numeric | \-n ] |
1117 |
.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ] |
1118 |
+.RB [ \-\-wide | \-W] |
1119 |
.RB [ \-\-continuous | \-c] |
1120 |
.P |
1121 |
.B netstat |
1122 |
@@ -124,6 +126,8 @@ |
1123 |
.SS "\-\-numeric-users" |
1124 |
shows numerical user IDs but does not affect the resolution of host or |
1125 |
port names. |
1126 |
+.SS "\-\-wide , \-W" |
1127 |
+Don't truncate host names. |
1128 |
|
1129 |
.SS "\-\-protocol=\fIfamily \fR, \fB\-A" |
1130 |
Specifies the address families (perhaps better described as low level |
1131 |
diff -ru net-tools-1.60.orig/netstat.c net-tools-1.60/netstat.c |
1132 |
--- net-tools-1.60.orig/netstat.c 2001-04-15 16:41:17.000000000 +0200 |
1133 |
+++ net-tools-1.60/netstat.c 2004-06-12 19:50:23.459276288 +0200 |
1134 |
@@ -149,6 +149,7 @@ |
1135 |
int flag_prg = 0; |
1136 |
int flag_arg = 0; |
1137 |
int flag_ver = 0; |
1138 |
+int flag_wid = 0; |
1139 |
|
1140 |
FILE *procinfo; |
1141 |
|
1142 |
@@ -772,7 +773,7 @@ |
1143 |
get_sname(htons(local_port), "tcp", |
1144 |
flag_not & FLAG_NUM_PORT)); |
1145 |
|
1146 |
- if ((strlen(local_addr) + strlen(buffer)) > 22) |
1147 |
+ if (!flag_wid && ((strlen(local_addr) + strlen(buffer)) > 22)) |
1148 |
local_addr[22 - strlen(buffer)] = '\0'; |
1149 |
|
1150 |
strcat(local_addr, ":"); |
1151 |
@@ -780,7 +781,7 @@ |
1152 |
snprintf(buffer, sizeof(buffer), "%s", |
1153 |
get_sname(htons(rem_port), "tcp", flag_not & FLAG_NUM_PORT)); |
1154 |
|
1155 |
- if ((strlen(rem_addr) + strlen(buffer)) > 22) |
1156 |
+ if (!flag_wid && ((strlen(rem_addr) + strlen(buffer)) > 22)) |
1157 |
rem_addr[22 - strlen(buffer)] = '\0'; |
1158 |
|
1159 |
strcat(rem_addr, ":"); |
1160 |
@@ -922,7 +923,7 @@ |
1161 |
snprintf(buffer, sizeof(buffer), "%s", |
1162 |
get_sname(htons(local_port), "udp", |
1163 |
flag_not & FLAG_NUM_PORT)); |
1164 |
- if ((strlen(local_addr) + strlen(buffer)) > 22) |
1165 |
+ if (!flag_wid && ((strlen(local_addr) + strlen(buffer)) > 22)) |
1166 |
local_addr[22 - strlen(buffer)] = '\0'; |
1167 |
strcat(local_addr, ":"); |
1168 |
strcat(local_addr, buffer); |
1169 |
@@ -931,7 +932,7 @@ |
1170 |
get_sname(htons(rem_port), "udp", flag_not & FLAG_NUM_PORT)); |
1171 |
safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, |
1172 |
flag_not & FLAG_NUM_HOST), sizeof(rem_addr)); |
1173 |
- if ((strlen(rem_addr) + strlen(buffer)) > 22) |
1174 |
+ if (!flag_wid && ((strlen(rem_addr) + strlen(buffer)) > 22)) |
1175 |
rem_addr[22 - strlen(buffer)] = '\0'; |
1176 |
strcat(rem_addr, ":"); |
1177 |
strcat(rem_addr, buffer); |
1178 |
@@ -1041,7 +1042,7 @@ |
1179 |
flag_not & FLAG_NUM_PORT)); |
1180 |
safe_strncpy(local_addr, ap->sprint((struct sockaddr *) &localaddr, |
1181 |
flag_not & FLAG_NUM_HOST), sizeof(local_addr)); |
1182 |
- if ((strlen(local_addr) + strlen(buffer)) > 22) |
1183 |
+ if (!flag_wid && ((strlen(local_addr) + strlen(buffer)) > 22)) |
1184 |
local_addr[22 - strlen(buffer)] = '\0'; |
1185 |
strcat(local_addr, ":"); |
1186 |
strcat(local_addr, buffer); |
1187 |
@@ -1050,7 +1051,7 @@ |
1188 |
get_sname(htons(rem_port), "raw", flag_not & FLAG_NUM_PORT)); |
1189 |
safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, |
1190 |
flag_not & FLAG_NUM_HOST), sizeof(rem_addr)); |
1191 |
- if ((strlen(rem_addr) + strlen(buffer)) > 22) |
1192 |
+ if (!flag_wid && ((strlen(rem_addr) + strlen(buffer)) > 22)) |
1193 |
rem_addr[22 - strlen(buffer)] = '\0'; |
1194 |
strcat(rem_addr, ":"); |
1195 |
strcat(rem_addr, buffer); |
1196 |
@@ -1492,6 +1493,7 @@ |
1197 |
fprintf(stderr, _(" --numeric-hosts don't resolve host names\n")); |
1198 |
fprintf(stderr, _(" --numeric-ports don't resolve port names\n")); |
1199 |
fprintf(stderr, _(" --numeric-users don't resolve user names\n")); |
1200 |
+ fprintf(stderr, _(" -W, --wide don't truncate host names\n")); |
1201 |
fprintf(stderr, _(" -N, --symbolic resolve hardware names\n")); |
1202 |
fprintf(stderr, _(" -e, --extend display other/more information\n")); |
1203 |
fprintf(stderr, _(" -p, --programs display PID/Program name for sockets\n")); |
1204 |
@@ -1541,6 +1543,7 @@ |
1205 |
{"numeric-hosts", 0, 0, '!'}, |
1206 |
{"numeric-ports", 0, 0, '@'}, |
1207 |
{"numeric-users", 0, 0, '#'}, |
1208 |
+ {"wide", 0, 0, 'W'}, |
1209 |
{"symbolic", 0, 0, 'N'}, |
1210 |
{"cache", 0, 0, 'C'}, |
1211 |
{"fib", 0, 0, 'F'}, |
1212 |
@@ -1556,7 +1559,7 @@ |
1213 |
getroute_init(); /* Set up AF routing support */ |
1214 |
|
1215 |
afname[0] = '\0'; |
1216 |
- while ((i = getopt_long(argc, argv, "MCFA:acdegphinNorstuVv?wxl", longopts, &lop)) != EOF) |
1217 |
+ while ((i = getopt_long(argc, argv, "MCFA:acdegphinWNorstuVv?wxl", longopts, &lop)) != EOF) |
1218 |
switch (i) { |
1219 |
case -1: |
1220 |
break; |
1221 |
@@ -1612,6 +1615,9 @@ |
1222 |
case '#': |
1223 |
flag_not |= FLAG_NUM_USER; |
1224 |
break; |
1225 |
+ case 'W': |
1226 |
+ flag_wid++; |
1227 |
+ break; |
1228 |
case 'N': |
1229 |
flag_not |= FLAG_SYM; |
1230 |
break; |
1231 |
|
1232 |
|
1233 |
|
1234 |
1.1 src/patchsets/net-tools/1.60/55_all_net-tools-1.60-Makefile.patch |
1235 |
|
1236 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/55_all_net-tools-1.60-Makefile.patch?rev=1.1&view=markup |
1237 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/55_all_net-tools-1.60-Makefile.patch?rev=1.1&content-type=text/plain |
1238 |
|
1239 |
Index: 55_all_net-tools-1.60-Makefile.patch |
1240 |
=================================================================== |
1241 |
Let's clean up the Makefile ... we want to: |
1242 |
- make sure COPTS is clean for clobbering with user $CFLAGS |
1243 |
- make sure LOPTS is clean for clobbering with user $LDFLAGS |
1244 |
- remove all references to config.h since we generate it for the |
1245 |
user and we really do NOT want the interactive configure running |
1246 |
- make sure libdir depends on version.h to fix parallel builds |
1247 |
|
1248 |
--- Makefile.orig 2005-01-10 13:11:00.369702792 -0500 |
1249 |
+++ Makefile 2005-01-10 13:15:36.542718112 -0500 |
1250 |
@@ -88,7 +88,7 @@ |
1251 |
|
1252 |
# Compiler and Linker Options |
1253 |
# You may need to uncomment and edit these if you are using libc5 and IPv6. |
1254 |
-COPTS = -D_GNU_SOURCE -O2 -Wall -g # -I/usr/inet6/include |
1255 |
+COPTS = |
1256 |
ifeq ($(origin LOPTS), undefined) |
1257 |
LOPTS = |
1258 |
endif |
1259 |
@@ -113,7 +113,7 @@ |
1260 |
|
1261 |
NET_LIB = $(NET_LIB_PATH)/lib$(NET_LIB_NAME).a |
1262 |
|
1263 |
-CFLAGS = $(COPTS) -I. -idirafter ./include/ -I$(NET_LIB_PATH) |
1264 |
+CFLAGS = $(COPTS) -I. -idirafter ./include/ -I$(NET_LIB_PATH) -D_GNU_SOURCE -Wall |
1265 |
LDFLAGS = $(LOPTS) -L$(NET_LIB_PATH) |
1266 |
|
1267 |
SUBDIRS = man/ $(NET_LIB_PATH)/ |
1268 |
@@ -127,12 +127,12 @@ |
1269 |
|
1270 |
MDEFINES = COPTS='$(COPTS)' LOPTS='$(LOPTS)' TOPDIR='$(TOPDIR)' |
1271 |
|
1272 |
-%.o: %.c config.h version.h intl.h net-features.h $< |
1273 |
+%.o: %.c version.h intl.h net-features.h $< |
1274 |
$(CC) $(CFLAGS) -c $< |
1275 |
|
1276 |
-all: config.h version.h subdirs $(PROGS) |
1277 |
+all: version.h subdirs $(PROGS) |
1278 |
|
1279 |
-config: cleanconfig config.h |
1280 |
+config: cleanconfig |
1281 |
|
1282 |
install: all savebin installbin installdata |
1283 |
|
1284 |
@@ -159,14 +159,6 @@ |
1285 |
@tar -cvz -f ../net-tools-$(RELEASE).tar.gz -C .. net-tools |
1286 |
|
1287 |
|
1288 |
-config.h: config.in Makefile |
1289 |
- @echo "Configuring the Linux net-tools (NET-3 Base Utilities)..." ; echo |
1290 |
- @if [ config.status -nt config.in ]; \ |
1291 |
- then ./configure.sh config.status; \ |
1292 |
- else ./configure.sh config.in; \ |
1293 |
- fi |
1294 |
- |
1295 |
- |
1296 |
version.h: Makefile |
1297 |
@echo "#define RELEASE \"net-tools $(RELEASE)\"" >version.h |
1298 |
|
1299 |
@@ -175,7 +167,7 @@ |
1300 |
|
1301 |
i18n.h: i18ndir |
1302 |
|
1303 |
-libdir: |
1304 |
+libdir: version.h |
1305 |
@$(MAKE) -C $(NET_LIB_PATH) $(MDEFINES) |
1306 |
|
1307 |
i18ndir: |
1308 |
|
1309 |
|
1310 |
|
1311 |
1.1 src/patchsets/net-tools/1.60/56_all_net-tools-1.60-ipv6-hostname.patch |
1312 |
|
1313 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/56_all_net-tools-1.60-ipv6-hostname.patch?rev=1.1&view=markup |
1314 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/56_all_net-tools-1.60-ipv6-hostname.patch?rev=1.1&content-type=text/plain |
1315 |
|
1316 |
Index: 56_all_net-tools-1.60-ipv6-hostname.patch |
1317 |
=================================================================== |
1318 |
Patch by pasi.valminen@×××.fi to fix FQDN handling with AAAA records |
1319 |
|
1320 |
http://bugs.gentoo.org/show_bug.cgi?id=42650 |
1321 |
|
1322 |
--- hostname.c.orig 2005-02-11 21:17:51.000000000 -0500 |
1323 |
+++ hostname.c 2005-02-11 21:18:48.000000000 -0500 |
1324 |
@@ -35,6 +35,10 @@ |
1325 |
#include <getopt.h> |
1326 |
#include <string.h> |
1327 |
#include <netdb.h> |
1328 |
+#ifdef IPV6 |
1329 |
+#include <sys/socket.h> /* for PF_INET6 */ |
1330 |
+#include <sys/types.h> /* for inet_ntop */ |
1331 |
+#endif /* IPV6 */ |
1332 |
#include <errno.h> |
1333 |
#include <sys/param.h> |
1334 |
#include <netinet/in.h> |
1335 |
@@ -127,15 +131,23 @@ |
1336 |
static void showhname(char *hname, int c) |
1337 |
{ |
1338 |
struct hostent *hp; |
1339 |
+#ifdef IPV6 |
1340 |
+ struct in6_addr **ip6; |
1341 |
+#endif /* IPV6 */ |
1342 |
register char *p, **alias; |
1343 |
struct in_addr **ip; |
1344 |
|
1345 |
if (opt_v) |
1346 |
fprintf(stderr, _("Resolving `%s' ...\n"), hname); |
1347 |
- if (!(hp = gethostbyname(hname))) { |
1348 |
+ if ( |
1349 |
+#ifdef IPV6 |
1350 |
+ !(hp = gethostbyname2(hname, PF_INET6)) && |
1351 |
+#endif /* IPV6 */ |
1352 |
+ !(hp = gethostbyname(hname))) { |
1353 |
herror(program_name); |
1354 |
exit(1); |
1355 |
} |
1356 |
+ |
1357 |
if (opt_v) { |
1358 |
fprintf(stderr, _("Result: h_name=`%s'\n"), |
1359 |
hp->h_name); |
1360 |
@@ -144,11 +156,28 @@ |
1361 |
while (alias[0]) |
1362 |
fprintf(stderr, _("Result: h_aliases=`%s'\n"), |
1363 |
*alias++); |
1364 |
- |
1365 |
- ip = (struct in_addr **) hp->h_addr_list; |
1366 |
- while (ip[0]) |
1367 |
- fprintf(stderr, _("Result: h_addr_list=`%s'\n"), |
1368 |
- inet_ntoa(**ip++)); |
1369 |
+#ifdef IPV6 |
1370 |
+ if(hp->h_addrtype == PF_INET6) { |
1371 |
+ char addr[INET6_ADDRSTRLEN + 1]; |
1372 |
+ addr[INET6_ADDRSTRLEN] = '\0'; |
1373 |
+ ip6 = (struct in6_addr **) hp->h_addr_list; |
1374 |
+ while(ip6[0]) { |
1375 |
+ if(inet_ntop(PF_INET6, *ip6++, addr, INET6_ADDRSTRLEN)) |
1376 |
+ fprintf(stderr, _("Result: h_addr_list=`%s'\n"), addr); |
1377 |
+ else if(errno == EAFNOSUPPORT) |
1378 |
+ fprintf(stderr, _("%s: protocol family not supported\n"), |
1379 |
+ program_name); |
1380 |
+ else if(errno == ENOSPC) |
1381 |
+ fprintf(stderr, _("%s: name too long\n"), program_name); |
1382 |
+ } |
1383 |
+ } else |
1384 |
+#endif /* IPV6 */ |
1385 |
+ { |
1386 |
+ ip = (struct in_addr **) hp->h_addr_list; |
1387 |
+ while (ip[0]) |
1388 |
+ fprintf(stderr, _("Result: h_addr_list=`%s'\n"), |
1389 |
+ inet_ntoa(**ip++)); |
1390 |
+ } |
1391 |
} |
1392 |
if (!(p = strchr(hp->h_name, '.')) && (c == 'd')) |
1393 |
return; |
1394 |
@@ -160,10 +189,32 @@ |
1395 |
printf("\n"); |
1396 |
break; |
1397 |
case 'i': |
1398 |
- while (hp->h_addr_list[0]) |
1399 |
- printf("%s ", inet_ntoa(*(struct in_addr *) *hp->h_addr_list++)); |
1400 |
- printf("\n"); |
1401 |
- break; |
1402 |
+#ifdef IPV6 |
1403 |
+ if(hp->h_addrtype == PF_INET6) { |
1404 |
+ char addr[INET6_ADDRSTRLEN + 1]; |
1405 |
+ addr[INET6_ADDRSTRLEN] = '\0'; |
1406 |
+ while(hp->h_addr_list[0]) { |
1407 |
+ if(inet_ntop(PF_INET6, (struct in6_addr *)*hp->h_addr_list++, |
1408 |
+ addr, INET6_ADDRSTRLEN)) |
1409 |
+ printf("%s ", addr); |
1410 |
+ else if(errno == EAFNOSUPPORT) { |
1411 |
+ fprintf(stderr, _("\n%s: protocol family not supported\n"), |
1412 |
+ program_name); |
1413 |
+ exit(1); |
1414 |
+ } else if(errno == ENOSPC) { |
1415 |
+ fprintf(stderr, _("\n%s: name too long\n"), program_name); |
1416 |
+ exit(1); |
1417 |
+ } |
1418 |
+ printf("\n"); |
1419 |
+ } |
1420 |
+ } else |
1421 |
+#endif /* IPV6 */ |
1422 |
+ { |
1423 |
+ while (hp->h_addr_list[0]) |
1424 |
+ printf("%s ", inet_ntoa(*(struct in_addr *)*hp->h_addr_list++)); |
1425 |
+ printf("\n"); |
1426 |
+ } |
1427 |
+ break; |
1428 |
case 'd': |
1429 |
printf("%s\n", ++p); |
1430 |
break; |
1431 |
|
1432 |
|
1433 |
|
1434 |
1.1 src/patchsets/net-tools/1.60/57_all_net-tools-1.60-ifconfig-infiniband.patch |
1435 |
|
1436 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/57_all_net-tools-1.60-ifconfig-infiniband.patch?rev=1.1&view=markup |
1437 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/57_all_net-tools-1.60-ifconfig-infiniband.patch?rev=1.1&content-type=text/plain |
1438 |
|
1439 |
Index: 57_all_net-tools-1.60-ifconfig-infiniband.patch |
1440 |
=================================================================== |
1441 |
Patch by Tom Duffy <tduffy@×××.com> to teach ifconfig about infiniband |
1442 |
|
1443 |
http://bugs.gentoo.org/show_bug.cgi?id=81180 |
1444 |
|
1445 |
--- net-tools-1.60/config.in |
1446 |
+++ net-tools-1.60-ib/config.in |
1447 |
@@ -82,6 +82,7 @@ |
1448 |
bool '(Cisco)-HDLC/LAPB support' HAVE_HWHDLCLAPB n |
1449 |
bool 'IrDA support' HAVE_HWIRDA y |
1450 |
bool 'Econet hardware support' HAVE_HWEC n |
1451 |
+bool 'InfiniBand hardware support' HAVE_HWIB y |
1452 |
* |
1453 |
* |
1454 |
* Other Features. |
1455 |
--- net-tools-1.60/lib/hw.c |
1456 |
+++ net-tools-1.60-ib/lib/hw.c |
1457 |
@@ -73,6 +73,8 @@ |
1458 |
|
1459 |
extern struct hwtype ec_hwtype; |
1460 |
|
1461 |
+extern struct hwtype ib_hwtype; |
1462 |
+ |
1463 |
static struct hwtype *hwtypes[] = |
1464 |
{ |
1465 |
|
1466 |
@@ -144,6 +146,9 @@ |
1467 |
#if HAVE_HWX25 |
1468 |
&x25_hwtype, |
1469 |
#endif |
1470 |
+#if HAVE_HWIB |
1471 |
+ &ib_hwtype, |
1472 |
+#endif |
1473 |
&unspec_hwtype, |
1474 |
NULL |
1475 |
}; |
1476 |
@@ -217,6 +222,9 @@ |
1477 |
#if HAVE_HWEC |
1478 |
ec_hwtype.title = _("Econet"); |
1479 |
#endif |
1480 |
+#if HAVE_HWIB |
1481 |
+ ib_hwtype.title = _("InfiniBand"); |
1482 |
+#endif |
1483 |
sVhwinit = 1; |
1484 |
} |
1485 |
|
1486 |
--- net-tools-1.60/lib/ib.c 1969-12-31 16:00:00.000000000 -0800 |
1487 |
+++ net-tools-1.60-ib/lib/ib.c 2005-02-07 12:55:04.635559244 -0800 |
1488 |
@@ -0,0 +1,147 @@ |
1489 |
+/* |
1490 |
+ * lib/ib.c This file contains an implementation of the "Infiniband" |
1491 |
+ * support functions. |
1492 |
+ * |
1493 |
+ * Version: $Id: 57_all_net-tools-1.60-ifconfig-infiniband.patch,v 1.1 2008/04/14 04:02:17 vapier Exp $ |
1494 |
+ * |
1495 |
+ * Author: Fred N. van Kempen, <waltje@×××××××××××××××.org> |
1496 |
+ * Copyright 1993 MicroWalt Corporation |
1497 |
+ * Tom Duffy <tduffy@×××.com> |
1498 |
+ * |
1499 |
+ * This program is free software; you can redistribute it |
1500 |
+ * and/or modify it under the terms of the GNU General |
1501 |
+ * Public License as published by the Free Software |
1502 |
+ * Foundation; either version 2 of the License, or (at |
1503 |
+ * your option) any later version. |
1504 |
+ */ |
1505 |
+#include "config.h" |
1506 |
+ |
1507 |
+#if HAVE_HWIB |
1508 |
+#include <sys/types.h> |
1509 |
+#include <sys/socket.h> |
1510 |
+#include <net/if_arp.h> |
1511 |
+#include <linux/if_infiniband.h> |
1512 |
+#include <stdlib.h> |
1513 |
+#include <stdio.h> |
1514 |
+#include <errno.h> |
1515 |
+#include <ctype.h> |
1516 |
+#include <string.h> |
1517 |
+#include <unistd.h> |
1518 |
+#include "net-support.h" |
1519 |
+#include "pathnames.h" |
1520 |
+#include "intl.h" |
1521 |
+#include "util.h" |
1522 |
+ |
1523 |
+extern struct hwtype ib_hwtype; |
1524 |
+ |
1525 |
+ |
1526 |
+/* Display an InfiniBand address in readable format. */ |
1527 |
+static char *pr_ib(unsigned char *ptr) |
1528 |
+{ |
1529 |
+ static char buff[128]; |
1530 |
+ char *pos; |
1531 |
+ unsigned int i; |
1532 |
+ |
1533 |
+ pos = buff; |
1534 |
+ for (i = 0; i < INFINIBAND_ALEN; i++) { |
1535 |
+ pos += sprintf(pos, "%02X:", (*ptr++ & 0377)); |
1536 |
+ } |
1537 |
+ buff[strlen(buff) - 1] = '\0'; |
1538 |
+ |
1539 |
+ /* snprintf(buff, sizeof(buff), "%02X:%02X:%02X:%02X:%02X:%02X", |
1540 |
+ (ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377), |
1541 |
+ (ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377) |
1542 |
+ ); |
1543 |
+ */ |
1544 |
+ return (buff); |
1545 |
+} |
1546 |
+ |
1547 |
+ |
1548 |
+/* Input an Infiniband address and convert to binary. */ |
1549 |
+static int in_ib(char *bufp, struct sockaddr *sap) |
1550 |
+{ |
1551 |
+ unsigned char *ptr; |
1552 |
+ char c, *orig; |
1553 |
+ int i; |
1554 |
+ unsigned val; |
1555 |
+ |
1556 |
+ sap->sa_family = ib_hwtype.type; |
1557 |
+ ptr = sap->sa_data; |
1558 |
+ |
1559 |
+ i = 0; |
1560 |
+ orig = bufp; |
1561 |
+ while ((*bufp != '\0') && (i < INFINIBAND_ALEN)) { |
1562 |
+ val = 0; |
1563 |
+ c = *bufp++; |
1564 |
+ if (isdigit(c)) |
1565 |
+ val = c - '0'; |
1566 |
+ else if (c >= 'a' && c <= 'f') |
1567 |
+ val = c - 'a' + 10; |
1568 |
+ else if (c >= 'A' && c <= 'F') |
1569 |
+ val = c - 'A' + 10; |
1570 |
+ else { |
1571 |
+#ifdef DEBUG |
1572 |
+ fprintf(stderr, _("in_ib(%s): invalid infiniband address!\n"), orig); |
1573 |
+#endif |
1574 |
+ errno = EINVAL; |
1575 |
+ return (-1); |
1576 |
+ } |
1577 |
+ val <<= 4; |
1578 |
+ c = *bufp; |
1579 |
+ if (isdigit(c)) |
1580 |
+ val |= c - '0'; |
1581 |
+ else if (c >= 'a' && c <= 'f') |
1582 |
+ val |= c - 'a' + 10; |
1583 |
+ else if (c >= 'A' && c <= 'F') |
1584 |
+ val |= c - 'A' + 10; |
1585 |
+ else if (c == ':' || c == 0) |
1586 |
+ val >>= 4; |
1587 |
+ else { |
1588 |
+#ifdef DEBUG |
1589 |
+ fprintf(stderr, _("in_ib(%s): invalid infiniband address!\n"), orig); |
1590 |
+#endif |
1591 |
+ errno = EINVAL; |
1592 |
+ return (-1); |
1593 |
+ } |
1594 |
+ if (c != 0) |
1595 |
+ bufp++; |
1596 |
+ *ptr++ = (unsigned char) (val & 0377); |
1597 |
+ i++; |
1598 |
+ |
1599 |
+ /* We might get a semicolon here - not required. */ |
1600 |
+ if (*bufp == ':') { |
1601 |
+ if (i == INFINIBAND_ALEN) { |
1602 |
+#ifdef DEBUG |
1603 |
+ fprintf(stderr, _("in_ib(%s): trailing : ignored!\n"), |
1604 |
+ orig) |
1605 |
+#endif |
1606 |
+ ; /* nothing */ |
1607 |
+ } |
1608 |
+ bufp++; |
1609 |
+ } |
1610 |
+ } |
1611 |
+ |
1612 |
+ /* That's it. Any trailing junk? */ |
1613 |
+ if ((i == INFINIBAND_ALEN) && (*bufp != '\0')) { |
1614 |
+#ifdef DEBUG |
1615 |
+ fprintf(stderr, _("in_ib(%s): trailing junk!\n"), orig); |
1616 |
+ errno = EINVAL; |
1617 |
+ return (-1); |
1618 |
+#endif |
1619 |
+ } |
1620 |
+#ifdef DEBUG |
1621 |
+ fprintf(stderr, "in_ib(%s): %s\n", orig, pr_ib(sap->sa_data)); |
1622 |
+#endif |
1623 |
+ |
1624 |
+ return (0); |
1625 |
+} |
1626 |
+ |
1627 |
+ |
1628 |
+struct hwtype ib_hwtype = |
1629 |
+{ |
1630 |
+ "infiniband", NULL, ARPHRD_INFINIBAND, INFINIBAND_ALEN, |
1631 |
+ pr_ib, in_ib, NULL |
1632 |
+}; |
1633 |
+ |
1634 |
+ |
1635 |
+#endif /* HAVE_HWETHER */ |
1636 |
--- net-tools-1.60/lib/Makefile 2000-10-28 03:59:42.000000000 -0700 |
1637 |
+++ net-tools-1.60-ib/lib/Makefile 2005-02-07 10:02:14.662640164 -0800 |
1638 |
@@ -16,7 +16,7 @@ |
1639 |
# |
1640 |
|
1641 |
|
1642 |
-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 |
1643 |
+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 |
1644 |
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 |
1645 |
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 |
1646 |
AFSROBJS = inet_sr.o inet6_sr.o netrom_sr.o ipx_sr.o setroute.o x25_sr.o |
1647 |
|
1648 |
|
1649 |
|
1650 |
1.1 src/patchsets/net-tools/1.60/60_all_net-tools-1.60-headers.patch |
1651 |
|
1652 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/60_all_net-tools-1.60-headers.patch?rev=1.1&view=markup |
1653 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/60_all_net-tools-1.60-headers.patch?rev=1.1&content-type=text/plain |
1654 |
|
1655 |
Index: 60_all_net-tools-1.60-headers.patch |
1656 |
=================================================================== |
1657 |
need stdlib.h for exit() |
1658 |
|
1659 |
--- net-tools/hostname.c |
1660 |
+++ net-tools/hostname.c |
1661 |
@@ -31,6 +31,7 @@ |
1662 |
* your option) any later version. |
1663 |
*/ |
1664 |
#include <stdio.h> |
1665 |
+#include <stdlib.h> |
1666 |
#include <unistd.h> |
1667 |
#include <getopt.h> |
1668 |
#include <string.h> |
1669 |
|
1670 |
|
1671 |
|
1672 |
1.1 src/patchsets/net-tools/1.60/70_all_net-tools-1.60-unaligned.patch |
1673 |
|
1674 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/70_all_net-tools-1.60-unaligned.patch?rev=1.1&view=markup |
1675 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/net-tools/1.60/70_all_net-tools-1.60-unaligned.patch?rev=1.1&content-type=text/plain |
1676 |
|
1677 |
Index: 70_all_net-tools-1.60-unaligned.patch |
1678 |
=================================================================== |
1679 |
fix crash due to unaligned accesses |
1680 |
|
1681 |
http://bugs.gentoo.org/163430 |
1682 |
|
1683 |
Index: arp.c |
1684 |
=================================================================== |
1685 |
RCS file: /cvsroot/net-tools/net-tools/arp.c,v |
1686 |
retrieving revision 1.24 |
1687 |
diff -u -r1.24 arp.c |
1688 |
--- arp.c 16 May 2005 04:30:17 -0000 1.24 |
1689 |
+++ arp.c 4 Dec 2005 02:49:42 -0000 |
1690 |
@@ -100,7 +100,8 @@ |
1691 |
{ |
1692 |
char host[128]; |
1693 |
struct arpreq req; |
1694 |
- struct sockaddr sa; |
1695 |
+ struct sockaddr_storage ss; |
1696 |
+ struct sockaddr *sa; |
1697 |
int flags = 0; |
1698 |
int deleted = 0; |
1699 |
|
1700 |
@@ -112,12 +113,13 @@ |
1701 |
return (-1); |
1702 |
} |
1703 |
safe_strncpy(host, *args, (sizeof host)); |
1704 |
- if (ap->input(0, host, &sa) < 0) { |
1705 |
+ sa = (struct sockaddr *)&ss; |
1706 |
+ if (ap->input(0, host, sa) < 0) { |
1707 |
ap->herror(host); |
1708 |
return (-1); |
1709 |
} |
1710 |
/* If a host has more than one address, use the correct one! */ |
1711 |
- memcpy((char *) &req.arp_pa, (char *) &sa, sizeof(struct sockaddr)); |
1712 |
+ memcpy((char *) &req.arp_pa, (char *) sa, sizeof(struct sockaddr)); |
1713 |
|
1714 |
if (hw_set) |
1715 |
req.arp_ha.sa_family = hw->type; |
1716 |
@@ -177,11 +179,11 @@ |
1717 |
usage(); |
1718 |
if (strcmp(*args, "255.255.255.255") != 0) { |
1719 |
strcpy(host, *args); |
1720 |
- if (ap->input(0, host, &sa) < 0) { |
1721 |
+ if (ap->input(0, host, sa) < 0) { |
1722 |
ap->herror(host); |
1723 |
return (-1); |
1724 |
} |
1725 |
- memcpy((char *) &req.arp_netmask, (char *) &sa, |
1726 |
+ memcpy((char *) &req.arp_netmask, (char *) sa, |
1727 |
sizeof(struct sockaddr)); |
1728 |
req.arp_flags |= ATF_NETMASK; |
1729 |
} |
1730 |
@@ -266,7 +268,8 @@ |
1731 |
{ |
1732 |
char host[128]; |
1733 |
struct arpreq req; |
1734 |
- struct sockaddr sa; |
1735 |
+ struct sockaddr_storage ss; |
1736 |
+ struct sockaddr *sa; |
1737 |
int flags; |
1738 |
|
1739 |
memset((char *) &req, 0, sizeof(req)); |
1740 |
@@ -277,12 +280,13 @@ |
1741 |
return (-1); |
1742 |
} |
1743 |
safe_strncpy(host, *args++, (sizeof host)); |
1744 |
- if (ap->input(0, host, &sa) < 0) { |
1745 |
+ sa = (struct sockaddr *)&ss; |
1746 |
+ if (ap->input(0, host, sa) < 0) { |
1747 |
ap->herror(host); |
1748 |
return (-1); |
1749 |
} |
1750 |
/* If a host has more than one address, use the correct one! */ |
1751 |
- memcpy((char *) &req.arp_pa, (char *) &sa, sizeof(struct sockaddr)); |
1752 |
+ memcpy((char *) &req.arp_pa, (char *) sa, sizeof(struct sockaddr)); |
1753 |
|
1754 |
/* Fetch the hardware address. */ |
1755 |
if (*args == NULL) { |
1756 |
@@ -352,11 +356,11 @@ |
1757 |
usage(); |
1758 |
if (strcmp(*args, "255.255.255.255") != 0) { |
1759 |
strcpy(host, *args); |
1760 |
- if (ap->input(0, host, &sa) < 0) { |
1761 |
+ if (ap->input(0, host, sa) < 0) { |
1762 |
ap->herror(host); |
1763 |
return (-1); |
1764 |
} |
1765 |
- memcpy((char *) &req.arp_netmask, (char *) &sa, |
1766 |
+ memcpy((char *) &req.arp_netmask, (char *) sa, |
1767 |
sizeof(struct sockaddr)); |
1768 |
flags |= ATF_NETMASK; |
1769 |
} |
1770 |
@@ -525,7 +529,8 @@ |
1771 |
static int arp_show(char *name) |
1772 |
{ |
1773 |
char host[100]; |
1774 |
- struct sockaddr sa; |
1775 |
+ struct sockaddr_storage ss; |
1776 |
+ struct sockaddr *sa; |
1777 |
char ip[100]; |
1778 |
char hwa[100]; |
1779 |
char mask[100]; |
1780 |
@@ -538,14 +543,15 @@ |
1781 |
|
1782 |
host[0] = '\0'; |
1783 |
|
1784 |
+ sa = (struct sockaddr *)&ss; |
1785 |
if (name != NULL) { |
1786 |
/* Resolve the host name. */ |
1787 |
safe_strncpy(host, name, (sizeof host)); |
1788 |
- if (ap->input(0, host, &sa) < 0) { |
1789 |
+ if (ap->input(0, host, sa) < 0) { |
1790 |
ap->herror(host); |
1791 |
return (-1); |
1792 |
} |
1793 |
- safe_strncpy(host, ap->sprint(&sa, 1), sizeof(host)); |
1794 |
+ safe_strncpy(host, ap->sprint(sa, 1), sizeof(host)); |
1795 |
} |
1796 |
/* Open the PROCps kernel table. */ |
1797 |
if ((fp = fopen(_PATH_PROCNET_ARP, "r")) == NULL) { |
1798 |
@@ -581,10 +587,10 @@ |
1799 |
if (opt_n) |
1800 |
hostname = "?"; |
1801 |
else { |
1802 |
- if (ap->input(0, ip, &sa) < 0) |
1803 |
+ if (ap->input(0, ip, sa) < 0) |
1804 |
hostname = ip; |
1805 |
else |
1806 |
- hostname = ap->sprint(&sa, opt_n | 0x8000); |
1807 |
+ hostname = ap->sprint(sa, opt_n | 0x8000); |
1808 |
if (strcmp(hostname, ip) == 0) |
1809 |
hostname = "?"; |
1810 |
} |
1811 |
|
1812 |
|
1813 |
|
1814 |
-- |
1815 |
gentoo-commits@l.g.o mailing list |