]>
Commit | Line | Data |
---|---|---|
af24c785 ER |
1 | --- net-tools-1.60/arp.c 2001-04-08 19:05:05.000000000 +0200 |
2 | +++ net-tools/arp.c 2005-12-04 04:57:15.000000000 +0200 | |
3 | @@ -8,7 +8,7 @@ | |
4 | * NET-3 Networking Distribution for the LINUX operating | |
5 | * system. | |
6 | * | |
7 | - * Version: $Id$ | |
8 | + * Version: $Id$ | |
9 | * | |
10 | * Maintainer: Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de> | |
11 | * | |
12 | @@ -100,9 +100,10 @@ | |
13 | { | |
14 | char host[128]; | |
15 | struct arpreq req; | |
16 | - struct sockaddr sa; | |
17 | + struct sockaddr_storage ss; | |
18 | + struct sockaddr *sa; | |
19 | int flags = 0; | |
20 | - int err; | |
21 | + int deleted = 0; | |
22 | ||
23 | memset((char *) &req, 0, sizeof(req)); | |
24 | ||
25 | @@ -112,12 +113,13 @@ | |
26 | return (-1); | |
27 | } | |
28 | safe_strncpy(host, *args, (sizeof host)); | |
29 | - if (ap->input(0, host, &sa) < 0) { | |
30 | + sa = (struct sockaddr *)&ss; | |
31 | + if (ap->input(0, host, sa) < 0) { | |
32 | ap->herror(host); | |
33 | return (-1); | |
34 | } | |
35 | /* If a host has more than one address, use the correct one! */ | |
36 | - memcpy((char *) &req.arp_pa, (char *) &sa, sizeof(struct sockaddr)); | |
37 | + memcpy((char *) &req.arp_pa, (char *) sa, sizeof(struct sockaddr)); | |
38 | ||
39 | if (hw_set) | |
40 | req.arp_ha.sa_family = hw->type; | |
41 | @@ -148,7 +150,7 @@ | |
42 | continue; | |
43 | } | |
44 | if (!strcmp(*args, "dontpub")) { | |
45 | -#ifdef HAVE_ATF_DONTPUB | |
46 | +#ifdef ATF_DONTPUB | |
47 | req.arp_flags |= ATF_DONTPUB; | |
48 | #else | |
49 | ENOSUPP("arp", "ATF_DONTPUB"); | |
50 | @@ -157,7 +159,7 @@ | |
51 | continue; | |
52 | } | |
53 | if (!strcmp(*args, "auto")) { | |
54 | -#ifdef HAVE_ATF_MAGIC | |
55 | +#ifdef ATF_MAGIC | |
56 | req.arp_flags |= ATF_MAGIC; | |
57 | #else | |
58 | ENOSUPP("arp", "ATF_MAGIC"); | |
59 | @@ -177,11 +179,11 @@ | |
60 | usage(); | |
61 | if (strcmp(*args, "255.255.255.255") != 0) { | |
62 | strcpy(host, *args); | |
63 | - if (ap->input(0, host, &sa) < 0) { | |
64 | + if (ap->input(0, host, sa) < 0) { | |
65 | ap->herror(host); | |
66 | return (-1); | |
67 | } | |
68 | - memcpy((char *) &req.arp_netmask, (char *) &sa, | |
69 | + memcpy((char *) &req.arp_netmask, (char *) sa, | |
70 | sizeof(struct sockaddr)); | |
71 | req.arp_flags |= ATF_NETMASK; | |
72 | } | |
73 | @@ -190,35 +192,41 @@ | |
74 | } | |
75 | usage(); | |
76 | } | |
77 | + | |
78 | + // if neighter priv nor pub is given, work on both | |
79 | if (flags == 0) | |
80 | flags = 3; | |
81 | ||
82 | strcpy(req.arp_dev, device); | |
83 | ||
84 | - err = -1; | |
85 | + /* unfortuatelly the kernel interface does not allow us to | |
86 | + delete private entries anlone, so we need this hack | |
87 | + to avoid "not found" errors if we try both. */ | |
88 | + deleted = 0; | |
89 | ||
90 | /* Call the kernel. */ | |
91 | if (flags & 2) { | |
92 | if (opt_v) | |
93 | - fprintf(stderr, "arp: SIOCDARP(nopub)\n"); | |
94 | - if ((err = ioctl(sockfd, SIOCDARP, &req) < 0)) { | |
95 | - if (errno == ENXIO) { | |
96 | + fprintf(stderr, "arp: SIOCDARP(dontpub)\n"); | |
97 | + if (ioctl(sockfd, SIOCDARP, &req) < 0) { | |
98 | + if ((errno == ENXIO) || (errno == ENOENT)) { | |
99 | if (flags & 1) | |
100 | - goto nopub; | |
101 | + goto dontpub; | |
102 | printf(_("No ARP entry for %s\n"), host); | |
103 | return (-1); | |
104 | } | |
105 | - perror("SIOCDARP(priv)"); | |
106 | + perror("SIOCDARP(dontpub)"); | |
107 | return (-1); | |
108 | - } | |
109 | + } else | |
110 | + deleted = 1; | |
111 | } | |
112 | - if ((flags & 1) && (err)) { | |
113 | - nopub: | |
114 | + if (!deleted && (flags & 1)) { | |
115 | + dontpub: | |
116 | req.arp_flags |= ATF_PUBL; | |
117 | if (opt_v) | |
118 | fprintf(stderr, "arp: SIOCDARP(pub)\n"); | |
119 | if (ioctl(sockfd, SIOCDARP, &req) < 0) { | |
120 | - if (errno == ENXIO) { | |
121 | + if ((errno == ENXIO) || (errno == ENOENT)) { | |
122 | printf(_("No ARP entry for %s\n"), host); | |
123 | return (-1); | |
124 | } | |
125 | @@ -260,7 +268,8 @@ | |
126 | { | |
127 | char host[128]; | |
128 | struct arpreq req; | |
129 | - struct sockaddr sa; | |
130 | + struct sockaddr_storage ss; | |
131 | + struct sockaddr *sa; | |
132 | int flags; | |
133 | ||
134 | memset((char *) &req, 0, sizeof(req)); | |
135 | @@ -271,12 +280,13 @@ | |
136 | return (-1); | |
137 | } | |
138 | safe_strncpy(host, *args++, (sizeof host)); | |
139 | - if (ap->input(0, host, &sa) < 0) { | |
140 | + sa = (struct sockaddr *)&ss; | |
141 | + if (ap->input(0, host, sa) < 0) { | |
142 | ap->herror(host); | |
143 | return (-1); | |
144 | } | |
145 | /* If a host has more than one address, use the correct one! */ | |
146 | - memcpy((char *) &req.arp_pa, (char *) &sa, sizeof(struct sockaddr)); | |
147 | + memcpy((char *) &req.arp_pa, (char *) sa, sizeof(struct sockaddr)); | |
148 | ||
149 | /* Fetch the hardware address. */ | |
150 | if (*args == NULL) { | |
151 | @@ -317,7 +327,7 @@ | |
152 | continue; | |
153 | } | |
154 | if (!strcmp(*args, "dontpub")) { | |
155 | -#ifdef HAVE_ATF_DONTPUB | |
156 | +#ifdef ATF_DONTPUB | |
157 | flags |= ATF_DONTPUB; | |
158 | #else | |
159 | ENOSUPP("arp", "ATF_DONTPUB"); | |
160 | @@ -326,7 +336,7 @@ | |
161 | continue; | |
162 | } | |
163 | if (!strcmp(*args, "auto")) { | |
164 | -#ifdef HAVE_ATF_MAGIC | |
165 | +#ifdef ATF_MAGIC | |
166 | flags |= ATF_MAGIC; | |
167 | #else | |
168 | ENOSUPP("arp", "ATF_MAGIC"); | |
169 | @@ -346,11 +356,11 @@ | |
170 | usage(); | |
171 | if (strcmp(*args, "255.255.255.255") != 0) { | |
172 | strcpy(host, *args); | |
173 | - if (ap->input(0, host, &sa) < 0) { | |
174 | + if (ap->input(0, host, sa) < 0) { | |
175 | ap->herror(host); | |
176 | return (-1); | |
177 | } | |
178 | - memcpy((char *) &req.arp_netmask, (char *) &sa, | |
179 | + memcpy((char *) &req.arp_netmask, (char *) sa, | |
180 | sizeof(struct sockaddr)); | |
181 | flags |= ATF_NETMASK; | |
182 | } | |
183 | @@ -445,11 +455,11 @@ | |
184 | strcat(flags, "M"); | |
185 | if (arp_flags & ATF_PUBL) | |
186 | strcat(flags, "P"); | |
187 | -#ifdef HAVE_ATF_MAGIC | |
188 | +#ifdef ATF_MAGIC | |
189 | if (arp_flags & ATF_MAGIC) | |
190 | strcat(flags, "A"); | |
191 | #endif | |
192 | -#ifdef HAVE_ATF_DONTPUB | |
193 | +#ifdef ATF_DONTPUB | |
194 | if (arp_flags & ATF_DONTPUB) | |
195 | strcat(flags, "!"); | |
196 | #endif | |
197 | @@ -463,7 +473,7 @@ | |
198 | ||
199 | if (!(arp_flags & ATF_COM)) { | |
200 | if (arp_flags & ATF_PUBL) | |
201 | - printf("%-8.8s%-20.20s", "*", "*"); | |
202 | + printf("%-8.8s%-20.20s", "*", _("<from_interface>")); | |
203 | else | |
204 | printf("%-8.8s%-20.20s", "", _("(incomplete)")); | |
205 | } else { | |
206 | @@ -486,7 +496,7 @@ | |
207 | ||
208 | if (!(arp_flags & ATF_COM)) { | |
209 | if (arp_flags & ATF_PUBL) | |
210 | - printf("* "); | |
211 | + printf("<from_interface> "); | |
212 | else | |
213 | printf(_("<incomplete> ")); | |
214 | } else { | |
215 | @@ -499,12 +509,12 @@ | |
216 | if (arp_flags & ATF_PERM) | |
217 | printf("PERM "); | |
218 | if (arp_flags & ATF_PUBL) | |
219 | - printf("PUP "); | |
220 | -#ifdef HAVE_ATF_MAGIC | |
221 | + printf("PUB "); | |
222 | +#ifdef ATF_MAGIC | |
223 | if (arp_flags & ATF_MAGIC) | |
224 | printf("AUTO "); | |
225 | #endif | |
226 | -#ifdef HAVE_ATF_DONTPUB | |
227 | +#ifdef ATF_DONTPUB | |
228 | if (arp_flags & ATF_DONTPUB) | |
229 | printf("DONTPUB "); | |
230 | #endif | |
231 | @@ -519,7 +529,8 @@ | |
232 | static int arp_show(char *name) | |
233 | { | |
234 | char host[100]; | |
235 | - struct sockaddr sa; | |
236 | + struct sockaddr_storage ss; | |
237 | + struct sockaddr *sa; | |
238 | char ip[100]; | |
239 | char hwa[100]; | |
240 | char mask[100]; | |
241 | @@ -532,14 +543,15 @@ | |
242 | ||
243 | host[0] = '\0'; | |
244 | ||
245 | + sa = (struct sockaddr *)&ss; | |
246 | if (name != NULL) { | |
247 | /* Resolve the host name. */ | |
248 | safe_strncpy(host, name, (sizeof host)); | |
249 | - if (ap->input(0, host, &sa) < 0) { | |
250 | + if (ap->input(0, host, sa) < 0) { | |
251 | ap->herror(host); | |
252 | return (-1); | |
253 | } | |
254 | - safe_strncpy(host, ap->sprint(&sa, 1), sizeof(host)); | |
255 | + safe_strncpy(host, ap->sprint(sa, 1), sizeof(host)); | |
256 | } | |
257 | /* Open the PROCps kernel table. */ | |
258 | if ((fp = fopen(_PATH_PROCNET_ARP, "r")) == NULL) { | |
259 | @@ -575,10 +587,10 @@ | |
260 | if (opt_n) | |
261 | hostname = "?"; | |
262 | else { | |
263 | - if (ap->input(0, ip, &sa) < 0) | |
264 | + if (ap->input(0, ip, sa) < 0) | |
265 | hostname = ip; | |
266 | else | |
267 | - hostname = ap->sprint(&sa, opt_n | 0x8000); | |
268 | + hostname = ap->sprint(sa, opt_n | 0x8000); | |
269 | if (strcmp(hostname, ip) == 0) | |
270 | hostname = "?"; | |
271 | } | |
272 | @@ -612,11 +624,10 @@ | |
273 | static void usage(void) | |
274 | { | |
275 | fprintf(stderr, _("Usage:\n arp [-vn] [<HW>] [-i <if>] [-a] [<hostname>] <-Display ARP cache\n")); | |
276 | - fprintf(stderr, _(" arp [-v] [-i <if>] -d <hostname> [pub][nopub] <-Delete ARP entry\n")); | |
277 | - fprintf(stderr, _(" arp [-vnD] [<HW>] [-i <if>] -f [<filename>] <-Add entry from file\n")); | |
278 | - fprintf(stderr, _(" arp [-v] [<HW>] [-i <if>] -s <hostname> <hwaddr> [temp][nopub] <-Add entry\n")); | |
279 | - fprintf(stderr, _(" arp [-v] [<HW>] [-i <if>] -s <hostname> <hwaddr> [netmask <nm>] pub <-''-\n")); | |
280 | - fprintf(stderr, _(" arp [-v] [<HW>] [-i <if>] -Ds <hostname> <if> [netmask <nm>] pub <-''-\n\n")); | |
281 | + fprintf(stderr, _(" arp [-v] [-i <if>] -d <host> [pub] <-Delete ARP entry\n")); | |
282 | + fprintf(stderr, _(" arp [-vnD] [<HW>] [-i <if>] -f [<filename>] <-Add entry from file\n")); | |
283 | + fprintf(stderr, _(" arp [-v] [<HW>] [-i <if>] -s <host> <hwaddr> [temp] <-Add entry\n")); | |
284 | + fprintf(stderr, _(" arp [-v] [<HW>] [-i <if>] -Ds <host> <if> [netmask <nm>] pub <-''-\n\n")); | |
285 | ||
286 | fprintf(stderr, _(" -a display (all) hosts in alternative (BSD) style\n")); | |
287 | fprintf(stderr, _(" -s, --set set a new ARP entry\n")); | |
288 | --- net-tools-1.60/config.in 2000-05-21 16:32:12.000000000 +0200 | |
289 | +++ net-tools/config.in 2004-06-04 03:06:50.000000000 +0300 | |
290 | @@ -49,16 +49,16 @@ | |
291 | * | |
292 | bool 'UNIX protocol family' HAVE_AFUNIX y | |
293 | bool 'INET (TCP/IP) protocol family' HAVE_AFINET y | |
294 | -bool 'INET6 (IPv6) protocol family' HAVE_AFINET6 n | |
295 | +bool 'INET6 (IPv6) protocol family' HAVE_AFINET6 y | |
296 | bool 'Novell IPX/SPX protocol family' HAVE_AFIPX y | |
297 | bool 'Appletalk DDP protocol family' HAVE_AFATALK y | |
298 | bool 'AX25 (packet radio) protocol family' HAVE_AFAX25 y | |
299 | bool 'NET/ROM (packet radio) protocol family' HAVE_AFNETROM y | |
300 | -bool 'Rose (packet radio) protocol family' HAVE_AFROSE n | |
301 | +bool 'Rose (packet radio) protocol family' HAVE_AFROSE y | |
302 | bool 'X.25 (CCITT) protocol family' HAVE_AFX25 y | |
303 | -bool 'Econet protocol family' HAVE_AFECONET n | |
304 | +bool 'Econet protocol family' HAVE_AFECONET y | |
305 | bool 'DECnet protocol family' HAVE_AFDECnet n | |
306 | -bool 'Ash protocol family' HAVE_AFASH n | |
307 | +bool 'Ash protocol family' HAVE_AFASH y | |
308 | * | |
309 | * | |
310 | * Device Hardware types. | |
311 | @@ -71,21 +71,23 @@ | |
312 | bool 'STRIP (Metricom radio) support' HAVE_HWSTRIP y | |
313 | bool 'Token ring (generic) support' HAVE_HWTR y | |
314 | bool 'AX25 (packet radio) support' HAVE_HWAX25 y | |
315 | -bool 'Rose (packet radio) support' HAVE_HWROSE n | |
316 | +bool 'Rose (packet radio) support' HAVE_HWROSE y | |
317 | bool 'NET/ROM (packet radio) support' HAVE_HWNETROM y | |
318 | bool 'X.25 (generic) support' HAVE_HWX25 y | |
319 | bool 'DLCI/FRAD (frame relay) support' HAVE_HWFR y | |
320 | -bool 'SIT (IPv6-in-IPv4) support' HAVE_HWSIT n | |
321 | -bool 'FDDI (generic) support' HAVE_HWFDDI n | |
322 | -bool 'HIPPI (generic) support' HAVE_HWHIPPI n | |
323 | -bool 'Ash hardware support' HAVE_HWASH n | |
324 | -bool '(Cisco)-HDLC/LAPB support' HAVE_HWHDLCLAPB n | |
325 | +bool 'SIT (IPv6-in-IPv4) support' HAVE_HWSIT y | |
326 | +bool 'FDDI (generic) support' HAVE_HWFDDI y | |
327 | +bool 'HIPPI (generic) support' HAVE_HWHIPPI y | |
328 | +bool 'Ash hardware support' HAVE_HWASH y | |
329 | +bool '(Cisco)-HDLC/LAPB support' HAVE_HWHDLCLAPB y | |
330 | bool 'IrDA support' HAVE_HWIRDA y | |
331 | -bool 'Econet hardware support' HAVE_HWEC n | |
332 | +bool 'Econet hardware support' HAVE_HWEC y | |
333 | +bool 'Generic EUI-64 hardware support' HAVE_HWEUI64 y | |
334 | + | |
335 | * | |
336 | * | |
337 | * Other Features. | |
338 | * | |
339 | -bool 'IP Masquerading support' HAVE_FW_MASQUERADE n | |
340 | -bool 'Build iptunnel and ipmaddr' HAVE_IP_TOOLS n | |
341 | -bool 'Build mii-tool' HAVE_MII n | |
342 | +bool 'IP Masquerading support' HAVE_FW_MASQUERADE y | |
343 | +bool 'Build iptunnel and ipmaddr' HAVE_IP_TOOLS y | |
344 | +bool 'Build mii-tool' HAVE_MII y | |
345 | --- net-tools-1.60/hostname.c 2001-04-08 19:04:23.000000000 +0200 | |
346 | +++ net-tools/hostname.c 2003-10-12 00:08:10.000000000 +0300 | |
347 | @@ -9,20 +9,19 @@ | |
348 | * dnsdmoainname | |
349 | * nisdomainname {name|-F file} | |
350 | * | |
351 | - * Version: hostname 1.96 (1996-02-18) | |
352 | + * Version: hostname 1.101 (2003-10-11) | |
353 | * | |
354 | * Author: Peter Tobias <tobias@et-inf.fho-emden.de> | |
355 | * | |
356 | * Changes: | |
357 | - * {1.90} Peter Tobias : Added -a and -i options. | |
358 | - * {1.91} Bernd Eckenfels : -v,-V rewritten, long_opts | |
359 | - * (major rewrite), usage. | |
360 | - *960120 {1.95} Bernd Eckenfels : -y/nisdomainname - support for get/ | |
361 | - * setdomainname added | |
362 | - *960218 {1.96} Bernd Eckenfels : netinet/in.h added | |
363 | - *980629 {1.97} Arnaldo Carvalho de Melo : gettext instead of catgets for i18n | |
364 | - *20000213 {1.99} Arnaldo Carvalho de Melo : fixed some i18n strings | |
365 | + * {1.90} Peter Tobias : Added -a and -i options. | |
366 | + * {1.91} Bernd Eckenfels : -v,-V rewritten, long_opts (major rewrite), usage. | |
367 | + *19960120 {1.95} Bernd Eckenfels : -y/nisdomainname - support for get/setdomainname added | |
368 | + *19960218 {1.96} Bernd Eckenfels : netinet/in.h added | |
369 | + *19980629 {1.97} Arnaldo Carvalho de Melo : gettext instead of catgets for i18n | |
370 | + *20000213 {1.99} Arnaldo Carvalho de Melo : fixed some i18n strings | |
371 | *20010404 {1.100} Arnaldo Carvalho de Melo: use setlocale | |
372 | + *20031011 {1.101} Maik Broemme: gcc 3.x fixes (default: break) | |
373 | * | |
374 | * This program is free software; you can redistribute it | |
375 | * and/or modify it under the terms of the GNU General | |
376 | @@ -31,7 +30,9 @@ | |
377 | * your option) any later version. | |
378 | */ | |
379 | #include <stdio.h> | |
380 | +#include <stdlib.h> | |
381 | #include <unistd.h> | |
382 | +#include <stdlib.h> | |
383 | #include <getopt.h> | |
384 | #include <string.h> | |
385 | #include <netdb.h> | |
386 | @@ -78,6 +79,7 @@ | |
387 | fprintf(stderr, _("%s: name too long\n"), program_name); | |
388 | break; | |
389 | default: | |
390 | + break; | |
391 | } | |
392 | exit(1); | |
393 | } | |
394 | @@ -97,7 +99,6 @@ | |
395 | case EINVAL: | |
396 | fprintf(stderr, _("%s: name too long\n"), program_name); | |
397 | break; | |
398 | - default: | |
399 | } | |
400 | exit(1); | |
401 | }; | |
402 | @@ -116,7 +117,6 @@ | |
403 | case EINVAL: | |
404 | fprintf(stderr, _("%s: name too long\n"), program_name); | |
405 | break; | |
406 | - default: | |
407 | } | |
408 | exit(1); | |
409 | }; | |
410 | @@ -173,7 +173,6 @@ | |
411 | *p = '\0'; | |
412 | printf("%s\n", hp->h_name); | |
413 | break; | |
414 | - default: | |
415 | } | |
416 | } | |
417 | ||
418 | @@ -326,11 +325,12 @@ | |
419 | break; | |
420 | case 'V': | |
421 | version(); | |
422 | + break; // not reached | |
423 | case '?': | |
424 | case 'h': | |
425 | default: | |
426 | usage(); | |
427 | - | |
428 | + break; // not reached | |
429 | }; | |
430 | ||
431 | ||
432 | --- net-tools-1.60/ifconfig.c 2001-04-13 20:25:18.000000000 +0200 | |
433 | +++ net-tools/ifconfig.c 2002-12-10 02:56:41.000000000 +0200 | |
434 | @@ -3,7 +3,7 @@ | |
435 | * that either displays or sets the characteristics of | |
436 | * one or more of the system's networking interfaces. | |
437 | * | |
438 | - * Version: $Id$ | |
439 | + * Version: $Id$ | |
440 | * | |
441 | * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> | |
442 | * and others. Copyright 1993 MicroWalt Corporation | |
443 | @@ -88,7 +88,6 @@ | |
444 | char *Release = RELEASE, *Version = "ifconfig 1.42 (2001-04-13)"; | |
445 | ||
446 | int opt_a = 0; /* show all interfaces */ | |
447 | -int opt_i = 0; /* show the statistics */ | |
448 | int opt_v = 0; /* debugging output flag */ | |
449 | ||
450 | int addr_family = 0; /* currently selected AF */ | |
451 | @@ -105,7 +104,7 @@ | |
452 | int res; | |
453 | ||
454 | if (ife_short) | |
455 | - printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n")); | |
456 | + printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n")); | |
457 | ||
458 | if (!ifname) { | |
459 | res = for_all_interfaces(do_if_print, &opt_a); | |
460 | @@ -127,7 +126,7 @@ | |
461 | ||
462 | safe_strncpy(ifr.ifr_name, ifname, IFNAMSIZ); | |
463 | if (ioctl(skfd, SIOCGIFFLAGS, &ifr) < 0) { | |
464 | - fprintf(stderr, _("%s: unknown interface: %s\n"), | |
465 | + fprintf(stderr, _("%s: ERROR while getting interface flags: %s\n"), | |
466 | ifname, strerror(errno)); | |
467 | return (-1); | |
468 | } | |
469 | @@ -159,7 +158,7 @@ | |
470 | ||
471 | safe_strncpy(ifr.ifr_name, ifname, IFNAMSIZ); | |
472 | if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) { | |
473 | - fprintf(stderr, _("%s: unknown interface: %s\n"), | |
474 | + fprintf(stderr, _("%s: ERROR while getting interface flags: %s\n"), | |
475 | ifname, strerror(errno)); | |
476 | return -1; | |
477 | } | |
478 | @@ -172,9 +171,35 @@ | |
479 | return (0); | |
480 | } | |
481 | ||
482 | +/** test is a specified flag is set */ | |
483 | +static int test_flag(char *ifname, short flags) | |
484 | +{ | |
485 | + struct ifreq ifr; | |
486 | + int fd; | |
487 | + | |
488 | + if (strchr(ifname, ':')) { | |
489 | + /* This is a v4 alias interface. Downing it via a socket for | |
490 | + another AF may have bad consequences. */ | |
491 | + fd = get_socket_for_af(AF_INET); | |
492 | + if (fd < 0) { | |
493 | + fprintf(stderr, _("No support for INET on this system.\n")); | |
494 | + return -1; | |
495 | + } | |
496 | + } else | |
497 | + fd = skfd; | |
498 | + | |
499 | + safe_strncpy(ifr.ifr_name, ifname, IFNAMSIZ); | |
500 | + if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) { | |
501 | + fprintf(stderr, _("%s: ERROR while testing interface flags: %s\n"), | |
502 | + ifname, strerror(errno)); | |
503 | + return -1; | |
504 | + } | |
505 | + return (ifr.ifr_flags & flags); | |
506 | +} | |
507 | + | |
508 | static void usage(void) | |
509 | { | |
510 | - fprintf(stderr, _("Usage:\n ifconfig [-a] [-i] [-v] [-s] <interface> [[<AF>] <address>]\n")); | |
511 | + fprintf(stderr, _("Usage:\n ifconfig [-a] [-v] [-s] <interface> [[<AF>] <address>]\n")); | |
512 | #if HAVE_AFINET | |
513 | fprintf(stderr, _(" [add <address>[/<prefixlen>]]\n")); | |
514 | fprintf(stderr, _(" [del <address>[/<prefixlen>]]\n")); | |
515 | @@ -208,7 +233,7 @@ | |
516 | static void version(void) | |
517 | { | |
518 | fprintf(stderr, "%s\n%s\n", Release, Version); | |
519 | - exit(0); | |
520 | + exit(E_USAGE); | |
521 | } | |
522 | ||
523 | static int set_netmask(int skfd, struct ifreq *ifr, struct sockaddr *sa) | |
524 | @@ -222,18 +247,19 @@ | |
525 | strerror(errno)); | |
526 | err = 1; | |
527 | } | |
528 | - return 0; | |
529 | + return err; | |
530 | } | |
531 | ||
532 | int main(int argc, char **argv) | |
533 | { | |
534 | struct sockaddr sa; | |
535 | + struct sockaddr samask; | |
536 | struct sockaddr_in sin; | |
537 | char host[128]; | |
538 | struct aftype *ap; | |
539 | struct hwtype *hw; | |
540 | struct ifreq ifr; | |
541 | - int goterr = 0, didnetmask = 0; | |
542 | + int goterr = 0, didnetmask = 0, neednetmask=0; | |
543 | char **spp; | |
544 | int fd; | |
545 | #if HAVE_AFINET6 | |
546 | @@ -388,6 +414,8 @@ | |
547 | } | |
548 | if (!strcmp(*spp, "-promisc")) { | |
549 | goterr |= clr_flag(ifr.ifr_name, IFF_PROMISC); | |
550 | + if (test_flag(ifr.ifr_name, IFF_PROMISC) > 0) | |
551 | + fprintf(stderr, _("Warning: Interface %s still in promisc mode... maybe other application is running?\n"), ifr.ifr_name); | |
552 | spp++; | |
553 | continue; | |
554 | } | |
555 | @@ -398,6 +426,8 @@ | |
556 | } | |
557 | if (!strcmp(*spp, "-multicast")) { | |
558 | goterr |= clr_flag(ifr.ifr_name, IFF_MULTICAST); | |
559 | + if (test_flag(ifr.ifr_name, IFF_MULTICAST) > 0) | |
560 | + fprintf(stderr, _("Warning: Interface %s still in MULTICAST mode.\n"), ifr.ifr_name); | |
561 | spp++; | |
562 | continue; | |
563 | } | |
564 | @@ -408,6 +438,8 @@ | |
565 | } | |
566 | if (!strcmp(*spp, "-allmulti")) { | |
567 | goterr |= clr_flag(ifr.ifr_name, IFF_ALLMULTI); | |
568 | + if (test_flag(ifr.ifr_name, IFF_MULTICAST) > 0) | |
569 | + fprintf(stderr, _("Warning: Interface %s still in ALLMULTI mode.\n"), ifr.ifr_name); | |
570 | spp++; | |
571 | continue; | |
572 | } | |
573 | @@ -430,6 +462,8 @@ | |
574 | if (!strcmp(*spp, "-dynamic")) { | |
575 | goterr |= clr_flag(ifr.ifr_name, IFF_DYNAMIC); | |
576 | spp++; | |
577 | + if (test_flag(ifr.ifr_name, IFF_MULTICAST) > 0) | |
578 | + fprintf(stderr, _("Warning: Interface %s still in DYNAMIC mode.\n"), ifr.ifr_name); | |
579 | continue; | |
580 | } | |
581 | #endif | |
582 | @@ -486,6 +520,8 @@ | |
583 | ||
584 | if (!strcmp(*spp, "-broadcast")) { | |
585 | goterr |= clr_flag(ifr.ifr_name, IFF_BROADCAST); | |
586 | + if (test_flag(ifr.ifr_name, IFF_MULTICAST) > 0) | |
587 | + fprintf(stderr, _("Warning: Interface %s still in BROADCAST mode.\n"), ifr.ifr_name); | |
588 | spp++; | |
589 | continue; | |
590 | } | |
591 | @@ -493,7 +529,10 @@ | |
592 | if (*++spp != NULL) { | |
593 | safe_strncpy(host, *spp, (sizeof host)); | |
594 | if (ap->input(0, host, &sa) < 0) { | |
595 | - ap->herror(host); | |
596 | + if (ap->herror) | |
597 | + ap->herror(host); | |
598 | + else | |
599 | + fprintf(stderr, _("ifconfig: Error resolving '%s' for broadcast\n"), host); | |
600 | goterr = 1; | |
601 | spp++; | |
602 | continue; | |
603 | @@ -515,7 +554,10 @@ | |
604 | usage(); | |
605 | safe_strncpy(host, *spp, (sizeof host)); | |
606 | if (ap->input(0, host, &sa) < 0) { | |
607 | - ap->herror(host); | |
608 | + if (ap->herror) | |
609 | + ap->herror(host); | |
610 | + else | |
611 | + fprintf(stderr, _("ifconfig: Error resolving '%s' for dstaddr\n"), host); | |
612 | goterr = 1; | |
613 | spp++; | |
614 | continue; | |
615 | @@ -535,13 +577,16 @@ | |
616 | usage(); | |
617 | safe_strncpy(host, *spp, (sizeof host)); | |
618 | if (ap->input(0, host, &sa) < 0) { | |
619 | - ap->herror(host); | |
620 | + if (ap->herror) | |
621 | + ap->herror(host); | |
622 | + else | |
623 | + fprintf(stderr, _("ifconfig: Error resolving '%s' for netmask\n"), host); | |
624 | goterr = 1; | |
625 | spp++; | |
626 | continue; | |
627 | } | |
628 | didnetmask++; | |
629 | - goterr = set_netmask(ap->fd, &ifr, &sa); | |
630 | + goterr |= set_netmask(ap->fd, &ifr, &sa); | |
631 | spp++; | |
632 | continue; | |
633 | } | |
634 | @@ -613,6 +658,8 @@ | |
635 | if (!strcmp(*spp, "-pointopoint")) { | |
636 | goterr |= clr_flag(ifr.ifr_name, IFF_POINTOPOINT); | |
637 | spp++; | |
638 | + if (test_flag(ifr.ifr_name, IFF_MULTICAST) > 0) | |
639 | + fprintf(stderr, _("Warning: Interface %s still in POINTOPOINT mode.\n"), ifr.ifr_name); | |
640 | continue; | |
641 | } | |
642 | if (!strcmp(*spp, "pointopoint")) { | |
643 | @@ -620,7 +667,10 @@ | |
644 | spp++; | |
645 | safe_strncpy(host, *spp, (sizeof host)); | |
646 | if (ap->input(0, host, &sa)) { | |
647 | - ap->herror(host); | |
648 | + if (ap->herror) | |
649 | + ap->herror(host); | |
650 | + else | |
651 | + fprintf(stderr, _("ifconfig: Error resolving '%s' for pointopoint\n"), host); | |
652 | goterr = 1; | |
653 | spp++; | |
654 | continue; | |
655 | @@ -661,8 +711,12 @@ | |
656 | memcpy((char *) &ifr.ifr_hwaddr, (char *) &sa, | |
657 | sizeof(struct sockaddr)); | |
658 | if (ioctl(skfd, SIOCSIFHWADDR, &ifr) < 0) { | |
659 | - fprintf(stderr, "SIOCSIFHWADDR: %s\n", | |
660 | - strerror(errno)); | |
661 | + if (errno == EBUSY) | |
662 | + fprintf(stderr, "SIOCSIFHWADDR: %s - you may need to down the interface\n", | |
663 | + strerror(errno)); | |
664 | + else | |
665 | + fprintf(stderr, "SIOCSIFHWADDR: %s\n", | |
666 | + strerror(errno)); | |
667 | goterr = 1; | |
668 | } | |
669 | spp++; | |
670 | @@ -681,12 +735,15 @@ | |
671 | usage(); | |
672 | *cp = 0; | |
673 | } else { | |
674 | - prefix_len = 0; | |
675 | + prefix_len = 128; | |
676 | } | |
677 | safe_strncpy(host, *spp, (sizeof host)); | |
678 | if (inet6_aftype.input(1, host, | |
679 | (struct sockaddr *) &sa6) < 0) { | |
680 | - inet6_aftype.herror(host); | |
681 | + if (inet6_aftype.herror) | |
682 | + inet6_aftype.herror(host); | |
683 | + else | |
684 | + fprintf(stderr, _("ifconfig: Error resolving '%s' for add\n"), host); | |
685 | goterr = 1; | |
686 | spp++; | |
687 | continue; | |
688 | @@ -771,7 +828,7 @@ | |
689 | usage(); | |
690 | *cp = 0; | |
691 | } else { | |
692 | - prefix_len = 0; | |
693 | + prefix_len = 128; | |
694 | } | |
695 | safe_strncpy(host, *spp, (sizeof host)); | |
696 | if (inet6_aftype.input(1, host, | |
697 | @@ -800,6 +857,8 @@ | |
698 | } | |
699 | ifr6.ifr6_ifindex = ifr.ifr_ifindex; | |
700 | ifr6.ifr6_prefixlen = prefix_len; | |
701 | + if (opt_v) | |
702 | + fprintf(stderr, "now deleting: ioctl(SIOCDIFADDR,{ifindex=%d,prefixlen=%ld})\n",ifr.ifr_ifindex,prefix_len); | |
703 | if (ioctl(fd, SIOCDIFADDR, &ifr6) < 0) { | |
704 | fprintf(stderr, "SIOCDIFADDR: %s\n", | |
705 | strerror(errno)); | |
706 | @@ -859,7 +918,7 @@ | |
707 | usage(); | |
708 | *cp = 0; | |
709 | } else { | |
710 | - prefix_len = 0; | |
711 | + prefix_len = 128; | |
712 | } | |
713 | safe_strncpy(host, *spp, (sizeof host)); | |
714 | if (inet6_aftype.input(1, host, (struct sockaddr *) &sa6) < 0) { | |
715 | @@ -903,7 +962,7 @@ | |
716 | /* FIXME: sa is too small for INET6 addresses, inet6 should use that too, | |
717 | broadcast is unexpected */ | |
718 | if (ap->getmask) { | |
719 | - switch (ap->getmask(host, &sa, NULL)) { | |
720 | + switch (ap->getmask(host, &samask, NULL)) { | |
721 | case -1: | |
722 | usage(); | |
723 | break; | |
724 | @@ -911,8 +970,8 @@ | |
725 | if (didnetmask) | |
726 | usage(); | |
727 | ||
728 | - goterr = set_netmask(skfd, &ifr, &sa); | |
729 | - didnetmask++; | |
730 | + // remeber to set the netmask from samask later | |
731 | + neednetmask = 1; | |
732 | break; | |
733 | } | |
734 | } | |
735 | @@ -921,9 +980,11 @@ | |
736 | exit(1); | |
737 | } | |
738 | if (ap->input(0, host, &sa) < 0) { | |
739 | - ap->herror(host); | |
740 | - fprintf(stderr, _("ifconfig: `--help' gives usage information.\n")); | |
741 | - exit(1); | |
742 | + if (ap->herror) | |
743 | + ap->herror(host); | |
744 | + else | |
745 | + fprintf(stderr,_("ifconfig: error resolving '%s' to set address for af=%s\n"), host, ap->name); fprintf(stderr, | |
746 | + _("ifconfig: `--help' gives usage information.\n")); exit(1); | |
747 | } | |
748 | memcpy((char *) &ifr.ifr_addr, (char *) &sa, sizeof(struct sockaddr)); | |
749 | { | |
750 | @@ -980,6 +1041,14 @@ | |
751 | spp++; | |
752 | } | |
753 | ||
754 | + if (neednetmask) { | |
755 | + goterr |= set_netmask(skfd, &ifr, &samask); | |
756 | + didnetmask++; | |
757 | + } | |
758 | + | |
759 | + if (opt_v && goterr) | |
760 | + fprintf(stderr, _("WARNING: at least one error occured. (%d)\n"), goterr); | |
761 | + | |
762 | return (goterr); | |
763 | } | |
764 | ||
765 | --- net-tools-1.60/include/interface.h 2001-02-10 21:24:25.000000000 +0200 | |
766 | +++ net-tools/include/interface.h 2002-03-05 02:47:36.000000000 +0200 | |
767 | @@ -64,13 +64,17 @@ | |
768 | extern int if_fetch(struct interface *ife); | |
769 | ||
770 | extern int for_all_interfaces(int (*)(struct interface *, void *), void *); | |
771 | -extern int free_interface_list(void); | |
772 | +extern int if_cache_free(void); | |
773 | extern struct interface *lookup_interface(char *name); | |
774 | extern int if_readlist(void); | |
775 | ||
776 | extern int do_if_fetch(struct interface *ife); | |
777 | extern int do_if_print(struct interface *ife, void *cookie); | |
778 | ||
779 | +extern int procnetdev_version(char *buf); | |
780 | +extern int get_dev_fields(char *bp, struct interface *ife); | |
781 | +extern char * get_name(char *name, char *p); | |
782 | + | |
783 | extern void ife_print(struct interface *ptr); | |
784 | ||
785 | extern int ife_short; | |
0e98a7c1 | 786 | --- net-tools-1.60/include/mii.h 2000-05-21 16:21:27.000000000 +0200 |
af24c785 ER |
787 | +++ net-tools/include/mii.h 2006-09-27 23:59:19.000000000 +0300 |
788 | @@ -6,11 +6,14 @@ | |
789 | * Copyright (C) 2000 David A. Hinds -- dhinds@pcmcia.sourceforge.org | |
790 | */ | |
791 | ||
792 | -#ifndef _LINUX_MII_H | |
793 | -#define _LINUX_MII_H | |
794 | +#ifndef _NETTOOL_MII_H | |
795 | +#define _NETTOOLS_MII_H | |
796 | + | |
797 | +#include <linux/sockios.h> | |
798 | ||
799 | /* network interface ioctl's for MII commands */ | |
800 | #ifndef SIOCGMIIPHY | |
801 | +#warning "SIOCGMIIPHY is not defined by your kernel source" | |
802 | #define SIOCGMIIPHY (SIOCDEVPRIVATE) /* Read from current PHY */ | |
803 | #define SIOCGMIIREG (SIOCDEVPRIVATE+1) /* Read any PHY register */ | |
804 | #define SIOCSMIIREG (SIOCDEVPRIVATE+2) /* Write any PHY register */ | |
0e98a7c1 ER |
805 | @@ -38,6 +41,7 @@ |
806 | #define MII_BMCR_RESTART 0x0200 | |
807 | #define MII_BMCR_DUPLEX 0x0100 | |
808 | #define MII_BMCR_COLTEST 0x0080 | |
809 | +#define MII_BMCR_SPEED1000 0x0040 | |
810 | ||
811 | /* Basic Mode Status Register */ | |
812 | #define MII_BMSR 0x01 | |
813 | @@ -83,4 +87,17 @@ | |
814 | #define MII_ANER_PAGE_RX 0x0002 | |
815 | #define MII_ANER_LP_AN_ABLE 0x0001 | |
af24c785 ER |
816 | |
817 | -#endif /* _LINUX_MII_H */ | |
0e98a7c1 ER |
818 | +#define MII_CTRL1000 0x09 |
819 | +#define MII_BMCR2_1000FULL 0x0200 | |
820 | +#define MII_BMCR2_1000HALF 0x0100 | |
821 | + | |
822 | +#define MII_STAT1000 0x0a | |
823 | +#define MII_LPA2_1000LOCALOK 0x2000 | |
824 | +#define MII_LPA2_1000REMRXOK 0x1000 | |
825 | +#define MII_LPA2_1000FULL 0x0800 | |
826 | +#define MII_LPA2_1000HALF 0x0400 | |
827 | + | |
828 | +/* Last register we need for show_basic_mii() */ | |
829 | +#define MII_BASIC_MAX (MII_STAT1000+1) | |
830 | + | |
af24c785 ER |
831 | +#endif /* _NETTOOLS_MII_H */ |
832 | --- net-tools-1.60/include/util-ank.h 1999-04-21 20:38:05.000000000 +0300 | |
833 | +++ net-tools/include/util-ank.h 2006-10-11 04:14:33.000000000 +0300 | |
834 | @@ -75,6 +75,6 @@ | |
835 | extern int do_class(int argc, char **argv); | |
836 | extern int do_filter(int argc, char **argv); | |
837 | ||
838 | -extern const char *format_host(int af, void *addr, __u8 *abuf, int alen); | |
839 | +extern const char *format_host(int af, void *addr, char *abuf, int alen); | |
840 | ||
841 | #endif /* __UTILS_H__ */ | |
842 | --- net-tools-1.60/ipmaddr.c 2001-04-08 19:04:23.000000000 +0200 | |
843 | +++ net-tools/ipmaddr.c 2006-10-11 04:13:57.000000000 +0300 | |
844 | @@ -291,13 +291,15 @@ | |
845 | static int multiaddr_list(int argc, char **argv) | |
846 | { | |
847 | struct ma_info *list = NULL; | |
848 | + size_t l; | |
849 | ||
850 | while (argc > 0) { | |
851 | if (strcmp(*argv, "dev") == 0) { | |
852 | NEXT_ARG(); | |
853 | - if (filter_dev[0]) | |
854 | + l = strlen(*argv); | |
855 | + if (l <= 0 || l >= sizeof(filter_dev)) | |
856 | usage(); | |
857 | - strcpy(filter_dev, *argv); | |
858 | + strncpy(filter_dev, *argv, sizeof (filter_dev)); | |
859 | } else if (strcmp(*argv, "all") == 0) { | |
860 | filter_family = AF_UNSPEC; | |
861 | } else if (strcmp(*argv, "ipv4") == 0) { | |
862 | @@ -307,9 +309,10 @@ | |
863 | } else if (strcmp(*argv, "link") == 0) { | |
864 | filter_family = AF_PACKET; | |
865 | } else { | |
866 | - if (filter_dev[0]) | |
867 | + l = strlen(*argv); | |
868 | + if (l <= 0 || l >= sizeof(filter_dev)) | |
869 | usage(); | |
870 | - strcpy(filter_dev, *argv); | |
871 | + strncpy(filter_dev, *argv, sizeof (filter_dev)); | |
872 | } | |
873 | argv++; argc--; | |
874 | } | |
875 | --- net-tools-1.60/lib/ddp_gr.c 1999-01-09 17:54:32.000000000 +0200 | |
876 | +++ net-tools/lib/ddp_gr.c 2002-06-02 08:25:15.000000000 +0300 | |
877 | @@ -1,3 +1,20 @@ | |
878 | +/* | |
879 | + * lib/ddp_gr.c Prinbting of DDP (AppleTalk) routing table | |
880 | + * used by the NET-LIB. | |
881 | + * | |
882 | + * NET-LIB | |
883 | + * | |
884 | + * Version: $Id$ | |
885 | + * | |
886 | + * Author: Ajax <ajax@firest0rm.org> | |
887 | + * | |
888 | + * Modification: | |
889 | + * 2002-06-02 integrated into main source by Bernd Eckenfels | |
890 | + * | |
891 | + */ | |
892 | + | |
893 | +/* TODO: name lookups (/etc/atalk.names? NBP?) */ | |
894 | + | |
895 | #include "config.h" | |
896 | ||
897 | #if HAVE_AFATALK | |
898 | @@ -16,9 +33,61 @@ | |
899 | #include "pathnames.h" | |
900 | #include "intl.h" | |
901 | ||
902 | +/* stolen from inet_gr.c */ | |
903 | +#define flags_decode(i,o) do { \ | |
904 | + o[0] = '\0'; \ | |
905 | + if (i & RTF_UP) strcat(o, "U"); \ | |
906 | + if (i & RTF_GATEWAY) strcat(o, "G"); \ | |
907 | + if (i & RTF_REJECT) strcat(o, "!"); \ | |
908 | + if (i & RTF_HOST) strcat(o, "H"); \ | |
909 | + if (i & RTF_REINSTATE) strcat(o, "R"); \ | |
910 | + if (i & RTF_DYNAMIC) strcat(o, "D"); \ | |
911 | + if (i & RTF_MODIFIED) strcat(o, "M"); \ | |
912 | + if (i & RTF_DEFAULT) strcat(o, "d"); \ | |
913 | + if (i & RTF_ALLONLINK) strcat(o, "a"); \ | |
914 | + if (i & RTF_ADDRCONF) strcat(o, "c"); \ | |
915 | + if (i & RTF_NONEXTHOP) strcat(o, "o"); \ | |
916 | + if (i & RTF_EXPIRES) strcat(o, "e"); \ | |
917 | + if (i & RTF_CACHE) strcat(o, "c"); \ | |
918 | + if (i & RTF_FLOW) strcat(o, "f"); \ | |
919 | + if (i & RTF_POLICY) strcat(o, "p"); \ | |
920 | + if (i & RTF_LOCAL) strcat(o, "l"); \ | |
921 | + if (i & RTF_MTU) strcat(o, "u"); \ | |
922 | + if (i & RTF_WINDOW) strcat(o, "w"); \ | |
923 | + if (i & RTF_IRTT) strcat(o, "i"); \ | |
924 | + if (i & RTF_NOTCACHED) strcat(o, "n"); \ | |
925 | + } while (0) | |
926 | + | |
927 | int DDP_rprint(int options) | |
928 | { | |
929 | - fprintf(stderr, _("Routing table for `ddp' not yet supported.\n")); | |
930 | - return (1); | |
931 | + FILE *fp; | |
932 | + char *dest, *gw, *dev, *flags; | |
933 | + char oflags[32]; | |
934 | + char *hdr = "Destination Gateway Device Flags"; | |
935 | + | |
936 | + fp = fopen(_PATH_PROCNET_ATALK_ROUTE, "r"); | |
937 | + | |
938 | + if (!fp) { | |
939 | + perror("Error opening " _PATH_PROCNET_ATALK_ROUTE); | |
940 | + fprintf(stderr, "DDP (AppleTalk) not configured on this system.\n"); | |
941 | + return 1; | |
942 | + } | |
943 | + | |
944 | + fscanf(fp, "%as %as %as %as\n", &dest, &gw, &flags, &dev); | |
945 | + free(dest); free(gw); free(dev); free(flags); | |
946 | + | |
947 | + printf("%s\n", hdr); | |
948 | + | |
949 | + while (fscanf(fp, "%as %as %as %as\n", &dest, &gw, &flags, &dev) == 4) { | |
950 | + int iflags = atoi(flags); | |
951 | + flags_decode(iflags, oflags); | |
952 | + printf("%-16s%-16s%-16s%-s\n", dest, gw, dev, oflags); | |
953 | + free(dest); free(gw); free(dev); free(flags); | |
954 | + } | |
955 | + | |
956 | + fclose(fp); | |
957 | + | |
958 | + return 0; | |
959 | + | |
960 | } | |
961 | #endif | |
962 | --- net-tools-1.60/lib/ether.c 1999-11-20 23:02:53.000000000 +0200 | |
963 | +++ net-tools/lib/ether.c 2002-07-30 08:17:29.000000000 +0300 | |
964 | @@ -2,7 +2,7 @@ | |
965 | * lib/ether.c This file contains an implementation of the "Ethernet" | |
966 | * support functions. | |
967 | * | |
968 | - * Version: $Id$ | |
969 | + * Version: $Id$ | |
970 | * | |
971 | * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> | |
972 | * Copyright 1993 MicroWalt Corporation | |
973 | @@ -39,7 +39,7 @@ | |
974 | { | |
975 | static char buff[64]; | |
976 | ||
977 | - snprintf(buff, sizeof(buff), "%02X:%02X:%02X:%02X:%02X:%02X", | |
978 | + snprintf(buff, sizeof(buff), "%02x:%02x:%02x:%02x:%02x:%02x", | |
979 | (ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377), | |
980 | (ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377) | |
981 | ); | |
0e98a7c1 ER |
982 | --- net-tools-1.60/lib/eui64.c 1970-01-01 03:00:00.000000000 +0300 |
983 | +++ net-tools/lib/eui64.c 2001-11-12 04:12:05.000000000 +0200 | |
984 | @@ -0,0 +1,155 @@ | |
985 | +/* | |
986 | + * lib/eui64.c This file contains support for generic EUI-64 hw addressing | |
987 | + * | |
988 | + * Version: $Id$ | |
989 | + * | |
990 | + * Author: Daniel Stodden <stodden@in.tum.de> | |
991 | + * Copyright 2001 Daniel Stodden | |
992 | + * | |
993 | + * blueprinted from ether.c | |
994 | + * Copyright 1993 MicroWalt Corporation | |
995 | + * | |
996 | + * This program is free software; you can redistribute it | |
997 | + * and/or modify it under the terms of the GNU General | |
998 | + * Public License as published by the Free Software | |
999 | + * Foundation; either version 2 of the License, or (at | |
1000 | + * your option) any later version. | |
1001 | + */ | |
1002 | +#include "config.h" | |
1003 | + | |
1004 | +#if HAVE_HWEUI64 | |
1005 | + | |
1006 | +#include <sys/types.h> | |
1007 | +#include <sys/ioctl.h> | |
1008 | +#include <sys/socket.h> | |
1009 | +#include <net/if_arp.h> | |
1010 | +#include <stdlib.h> | |
1011 | +#include <stdio.h> | |
1012 | +#include <ctype.h> | |
1013 | +#include <errno.h> | |
1014 | +#include <fcntl.h> | |
1015 | +#include <string.h> | |
1016 | +#include <termios.h> | |
1017 | +#include <unistd.h> | |
1018 | +#include "net-support.h" | |
1019 | +#include "pathnames.h" | |
1020 | +#include "intl.h" | |
1021 | + | |
1022 | +/* | |
1023 | + * EUI-64 constants | |
1024 | + */ | |
1025 | + | |
1026 | +#define EUI64_ALEN 8 | |
1027 | + | |
1028 | +#ifndef ARPHRD_EUI64 | |
1029 | +#define ARPHRD_EUI64 27 | |
1030 | +#warning "ARPHRD_EUI64 not defined in <net/if_arp.h>. Using private value 27" | |
1031 | +#endif | |
1032 | + | |
1033 | +struct hwtype eui64_hwtype; | |
1034 | + | |
1035 | +/* Display an EUI-64 address in readable format. */ | |
1036 | +static char *pr_eui64( unsigned char *ptr ) | |
1037 | +{ | |
1038 | + static char buff[64]; | |
1039 | + | |
1040 | + snprintf(buff, sizeof(buff), "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", | |
1041 | + (ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377), (ptr[3] & 0377), | |
1042 | + (ptr[4] & 0377), (ptr[5] & 0377), (ptr[6] & 0377), (ptr[7] & 0377) | |
1043 | + ); | |
1044 | + return (buff); | |
1045 | +} | |
1046 | + | |
1047 | +/* Start the PPP encapsulation on the file descriptor. */ | |
1048 | +static int in_eui64( char *bufp, struct sockaddr *sap ) | |
1049 | +{ | |
1050 | + unsigned char *ptr; | |
1051 | + char c, *orig; | |
1052 | + int i; | |
1053 | + unsigned val; | |
1054 | + | |
1055 | + sap->sa_family = eui64_hwtype.type; | |
1056 | + ptr = sap->sa_data; | |
1057 | + | |
1058 | + i = 0; | |
1059 | + orig = bufp; | |
1060 | + | |
1061 | + while ((*bufp != '\0') && (i < EUI64_ALEN)) { | |
1062 | + val = 0; | |
1063 | + c = *bufp++; | |
1064 | + if (isdigit(c)) | |
1065 | + val = c - '0'; | |
1066 | + else if (c >= 'a' && c <= 'f') | |
1067 | + val = c - 'a' + 10; | |
1068 | + else if (c >= 'A' && c <= 'F') | |
1069 | + val = c - 'A' + 10; | |
1070 | + else { | |
1071 | +#ifdef DEBUG | |
1072 | + fprintf( stderr, _("in_eui64(%s): invalid eui64 address!\n"), | |
1073 | + orig ); | |
1074 | +#endif | |
1075 | + errno = EINVAL; | |
1076 | + return (-1); | |
1077 | + } | |
1078 | + | |
1079 | + val <<= 4; | |
1080 | + c = *bufp; | |
1081 | + if (isdigit(c)) | |
1082 | + val |= c - '0'; | |
1083 | + else if (c >= 'a' && c <= 'f') | |
1084 | + val |= c - 'a' + 10; | |
1085 | + else if (c >= 'A' && c <= 'F') | |
1086 | + val |= c - 'A' + 10; | |
1087 | + else if (c == ':' || c == 0) | |
1088 | + val >>= 4; | |
1089 | + else { | |
1090 | +#ifdef DEBUG | |
1091 | + fprintf( stderr, _("in_eui64(%s): invalid eui64 address!\n"), | |
1092 | + orig ); | |
1093 | +#endif | |
1094 | + errno = EINVAL; | |
1095 | + return (-1); | |
1096 | + } | |
1097 | + | |
1098 | + if (c != 0) | |
1099 | + bufp++; | |
1100 | + | |
1101 | + *ptr++ = (unsigned char) (val & 0377); | |
1102 | + i++; | |
1103 | + | |
1104 | + /* We might get a semicolon here - not required. */ | |
1105 | + if (*bufp == ':') { | |
1106 | + if (i == EUI64_ALEN) { | |
1107 | +#ifdef DEBUG | |
1108 | + fprintf(stderr, _("in_eui64(%s): trailing : ignored!\n"), | |
1109 | + orig) | |
1110 | +#endif | |
1111 | + ; /* nothing */ | |
1112 | + } | |
1113 | + bufp++; | |
1114 | + } | |
1115 | + } | |
1116 | + | |
1117 | + /* That's it. Any trailing junk? */ | |
1118 | + if ((i == EUI64_ALEN) && (*bufp != '\0')) { | |
1119 | +#ifdef DEBUG | |
1120 | + fprintf(stderr, _("in_eui64(%s): trailing junk!\n"), orig); | |
1121 | + errno = EINVAL; | |
1122 | + return (-1); | |
1123 | +#endif | |
1124 | + } | |
1125 | +#ifdef DEBUG | |
1126 | + fprintf(stderr, "in_eui64(%s): %s\n", orig, pr_eui64(sap->sa_data)); | |
1127 | +#endif | |
1128 | + | |
1129 | + return (0); | |
1130 | +} | |
1131 | + | |
1132 | +struct hwtype eui64_hwtype = | |
1133 | +{ | |
1134 | + "eui64", NULL, /*"EUI-64 addressing", */ ARPHRD_EUI64, EUI64_ALEN, | |
1135 | + pr_eui64, in_eui64, NULL, 0 | |
1136 | +}; | |
1137 | + | |
1138 | + | |
1139 | +#endif /* HAVE_EUI64 */ | |
af24c785 ER |
1140 | --- net-tools-1.60/lib/hw.c 2000-05-20 20:27:25.000000000 +0200 |
1141 | +++ net-tools/lib/hw.c 2001-11-12 04:12:05.000000000 +0200 | |
1142 | @@ -2,7 +2,7 @@ | |
1143 | * lib/hw.c This file contains the top-level part of the hardware | |
1144 | * support functions module. | |
1145 | * | |
1146 | - * Version: $Id$ | |
1147 | + * Version: $Id$ | |
1148 | * | |
1149 | * Maintainer: Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de> | |
1150 | * | |
1151 | @@ -73,6 +73,8 @@ | |
1152 | ||
1153 | extern struct hwtype ec_hwtype; | |
1154 | ||
1155 | +extern struct hwtype eui64_hwtype; | |
1156 | + | |
1157 | static struct hwtype *hwtypes[] = | |
1158 | { | |
1159 | ||
1160 | @@ -144,6 +146,9 @@ | |
1161 | #if HAVE_HWX25 | |
1162 | &x25_hwtype, | |
1163 | #endif | |
1164 | +#if HAVE_HWEUI64 | |
1165 | + &eui64_hwtype, | |
1166 | +#endif | |
1167 | &unspec_hwtype, | |
1168 | NULL | |
1169 | }; | |
1170 | @@ -217,6 +222,9 @@ | |
1171 | #if HAVE_HWEC | |
1172 | ec_hwtype.title = _("Econet"); | |
1173 | #endif | |
1174 | +#if HAVE_HWEUI64 | |
1175 | + eui64_hwtype.title = _("Generic EUI-64"); | |
1176 | +#endif | |
1177 | sVhwinit = 1; | |
1178 | } | |
1179 | ||
1180 | --- net-tools-1.60/lib/inet6.c 2000-10-28 13:04:00.000000000 +0200 | |
1181 | +++ net-tools/lib/inet6.c 2002-12-10 03:03:09.000000000 +0200 | |
1182 | @@ -3,7 +3,7 @@ | |
1183 | * support functions for the net-tools. | |
1184 | * (most of it copied from lib/inet.c 1.26). | |
1185 | * | |
1186 | - * Version: $Id$ | |
1187 | + * Version: $Id$ | |
1188 | * | |
1189 | * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> | |
1190 | * Copyright 1993 MicroWalt Corporation | |
1191 | @@ -44,6 +44,21 @@ | |
1192 | ||
1193 | extern int h_errno; /* some netdb.h versions don't export this */ | |
1194 | ||
1195 | +char * fix_v4_address(char *buf, struct in6_addr *in6) | |
1196 | +{ | |
1197 | + if (IN6_IS_ADDR_V4MAPPED(in6->s6_addr)) { | |
1198 | + char *s =strchr(buf, '.'); | |
1199 | + if (s) { | |
1200 | + while (s > buf && *s != ':') | |
1201 | + --s; | |
1202 | + if (*s == ':') ++s; | |
1203 | + else s = NULL; | |
1204 | + } | |
1205 | + if (s) return s; | |
1206 | + } | |
1207 | + return buf; | |
1208 | +} | |
1209 | + | |
1210 | static int INET6_resolve(char *name, struct sockaddr_in6 *sin6) | |
1211 | { | |
1212 | struct addrinfo req, *ai; | |
1213 | @@ -83,14 +98,14 @@ | |
1214 | return (-1); | |
1215 | } | |
1216 | if (numeric & 0x7FFF) { | |
1217 | - inet_ntop(AF_INET6, &sin6->sin6_addr, name, 80); | |
1218 | + inet_ntop( AF_INET6, &sin6->sin6_addr, name, 80); | |
1219 | return (0); | |
1220 | } | |
1221 | if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { | |
1222 | if (numeric & 0x8000) | |
1223 | strcpy(name, "default"); | |
1224 | else | |
1225 | - strcpy(name, "*"); | |
1226 | + strcpy(name, "[::]"); | |
1227 | return (0); | |
1228 | } | |
1229 | ||
1230 | @@ -109,13 +124,14 @@ | |
1231 | } | |
1232 | ||
1233 | ||
1234 | + | |
1235 | /* Display an Internet socket address. */ | |
1236 | static char *INET6_print(unsigned char *ptr) | |
1237 | { | |
1238 | static char name[80]; | |
1239 | ||
1240 | inet_ntop(AF_INET6, (struct in6_addr *) ptr, name, 80); | |
1241 | - return name; | |
1242 | + return fix_v4_address(name, (struct in6_addr *)ptr); | |
1243 | } | |
1244 | ||
1245 | ||
1246 | @@ -129,13 +145,14 @@ | |
1247 | return safe_strncpy(buff, _("[NONE SET]"), sizeof(buff)); | |
1248 | if (INET6_rresolve(buff, (struct sockaddr_in6 *) sap, numeric) != 0) | |
1249 | return safe_strncpy(buff, _("[UNKNOWN]"), sizeof(buff)); | |
1250 | - return (buff); | |
1251 | + return (fix_v4_address(buff, &((struct sockaddr_in6 *)sap)->sin6_addr)); | |
1252 | } | |
1253 | ||
1254 | ||
1255 | static int INET6_getsock(char *bufp, struct sockaddr *sap) | |
1256 | { | |
1257 | struct sockaddr_in6 *sin6; | |
1258 | + char *p; | |
1259 | ||
1260 | sin6 = (struct sockaddr_in6 *) sap; | |
1261 | sin6->sin6_family = AF_INET6; | |
1262 | @@ -143,7 +160,9 @@ | |
1263 | ||
1264 | if (inet_pton(AF_INET6, bufp, sin6->sin6_addr.s6_addr) <= 0) | |
1265 | return (-1); | |
1266 | - | |
1267 | + p = fix_v4_address(bufp, &sin6->sin6_addr); | |
1268 | + if (p != bufp) | |
1269 | + memcpy(bufp, p, strlen(p)+1); | |
1270 | return 16; /* ?;) */ | |
1271 | } | |
1272 | ||
1273 | --- net-tools-1.60/lib/inet6_gr.c 2001-04-01 16:48:06.000000000 +0200 | |
1274 | +++ net-tools/lib/inet6_gr.c 2002-07-30 08:24:20.000000000 +0300 | |
1275 | @@ -1,4 +1,4 @@ | |
1276 | -/* | |
1277 | + /* | |
1278 | Modifications: | |
1279 | 1998-07-01 - Arnaldo Carvalho de Melo - GNU gettext instead of catgets, | |
1280 | snprintf instead of sprintf | |
1281 | @@ -71,11 +71,15 @@ | |
1282 | printf(_("INET6 (IPv6) not configured in this system.\n")); | |
1283 | return 1; | |
1284 | } | |
1285 | - printf(_("Kernel IPv6 routing table\n")); | |
1286 | ||
1287 | - printf(_("Destination " | |
1288 | - "Next Hop " | |
1289 | - "Flags Metric Ref Use Iface\n")); | |
1290 | + if (numeric & RTF_CACHE) | |
1291 | + printf(_("Kernel IPv6 routing cache\n")); | |
1292 | + else | |
1293 | + printf(_("Kernel IPv6 routing table\n")); | |
1294 | + | |
1295 | + printf(_("Destination " | |
1296 | + "Next Hop " | |
1297 | + "Flag Met Ref Use If\n")); | |
1298 | ||
1299 | while (fgets(buff, 1023, fp)) { | |
1300 | num = sscanf(buff, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %4s%4s%4s%4s%4s%4s%4s%4s %02x %4s%4s%4s%4s%4s%4s%4s%4s %08x %08x %08x %08x %s\n", | |
1301 | @@ -87,13 +91,19 @@ | |
1302 | &slen, | |
1303 | naddr6p[0], naddr6p[1], naddr6p[2], naddr6p[3], | |
1304 | naddr6p[4], naddr6p[5], naddr6p[6], naddr6p[7], | |
1305 | - &metric, &use, &refcnt, &iflags, iface); | |
1306 | + &metric, &refcnt, &use, &iflags, iface); | |
1307 | #if 0 | |
1308 | if (num < 23) | |
1309 | continue; | |
1310 | #endif | |
1311 | - if (!(iflags & RTF_UP)) | |
1312 | - continue; | |
1313 | + if (iflags & RTF_CACHE) { | |
1314 | + if (!(numeric & RTF_CACHE)) | |
1315 | + continue; | |
1316 | + } else { | |
1317 | + if (numeric & RTF_CACHE) | |
1318 | + continue; | |
1319 | + } | |
1320 | + | |
1321 | /* Fetch and resolve the target address. */ | |
1322 | snprintf(addr6, sizeof(addr6), "%s:%s:%s:%s:%s:%s:%s:%s", | |
1323 | addr6p[0], addr6p[1], addr6p[2], addr6p[3], | |
1324 | @@ -112,7 +122,12 @@ | |
1325 | inet6_aftype.sprint((struct sockaddr *) &snaddr6, 1)); | |
1326 | ||
1327 | /* Decode the flags. */ | |
1328 | - strcpy(flags, "U"); | |
1329 | + | |
1330 | + flags[0]=0; | |
1331 | + if (iflags & RTF_UP) | |
1332 | + strcat(flags, "U"); | |
1333 | + if (iflags & RTF_REJECT) | |
1334 | + strcat(flags, "!"); | |
1335 | if (iflags & RTF_GATEWAY) | |
1336 | strcat(flags, "G"); | |
1337 | if (iflags & RTF_HOST) | |
1338 | @@ -123,9 +138,19 @@ | |
1339 | strcat(flags, "A"); | |
1340 | if (iflags & RTF_CACHE) | |
1341 | strcat(flags, "C"); | |
1342 | + if (iflags & RTF_ALLONLINK) | |
1343 | + strcat(flags, "a"); | |
1344 | + if (iflags & RTF_EXPIRES) | |
1345 | + strcat(flags, "e"); | |
1346 | + if (iflags & RTF_MODIFIED) | |
1347 | + strcat(flags, "m"); | |
1348 | + if (iflags & RTF_NONEXTHOP) | |
1349 | + strcat(flags, "n"); | |
1350 | + if (iflags & RTF_FLOW) | |
1351 | + strcat(flags, "f"); | |
1352 | ||
1353 | /* Print the info. */ | |
1354 | - printf("%-43s %-39s %-5s %-6d %-2d %7d %-8s\n", | |
1355 | + printf("%-30s %-26s %-4s %-3d %-1d%6d %s\n", | |
1356 | addr6, naddr6, flags, metric, refcnt, use, iface); | |
1357 | } | |
1358 | ||
1359 | @@ -144,8 +169,7 @@ | |
1360 | char addr6p[8][5], haddrp[6][3]; | |
1361 | ||
1362 | if (!fp) { | |
1363 | - ESYSNOT("nd_print", "ND Table"); | |
1364 | - return 1; | |
1365 | + return rprint_fib6(ext, numeric | RTF_CACHE); | |
1366 | } | |
1367 | printf(_("Kernel IPv6 Neighbour Cache\n")); | |
1368 | ||
1369 | --- net-tools-1.60/lib/inet.c 2000-05-22 23:27:13.000000000 +0200 | |
1370 | +++ net-tools/lib/inet.c 2003-10-19 14:57:37.000000000 +0300 | |
1371 | @@ -3,7 +3,7 @@ | |
1372 | * support functions for the net-tools. | |
1373 | * (NET-3 base distribution). | |
1374 | * | |
1375 | - * Version: $Id$ | |
1376 | + * Version: $Id$ | |
1377 | * | |
1378 | * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> | |
1379 | * Copyright 1993 MicroWalt Corporation | |
1380 | @@ -144,7 +144,7 @@ | |
1381 | struct hostent *ent; | |
1382 | struct netent *np; | |
1383 | struct addr *pn; | |
1384 | - unsigned long ad, host_ad; | |
1385 | + u_int32_t ad, host_ad; | |
1386 | int host = 0; | |
1387 | ||
1388 | /* Grmpf. -FvK */ | |
1389 | @@ -155,7 +155,7 @@ | |
1390 | errno = EAFNOSUPPORT; | |
1391 | return (-1); | |
1392 | } | |
1393 | - ad = (unsigned long) sin->sin_addr.s_addr; | |
1394 | + ad = sin->sin_addr.s_addr; | |
1395 | #ifdef DEBUG | |
1396 | fprintf (stderr, "rresolve: %08lx, mask %08x, num %08x \n", ad, netmask, numeric); | |
1397 | #endif | |
1398 | --- net-tools-1.60/lib/inet_sr.c 2000-02-20 23:46:45.000000000 +0200 | |
1399 | +++ net-tools/lib/inet_sr.c 2003-10-12 00:08:10.000000000 +0300 | |
1400 | @@ -3,6 +3,7 @@ | |
1401 | 1998-07-01 - Arnaldo Carvalho de Melo - GNU gettext instead of catgets | |
1402 | 1999-10-07 - Kurt Garloff - for -host and gws: prefer host names | |
1403 | over networks (or even reject) | |
1404 | + 2003-10-11 - Maik Broemme - gcc 3.x warnign fixes (default: break;) | |
1405 | */ | |
1406 | ||
1407 | #include "config.h" | |
1408 | @@ -104,7 +105,6 @@ | |
1409 | isnet = 1; break; | |
1410 | case 2: | |
1411 | isnet = 0; break; | |
1412 | - default: | |
1413 | } | |
1414 | ||
1415 | /* Fill in the other fields. */ | |
1416 | --- net-tools-1.60/lib/interface.c 2001-02-10 21:31:15.000000000 +0200 | |
1417 | +++ net-tools/lib/interface.c 2005-08-24 01:46:51.000000000 +0300 | |
1418 | @@ -7,7 +7,7 @@ | |
1419 | 8/2000 Andi Kleen make the list operations a bit more efficient. | |
1420 | People are crazy enough to use thousands of aliases now. | |
1421 | ||
1422 | - $Id$ | |
1423 | + $Id$ | |
1424 | */ | |
1425 | ||
1426 | #include "config.h" | |
1427 | @@ -23,6 +23,7 @@ | |
1428 | #include <string.h> | |
1429 | #include <unistd.h> | |
1430 | #include <ctype.h> | |
1431 | +#include <string.h> | |
1432 | ||
1433 | #if HAVE_AFIPX | |
1434 | #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) | |
1435 | @@ -87,14 +88,20 @@ | |
1436 | ||
1437 | int ife_short; | |
1438 | ||
1439 | +int if_list_all = 0; /* do we have requested the complete proc list, yet? */ | |
1440 | + | |
1441 | static struct interface *int_list, *int_last; | |
1442 | ||
1443 | static int if_readlist_proc(char *); | |
1444 | ||
1445 | -static struct interface *add_interface(char *name) | |
1446 | +static struct interface *if_cache_add(char *name) | |
1447 | { | |
1448 | struct interface *ife, **nextp, *new; | |
1449 | ||
1450 | + if (!int_list) | |
1451 | + int_last = NULL; | |
1452 | + | |
1453 | + /* the cache is sorted, so if we hit a smaller if, exit */ | |
1454 | for (ife = int_last; ife; ife = ife->prev) { | |
1455 | int n = nstrcmp(ife->name, name); | |
1456 | if (n == 0) | |
1457 | @@ -104,7 +111,7 @@ | |
1458 | } | |
1459 | new(new); | |
1460 | safe_strncpy(new->name, name, IFNAMSIZ); | |
1461 | - nextp = ife ? &ife->next : &int_list; | |
1462 | + nextp = ife ? &ife->next : &int_list; // keep sorting | |
1463 | new->prev = ife; | |
1464 | new->next = *nextp; | |
1465 | if (new->next) | |
1466 | @@ -117,19 +124,22 @@ | |
1467 | ||
1468 | struct interface *lookup_interface(char *name) | |
1469 | { | |
1470 | - struct interface *ife = NULL; | |
1471 | - | |
1472 | - if (if_readlist_proc(name) < 0) | |
1473 | - return NULL; | |
1474 | - ife = add_interface(name); | |
1475 | - return ife; | |
1476 | + /* if we have read all, use it */ | |
1477 | + if (if_list_all) | |
1478 | + return if_cache_add(name); | |
1479 | + | |
1480 | + /* otherwise we read a limited list */ | |
1481 | + if (if_readlist_proc(name) < 0) | |
1482 | + return NULL; | |
1483 | + | |
1484 | + return if_cache_add(name); | |
1485 | } | |
1486 | ||
1487 | int for_all_interfaces(int (*doit) (struct interface *, void *), void *cookie) | |
1488 | { | |
1489 | struct interface *ife; | |
1490 | ||
1491 | - if (!int_list && (if_readlist() < 0)) | |
1492 | + if (!if_list_all && (if_readlist() < 0)) | |
1493 | return -1; | |
1494 | for (ife = int_list; ife; ife = ife->next) { | |
1495 | int err = doit(ife, cookie); | |
1496 | @@ -139,13 +149,15 @@ | |
1497 | return 0; | |
1498 | } | |
1499 | ||
1500 | -int free_interface_list(void) | |
1501 | +int if_cache_free(void) | |
1502 | { | |
1503 | struct interface *ife; | |
1504 | while ((ife = int_list) != NULL) { | |
1505 | int_list = ife->next; | |
1506 | free(ife); | |
1507 | } | |
1508 | + int_last = NULL; | |
1509 | + if_list_all = 0; | |
1510 | return 0; | |
1511 | } | |
1512 | ||
1513 | @@ -180,7 +192,7 @@ | |
1514 | } | |
1515 | if (ifc.ifc_len == sizeof(struct ifreq) * numreqs) { | |
1516 | /* assume it overflowed and try again */ | |
1517 | - numreqs += 10; | |
1518 | + numreqs *= 2; | |
1519 | continue; | |
1520 | } | |
1521 | break; | |
1522 | @@ -188,7 +200,7 @@ | |
1523 | ||
1524 | ifr = ifc.ifc_req; | |
1525 | for (n = 0; n < ifc.ifc_len; n += sizeof(struct ifreq)) { | |
1526 | - add_interface(ifr->ifr_name); | |
1527 | + if_cache_add(ifr->ifr_name); | |
1528 | ifr++; | |
1529 | } | |
1530 | err = 0; | |
1531 | @@ -198,7 +210,7 @@ | |
1532 | return err; | |
1533 | } | |
1534 | ||
1535 | -static char *get_name(char *name, char *p) | |
1536 | +char *get_name(char *name, char *p) | |
1537 | { | |
1538 | while (isspace(*p)) | |
1539 | p++; | |
1540 | @@ -206,16 +218,19 @@ | |
1541 | if (isspace(*p)) | |
1542 | break; | |
1543 | if (*p == ':') { /* could be an alias */ | |
1544 | - char *dot = p, *dotname = name; | |
1545 | - *name++ = *p++; | |
1546 | - while (isdigit(*p)) | |
1547 | - *name++ = *p++; | |
1548 | - if (*p != ':') { /* it wasn't, backup */ | |
1549 | - p = dot; | |
1550 | - name = dotname; | |
1551 | + char *dot = p++; | |
1552 | + while (*p && isdigit(*p)) p++; | |
1553 | + if (*p == ':') { | |
1554 | + /* Yes it is, backup and copy it. */ | |
1555 | + p = dot; | |
1556 | + *name++ = *p++; | |
1557 | + while (*p && isdigit(*p)) { | |
1558 | + *name++ = *p++; | |
1559 | + } | |
1560 | + } else { | |
1561 | + /* No, it isn't */ | |
1562 | + p = dot; | |
1563 | } | |
1564 | - if (*p == '\0') | |
1565 | - return NULL; | |
1566 | p++; | |
1567 | break; | |
1568 | } | |
1569 | @@ -225,7 +240,7 @@ | |
1570 | return p; | |
1571 | } | |
1572 | ||
1573 | -static int procnetdev_version(char *buf) | |
1574 | +int procnetdev_version(char *buf) | |
1575 | { | |
1576 | if (strstr(buf, "compressed")) | |
1577 | return 3; | |
1578 | @@ -234,12 +249,12 @@ | |
1579 | return 1; | |
1580 | } | |
1581 | ||
1582 | -static int get_dev_fields(char *bp, struct interface *ife) | |
1583 | +int get_dev_fields(char *bp, struct interface *ife) | |
1584 | { | |
1585 | switch (procnetdev_vsn) { | |
1586 | case 3: | |
1587 | sscanf(bp, | |
1588 | - "%llu %llu %lu %lu %lu %lu %lu %lu %llu %llu %lu %lu %lu %lu %lu %lu", | |
1589 | + "%Lu %Lu %lu %lu %lu %lu %lu %lu %Lu %Lu %lu %lu %lu %lu %lu %lu", | |
1590 | &ife->stats.rx_bytes, | |
1591 | &ife->stats.rx_packets, | |
1592 | &ife->stats.rx_errors, | |
1593 | @@ -259,7 +274,7 @@ | |
1594 | &ife->stats.tx_compressed); | |
1595 | break; | |
1596 | case 2: | |
1597 | - sscanf(bp, "%llu %llu %lu %lu %lu %lu %llu %llu %lu %lu %lu %lu %lu", | |
1598 | + sscanf(bp, "%Lu %Lu %lu %lu %lu %lu %Lu %Lu %lu %lu %lu %lu %lu", | |
1599 | &ife->stats.rx_bytes, | |
1600 | &ife->stats.rx_packets, | |
1601 | &ife->stats.rx_errors, | |
1602 | @@ -277,7 +292,7 @@ | |
1603 | ife->stats.rx_multicast = 0; | |
1604 | break; | |
1605 | case 1: | |
1606 | - sscanf(bp, "%llu %lu %lu %lu %lu %llu %lu %lu %lu %lu %lu", | |
1607 | + sscanf(bp, "%Lu %lu %lu %lu %lu %Lu %lu %lu %lu %lu %lu", | |
1608 | &ife->stats.rx_packets, | |
1609 | &ife->stats.rx_errors, | |
1610 | &ife->stats.rx_dropped, | |
1611 | @@ -300,22 +315,16 @@ | |
1612 | ||
1613 | static int if_readlist_proc(char *target) | |
1614 | { | |
1615 | - static int proc_read; | |
1616 | FILE *fh; | |
1617 | char buf[512]; | |
1618 | struct interface *ife; | |
1619 | int err; | |
1620 | ||
1621 | - if (proc_read) | |
1622 | - return 0; | |
1623 | - if (!target) | |
1624 | - proc_read = 1; | |
1625 | - | |
1626 | fh = fopen(_PATH_PROCNET_DEV, "r"); | |
1627 | if (!fh) { | |
1628 | fprintf(stderr, _("Warning: cannot open %s (%s). Limited output.\n"), | |
1629 | _PATH_PROCNET_DEV, strerror(errno)); | |
1630 | - return if_readconf(); | |
1631 | + return -2; | |
1632 | } | |
1633 | fgets(buf, sizeof buf, fh); /* eat line */ | |
1634 | fgets(buf, sizeof buf, fh); | |
1635 | @@ -350,7 +359,7 @@ | |
1636 | while (fgets(buf, sizeof buf, fh)) { | |
1637 | char *s, name[IFNAMSIZ]; | |
1638 | s = get_name(name, buf); | |
1639 | - ife = add_interface(name); | |
1640 | + ife = if_cache_add(name); | |
1641 | get_dev_fields(s, ife); | |
1642 | ife->statistics_valid = 1; | |
1643 | if (target && !strcmp(target,name)) | |
1644 | @@ -359,7 +368,6 @@ | |
1645 | if (ferror(fh)) { | |
1646 | perror(_PATH_PROCNET_DEV); | |
1647 | err = -1; | |
1648 | - proc_read = 0; | |
1649 | } | |
1650 | ||
1651 | #if 0 | |
1652 | @@ -371,9 +379,16 @@ | |
1653 | ||
1654 | int if_readlist(void) | |
1655 | { | |
1656 | - int err = if_readlist_proc(NULL); | |
1657 | - if (!err) | |
1658 | - err = if_readconf(); | |
1659 | + /* caller will/should check not to call this too often | |
1660 | + * (i.e. only if if_list_all == 0 | |
1661 | + */ | |
1662 | + int err = 0; | |
1663 | + | |
1664 | + err |= if_readlist_proc(NULL); | |
1665 | + err |= if_readconf(); | |
1666 | + | |
1667 | + if_list_all = 1; | |
1668 | + | |
1669 | return err; | |
1670 | } | |
1671 | ||
1672 | @@ -580,10 +595,10 @@ | |
1673 | void ife_print_short(struct interface *ptr) | |
1674 | { | |
1675 | printf("%-5.5s ", ptr->name); | |
1676 | - printf("%5d %3d", ptr->mtu, ptr->metric); | |
1677 | + printf("%5d %-2d ", ptr->mtu, ptr->metric); | |
1678 | /* If needed, display the interface statistics. */ | |
1679 | if (ptr->statistics_valid) { | |
1680 | - printf("%8llu %6lu %6lu %6lu", | |
1681 | + printf("%8llu %6lu %6lu %-6lu ", | |
1682 | ptr->stats.rx_packets, ptr->stats.rx_errors, | |
1683 | ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors); | |
1684 | printf("%8llu %6lu %6lu %6lu ", | |
1685 | @@ -636,9 +651,10 @@ | |
1686 | int hf; | |
1687 | int can_compress = 0; | |
1688 | unsigned long long rx, tx, short_rx, short_tx; | |
1689 | - char Rext[5]="b"; | |
1690 | - char Text[5]="b"; | |
1691 | - | |
1692 | + const char *Rext = "B"; | |
1693 | + const char *Text = "B"; | |
1694 | + static char flags[200]; | |
1695 | + | |
1696 | #if HAVE_AFIPX | |
1697 | static struct aftype *ipxtype = NULL; | |
1698 | #endif | |
1699 | @@ -670,32 +686,70 @@ | |
1700 | if (hw == NULL) | |
1701 | hw = get_hwntype(-1); | |
1702 | ||
1703 | - printf(_("%-9.9s Link encap:%s "), ptr->name, hw->title); | |
1704 | - /* For some hardware types (eg Ash, ATM) we don't print the | |
1705 | - hardware address if it's null. */ | |
1706 | - if (hw->print != NULL && (! (hw_null_address(hw, ptr->hwaddr) && | |
1707 | - hw->suppress_null_addr))) | |
1708 | - printf(_("HWaddr %s "), hw->print(ptr->hwaddr)); | |
1709 | -#ifdef IFF_PORTSEL | |
1710 | - if (ptr->flags & IFF_PORTSEL) { | |
1711 | - printf(_("Media:%s"), if_port_text[ptr->map.port][0]); | |
1712 | - if (ptr->flags & IFF_AUTOMEDIA) | |
1713 | - printf(_("(auto)")); | |
1714 | - } | |
1715 | + sprintf(flags, "flags=%d<", ptr->flags); | |
1716 | + /* DONT FORGET TO ADD THE FLAGS IN ife_print_short, too */ | |
1717 | + if (ptr->flags == 0) | |
1718 | + strcat(flags,">"); | |
1719 | + if (ptr->flags & IFF_UP) | |
1720 | + strcat(flags,_("UP,")); | |
1721 | + if (ptr->flags & IFF_BROADCAST) | |
1722 | + strcat(flags,_("BROADCAST,")); | |
1723 | + if (ptr->flags & IFF_DEBUG) | |
1724 | + strcat(flags,_("DEBUG,")); | |
1725 | + if (ptr->flags & IFF_LOOPBACK) | |
1726 | + strcat(flags,_("LOOPBACK,")); | |
1727 | + if (ptr->flags & IFF_POINTOPOINT) | |
1728 | + strcat(flags,_("POINTOPOINT,")); | |
1729 | + if (ptr->flags & IFF_NOTRAILERS) | |
1730 | + strcat(flags,_("NOTRAILERS,")); | |
1731 | + if (ptr->flags & IFF_RUNNING) | |
1732 | + strcat(flags,_("RUNNING,")); | |
1733 | + if (ptr->flags & IFF_NOARP) | |
1734 | + strcat(flags,_("NOARP,")); | |
1735 | + if (ptr->flags & IFF_PROMISC) | |
1736 | + strcat(flags,_("PROMISC,")); | |
1737 | + if (ptr->flags & IFF_ALLMULTI) | |
1738 | + strcat(flags,_("ALLMULTI,")); | |
1739 | + if (ptr->flags & IFF_SLAVE) | |
1740 | + strcat(flags,_("SLAVE,")); | |
1741 | + if (ptr->flags & IFF_MASTER) | |
1742 | + strcat(flags,_("MASTER,")); | |
1743 | + if (ptr->flags & IFF_MULTICAST) | |
1744 | + strcat(flags,_("MULTICAST,")); | |
1745 | +#ifdef HAVE_DYNAMIC | |
1746 | + if (ptr->flags & IFF_DYNAMIC) | |
1747 | + strcat(flags,_("DYNAMIC,")); | |
1748 | +#endif | |
1749 | + /* DONT FORGET TO ADD THE FLAGS IN ife_print_short */ | |
1750 | + if (flags[strlen(flags)-1] == ',') | |
1751 | + flags[strlen(flags)-1] = '>'; | |
1752 | + else | |
1753 | + flags[strlen(flags)-1] = 0; | |
1754 | + | |
1755 | + | |
1756 | + printf(_("%s: %s mtu %d metric %d"), | |
1757 | + ptr->name, flags, ptr->mtu, ptr->metric ? ptr->metric : 1); | |
1758 | +#ifdef SIOCSKEEPALIVE | |
1759 | + if (ptr->outfill || ptr->keepalive) | |
1760 | + printf(_(" outfill %d keepalive %d"), | |
1761 | + ptr->outfill, ptr->keepalive); | |
1762 | #endif | |
1763 | printf("\n"); | |
1764 | ||
1765 | + | |
1766 | + | |
1767 | #if HAVE_AFINET | |
1768 | if (ptr->has_ip) { | |
1769 | - printf(_(" %s addr:%s "), ap->name, | |
1770 | + printf(_(" %s %s"), ap->name, | |
1771 | ap->sprint(&ptr->addr, 1)); | |
1772 | - if (ptr->flags & IFF_POINTOPOINT) { | |
1773 | - printf(_(" P-t-P:%s "), ap->sprint(&ptr->dstaddr, 1)); | |
1774 | - } | |
1775 | + printf(_(" netmask %s"), ap->sprint(&ptr->netmask, 1)); | |
1776 | if (ptr->flags & IFF_BROADCAST) { | |
1777 | - printf(_(" Bcast:%s "), ap->sprint(&ptr->broadaddr, 1)); | |
1778 | + printf(_(" broadcast %s"), ap->sprint(&ptr->broadaddr, 1)); | |
1779 | + } | |
1780 | + if (ptr->flags & IFF_POINTOPOINT) { | |
1781 | + printf(_(" destination %s"), ap->sprint(&ptr->dstaddr, 1)); | |
1782 | } | |
1783 | - printf(_(" Mask:%s\n"), ap->sprint(&ptr->netmask, 1)); | |
1784 | + printf("\n"); | |
1785 | } | |
1786 | #endif | |
1787 | ||
1788 | @@ -712,29 +766,30 @@ | |
1789 | addr6p[0], addr6p[1], addr6p[2], addr6p[3], | |
1790 | addr6p[4], addr6p[5], addr6p[6], addr6p[7]); | |
1791 | inet6_aftype.input(1, addr6, (struct sockaddr *) &sap); | |
1792 | - printf(_(" inet6 addr: %s/%d"), | |
1793 | - inet6_aftype.sprint((struct sockaddr *) &sap, 1), plen); | |
1794 | - printf(_(" Scope:")); | |
1795 | - switch (scope) { | |
1796 | - case 0: | |
1797 | - printf(_("Global")); | |
1798 | - break; | |
1799 | - case IPV6_ADDR_LINKLOCAL: | |
1800 | - printf(_("Link")); | |
1801 | - break; | |
1802 | - case IPV6_ADDR_SITELOCAL: | |
1803 | - printf(_("Site")); | |
1804 | - break; | |
1805 | - case IPV6_ADDR_COMPATv4: | |
1806 | - printf(_("Compat")); | |
1807 | - break; | |
1808 | - case IPV6_ADDR_LOOPBACK: | |
1809 | - printf(_("Host")); | |
1810 | - break; | |
1811 | - default: | |
1812 | - printf(_("Unknown")); | |
1813 | + printf(_(" %s %s prefixlen %d"), | |
1814 | + inet6_aftype.name, | |
1815 | + inet6_aftype.sprint((struct sockaddr *) &sap, 1), | |
1816 | + plen); | |
1817 | + printf(_(" scopeid 0x%x"), scope); | |
1818 | + | |
1819 | + flags[0] = '<'; flags[1] = 0; | |
1820 | + if (scope & IPV6_ADDR_COMPATv4) { | |
1821 | + strcat(flags, _("compat,")); | |
1822 | + scope -= IPV6_ADDR_COMPATv4; | |
1823 | } | |
1824 | - printf("\n"); | |
1825 | + if (scope == 0) | |
1826 | + strcat(flags, _("global,")); | |
1827 | + if (scope & IPV6_ADDR_LINKLOCAL) | |
1828 | + strcat(flags, _("link,")); | |
1829 | + if (scope & IPV6_ADDR_SITELOCAL) | |
1830 | + strcat(flags, _("site,")); | |
1831 | + if (scope & IPV6_ADDR_LOOPBACK) | |
1832 | + strcat(flags, _("host,")); | |
1833 | + if (flags[strlen(flags)-1] == ',') | |
1834 | + flags[strlen(flags)-1] = '>'; | |
1835 | + else | |
1836 | + flags[strlen(flags)-1] = 0; | |
1837 | + printf("%s\n", flags); | |
1838 | } | |
1839 | } | |
1840 | fclose(f); | |
1841 | @@ -747,17 +802,17 @@ | |
1842 | ||
1843 | if (ipxtype != NULL) { | |
1844 | if (ptr->has_ipx_bb) | |
1845 | - printf(_(" IPX/Ethernet II addr:%s\n"), | |
1846 | - ipxtype->sprint(&ptr->ipxaddr_bb, 1)); | |
1847 | + printf(_(" %s Ethernet-II %s\n"), | |
1848 | + ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_bb, 1)); | |
1849 | if (ptr->has_ipx_sn) | |
1850 | - printf(_(" IPX/Ethernet SNAP addr:%s\n"), | |
1851 | - ipxtype->sprint(&ptr->ipxaddr_sn, 1)); | |
1852 | + printf(_(" %s Ethernet-SNAP %s\n"), | |
1853 | + ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_sn, 1)); | |
1854 | if (ptr->has_ipx_e2) | |
1855 | - printf(_(" IPX/Ethernet 802.2 addr:%s\n"), | |
1856 | - ipxtype->sprint(&ptr->ipxaddr_e2, 1)); | |
1857 | + printf(_(" %s Ethernet802.2 %s\n"), | |
1858 | + ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_e2, 1)); | |
1859 | if (ptr->has_ipx_e3) | |
1860 | - printf(_(" IPX/Ethernet 802.3 addr:%s\n"), | |
1861 | - ipxtype->sprint(&ptr->ipxaddr_e3, 1)); | |
1862 | + printf(_(" %s Ethernet802.3 %s\n"), | |
1863 | + ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_e3, 1)); | |
1864 | } | |
1865 | #endif | |
1866 | ||
1867 | @@ -766,7 +821,7 @@ | |
1868 | ddptype = get_afntype(AF_APPLETALK); | |
1869 | if (ddptype != NULL) { | |
1870 | if (ptr->has_ddp) | |
1871 | - printf(_(" EtherTalk Phase 2 addr:%s\n"), ddptype->sprint(&ptr->ddpaddr, 1)); | |
1872 | + printf(_(" %s %s\n"), ddptype->name, ddptype->sprint(&ptr->ddpaddr, 1)); | |
1873 | } | |
1874 | #endif | |
1875 | ||
1876 | @@ -775,53 +830,30 @@ | |
1877 | ectype = get_afntype(AF_ECONET); | |
1878 | if (ectype != NULL) { | |
1879 | if (ptr->has_econet) | |
1880 | - printf(_(" econet addr:%s\n"), ectype->sprint(&ptr->ecaddr, 1)); | |
1881 | + printf(_(" %s %s\n"), ectype->name, ectype->sprint(&ptr->ecaddr, 1)); | |
1882 | } | |
1883 | #endif | |
1884 | ||
1885 | - printf(" "); | |
1886 | - /* DONT FORGET TO ADD THE FLAGS IN ife_print_short, too */ | |
1887 | - if (ptr->flags == 0) | |
1888 | - printf(_("[NO FLAGS] ")); | |
1889 | - if (ptr->flags & IFF_UP) | |
1890 | - printf(_("UP ")); | |
1891 | - if (ptr->flags & IFF_BROADCAST) | |
1892 | - printf(_("BROADCAST ")); | |
1893 | - if (ptr->flags & IFF_DEBUG) | |
1894 | - printf(_("DEBUG ")); | |
1895 | - if (ptr->flags & IFF_LOOPBACK) | |
1896 | - printf(_("LOOPBACK ")); | |
1897 | - if (ptr->flags & IFF_POINTOPOINT) | |
1898 | - printf(_("POINTOPOINT ")); | |
1899 | - if (ptr->flags & IFF_NOTRAILERS) | |
1900 | - printf(_("NOTRAILERS ")); | |
1901 | - if (ptr->flags & IFF_RUNNING) | |
1902 | - printf(_("RUNNING ")); | |
1903 | - if (ptr->flags & IFF_NOARP) | |
1904 | - printf(_("NOARP ")); | |
1905 | - if (ptr->flags & IFF_PROMISC) | |
1906 | - printf(_("PROMISC ")); | |
1907 | - if (ptr->flags & IFF_ALLMULTI) | |
1908 | - printf(_("ALLMULTI ")); | |
1909 | - if (ptr->flags & IFF_SLAVE) | |
1910 | - printf(_("SLAVE ")); | |
1911 | - if (ptr->flags & IFF_MASTER) | |
1912 | - printf(_("MASTER ")); | |
1913 | - if (ptr->flags & IFF_MULTICAST) | |
1914 | - printf(_("MULTICAST ")); | |
1915 | -#ifdef HAVE_DYNAMIC | |
1916 | - if (ptr->flags & IFF_DYNAMIC) | |
1917 | - printf(_("DYNAMIC ")); | |
1918 | -#endif | |
1919 | - /* DONT FORGET TO ADD THE FLAGS IN ife_print_short */ | |
1920 | - printf(_(" MTU:%d Metric:%d"), | |
1921 | - ptr->mtu, ptr->metric ? ptr->metric : 1); | |
1922 | -#ifdef SIOCSKEEPALIVE | |
1923 | - if (ptr->outfill || ptr->keepalive) | |
1924 | - printf(_(" Outfill:%d Keepalive:%d"), | |
1925 | - ptr->outfill, ptr->keepalive); | |
1926 | + /* For some hardware types (eg Ash, ATM) we don't print the | |
1927 | + hardware address if it's null. */ | |
1928 | + if (hw->print != NULL && (! (hw_null_address(hw, ptr->hwaddr) && | |
1929 | + hw->suppress_null_addr))) | |
1930 | + printf(_(" %s %s"), hw->name, hw->print(ptr->hwaddr)); | |
1931 | + else | |
1932 | + printf(_(" %s"), hw->name); | |
1933 | + if (ptr->tx_queue_len != -1) | |
1934 | + printf(_(" txqueuelen %d"), ptr->tx_queue_len); | |
1935 | + printf(" (%s)\n", hw->title); | |
1936 | + | |
1937 | +#ifdef IFF_PORTSEL | |
1938 | + if (ptr->flags & IFF_PORTSEL) { | |
1939 | + printf(_(" media %s"), if_port_text[ptr->map.port][0]); | |
1940 | + if (ptr->flags & IFF_AUTOMEDIA) | |
1941 | + printf(_("autoselect")); | |
1942 | + printf("\n"); | |
1943 | + } | |
1944 | #endif | |
1945 | - printf("\n"); | |
1946 | + | |
1947 | ||
1948 | /* If needed, display the interface statistics. */ | |
1949 | ||
1950 | @@ -830,55 +862,87 @@ | |
1951 | * not for the aliases, although strictly speaking they're shared | |
1952 | * by all addresses. | |
1953 | */ | |
1954 | - printf(" "); | |
1955 | - | |
1956 | - printf(_("RX packets:%llu errors:%lu dropped:%lu overruns:%lu frame:%lu\n"), | |
1957 | - ptr->stats.rx_packets, ptr->stats.rx_errors, | |
1958 | - ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors, | |
1959 | - ptr->stats.rx_frame_errors); | |
1960 | - if (can_compress) | |
1961 | - printf(_(" compressed:%lu\n"), ptr->stats.rx_compressed); | |
1962 | - | |
1963 | rx = ptr->stats.rx_bytes; | |
1964 | - tx = ptr->stats.tx_bytes; | |
1965 | short_rx = rx * 10; | |
1966 | + if (rx > 1125899906842624ull) { | |
1967 | + short_rx /= 1125899906842624ull; | |
1968 | + Rext = "PiB"; | |
1969 | + } else if (rx > 1099511627776ull) { | |
1970 | + short_rx /= 1099511627776ull; | |
1971 | + Rext = "TiB"; | |
1972 | + } else if (rx > 1073741824ull) { | |
1973 | + short_rx /= 1073741824ull; | |
1974 | + Rext = "GiB"; | |
1975 | + } else if (rx > 1048576) { | |
1976 | + short_rx /= 1048576; | |
1977 | + Rext = "MiB"; | |
1978 | + } else if (rx > 1024) { | |
1979 | + short_rx /= 1024; | |
1980 | + Rext = "KiB"; | |
1981 | + } | |
1982 | + tx = ptr->stats.tx_bytes; | |
1983 | short_tx = tx * 10; | |
1984 | - if (rx > 1048576) { short_rx /= 1048576; strcpy(Rext, "Mb"); } | |
1985 | - else if (rx > 1024) { short_rx /= 1024; strcpy(Rext, "Kb"); } | |
1986 | - if (tx > 1048576) { short_tx /= 1048576; strcpy(Text, "Mb"); } | |
1987 | - else if (tx > 1024) { short_tx /= 1024; strcpy(Text, "Kb"); } | |
1988 | - | |
1989 | - printf(" "); | |
1990 | - printf(_("TX packets:%llu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n"), | |
1991 | - ptr->stats.tx_packets, ptr->stats.tx_errors, | |
1992 | - ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors, | |
1993 | - ptr->stats.tx_carrier_errors); | |
1994 | - printf(_(" collisions:%lu "), ptr->stats.collisions); | |
1995 | - if (can_compress) | |
1996 | - printf(_("compressed:%lu "), ptr->stats.tx_compressed); | |
1997 | - if (ptr->tx_queue_len != -1) | |
1998 | - printf(_("txqueuelen:%d "), ptr->tx_queue_len); | |
1999 | - printf("\n "); | |
2000 | - printf(_("RX bytes:%llu (%lu.%lu %s) TX bytes:%llu (%lu.%lu %s)\n"), | |
2001 | + if (tx > 1125899906842624ull) { | |
2002 | + short_tx /= 1125899906842624ull; | |
2003 | + Text = "PiB"; | |
2004 | + } else if (tx > 1099511627776ull) { | |
2005 | + short_tx /= 1099511627776ull; | |
2006 | + Text = "TiB"; | |
2007 | + } else if (tx > 1073741824ull) { | |
2008 | + short_tx /= 1073741824ull; | |
2009 | + Text = "GiB"; | |
2010 | + } else if (tx > 1048576) { | |
2011 | + short_tx /= 1048576; | |
2012 | + Text = "MiB"; | |
2013 | + } else if (tx > 1024) { | |
2014 | + short_tx /= 1024; | |
2015 | + Text = "KiB"; | |
2016 | + } | |
2017 | + | |
2018 | + printf(" "); | |
2019 | + printf(_("RX packets %llu bytes %llu (%lu.%lu %s)\n"), | |
2020 | + ptr->stats.rx_packets, | |
2021 | rx, (unsigned long)(short_rx / 10), | |
2022 | - (unsigned long)(short_rx % 10), Rext, | |
2023 | - tx, (unsigned long)(short_tx / 10), | |
2024 | - (unsigned long)(short_tx % 10), Text); | |
2025 | + (unsigned long)(short_rx % 10), Rext); | |
2026 | + if (can_compress) { | |
2027 | + printf(" "); | |
2028 | + printf(_("RX compressed:%lu\n"), ptr->stats.rx_compressed); | |
2029 | + } | |
2030 | + printf(" "); | |
2031 | + printf(_("RX errors %lu dropped %lu overruns %lu frame %lu\n"), | |
2032 | + ptr->stats.rx_errors, ptr->stats.rx_dropped, | |
2033 | + ptr->stats.rx_fifo_errors, ptr->stats.rx_frame_errors); | |
2034 | + | |
2035 | + | |
2036 | + printf(" "); | |
2037 | + printf(_("TX packets %llu bytes %llu (%lu.%lu %s)\n"), | |
2038 | + ptr->stats.tx_packets, | |
2039 | + tx, (unsigned long)(short_tx / 10), | |
2040 | + (unsigned long)(short_tx % 10), Text); | |
2041 | + if (can_compress) { | |
2042 | + printf(" "); | |
2043 | + printf(_("TX compressed %lu\n"), ptr->stats.tx_compressed); | |
2044 | + } | |
2045 | + printf(" "); | |
2046 | + printf(_("TX errors %lu dropped %lu overruns %lu carrier %lu collisions %lu\n"), | |
2047 | + ptr->stats.tx_errors, | |
2048 | + ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors, | |
2049 | + ptr->stats.tx_carrier_errors, ptr->stats.collisions); | |
2050 | } | |
2051 | ||
2052 | if ((ptr->map.irq || ptr->map.mem_start || ptr->map.dma || | |
2053 | - ptr->map.base_addr)) { | |
2054 | - printf(" "); | |
2055 | + ptr->map.base_addr >= 0x100)) { | |
2056 | + printf(" device "); | |
2057 | if (ptr->map.irq) | |
2058 | - printf(_("Interrupt:%d "), ptr->map.irq); | |
2059 | + printf(_("interrupt %d "), ptr->map.irq); | |
2060 | if (ptr->map.base_addr >= 0x100) /* Only print devices using it for | |
2061 | I/O maps */ | |
2062 | - printf(_("Base address:0x%x "), ptr->map.base_addr); | |
2063 | + printf(_("base 0x%x "), ptr->map.base_addr); | |
2064 | if (ptr->map.mem_start) { | |
2065 | - printf(_("Memory:%lx-%lx "), ptr->map.mem_start, ptr->map.mem_end); | |
2066 | + printf(_("memory 0x%lx-%lx "), ptr->map.mem_start, ptr->map.mem_end); | |
2067 | } | |
2068 | if (ptr->map.dma) | |
2069 | - printf(_("DMA chan:%x "), ptr->map.dma); | |
2070 | + printf(_(" dma 0x%x"), ptr->map.dma); | |
2071 | printf("\n"); | |
2072 | } | |
2073 | printf("\n"); | |
2074 | --- net-tools-1.60/lib/ipx.c 1999-01-09 17:55:11.000000000 +0200 | |
2075 | +++ net-tools/lib/ipx.c 2002-07-30 08:19:29.000000000 +0300 | |
2076 | @@ -133,6 +133,9 @@ | |
2077 | char *ep; | |
2078 | int nbo; | |
2079 | ||
2080 | + if (!sai) | |
2081 | + return (-1); | |
2082 | + | |
2083 | sai->sipx_family = AF_IPX; | |
2084 | sai->sipx_network = htonl(0); | |
2085 | sai->sipx_node[0] = sai->sipx_node[1] = sai->sipx_node[2] = | |
2086 | --- net-tools-1.60/lib/ipx_gr.c 2000-10-28 12:59:42.000000000 +0200 | |
2087 | +++ net-tools/lib/ipx_gr.c 2005-08-03 01:28:10.000000000 +0300 | |
2088 | @@ -38,21 +38,27 @@ | |
2089 | char net[128], router_net[128]; | |
2090 | char router_node[128]; | |
2091 | int num; | |
2092 | - FILE *fp = fopen(_PATH_PROCNET_IPX_ROUTE, "r"); | |
2093 | + FILE *fp; | |
2094 | struct aftype *ap; | |
2095 | struct sockaddr sa; | |
2096 | ||
2097 | - if ((ap = get_afntype(AF_IPX)) == NULL) { | |
2098 | - EINTERN("lib/ipx_rt.c", "AF_IPX missing"); | |
2099 | - return (-1); | |
2100 | - } | |
2101 | + fp = fopen(_PATH_PROCNET_IPX_ROUTE1, "r"); | |
2102 | ||
2103 | if (!fp) { | |
2104 | - perror(_PATH_PROCNET_IPX_ROUTE); | |
2105 | - printf(_("IPX not configured in this system.\n")); | |
2106 | + fp = fopen(_PATH_PROCNET_IPX_ROUTE2, "r"); | |
2107 | + } | |
2108 | + | |
2109 | + if (!fp) { | |
2110 | + perror(NULL); | |
2111 | + printf(_("IPX routing not in file %s or %s found.\n"), _PATH_PROCNET_IPX_ROUTE1, _PATH_PROCNET_IPX_ROUTE2); | |
2112 | return 1; | |
2113 | } | |
2114 | ||
2115 | + if ((ap = get_afntype(AF_IPX)) == NULL) { | |
2116 | + EINTERN("lib/ipx_rt.c", "AF_IPX missing"); | |
2117 | + return (-1); | |
2118 | + } | |
2119 | + | |
2120 | printf(_("Kernel IPX routing table\n")); /* xxx */ | |
2121 | printf(_("Destination Router Net Router Node\n")); | |
2122 | ||
2123 | --- net-tools-1.60/lib/irda.c 2000-03-05 17:26:04.000000000 +0200 | |
2124 | +++ net-tools/lib/irda.c 2002-05-01 14:49:56.000000000 +0300 | |
2125 | @@ -1,13 +1,15 @@ | |
2126 | /********************************************************************* | |
2127 | * | |
2128 | * Filename: irda.c | |
2129 | - * Version: 0.1 | |
2130 | - * Description: A first attempt to make ifconfig understand IrDA | |
2131 | + * Version: 0.2 | |
2132 | + * Description: A second attempt to make ifconfig understand IrDA | |
2133 | * Status: Experimental. | |
2134 | * Author: Dag Brattli <dagb@cs.uit.no> | |
2135 | * Created at: Wed Apr 21 09:03:09 1999 | |
2136 | * Modified at: Wed Apr 21 09:17:05 1999 | |
2137 | * Modified by: Dag Brattli <dagb@cs.uit.no> | |
2138 | + * Modified at: Wed May 1 11:51:44 CEST 2002 | |
2139 | + * Modified by: Christoph Bartelmus <christoph@bartelmus.de> | |
2140 | * | |
2141 | * This program is free software; you can redistribute it and/or | |
2142 | * modify it under the terms of the GNU General Public License as | |
2143 | @@ -59,9 +61,9 @@ | |
2144 | */ | |
2145 | static char *irda_print(unsigned char *ptr) | |
2146 | { | |
2147 | - static char buff[8]; | |
2148 | + static char buff[12]; | |
2149 | ||
2150 | - sprintf(&buff[strlen(buff)], "%02x:%02x:%02x:%02x", ptr[3], ptr[2], | |
2151 | + snprintf(buff, 12, "%02x:%02x:%02x:%02x", ptr[3], ptr[2], | |
2152 | ptr[1], ptr[0]); | |
2153 | ||
2154 | return (buff); | |
2155 | --- net-tools-1.60/lib/Makefile 2000-10-28 12:59:42.000000000 +0200 | |
2156 | +++ net-tools/lib/Makefile 2001-11-12 04:12:05.000000000 +0200 | |
2157 | @@ -16,7 +16,7 @@ | |
2158 | # | |
2159 | ||
2160 | ||
2161 | -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 | |
2162 | +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 eui64.o | |
2163 | 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 | |
2164 | 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 | |
2165 | AFSROBJS = inet_sr.o inet6_sr.o netrom_sr.o ipx_sr.o setroute.o x25_sr.o | |
2166 | --- net-tools-1.60/lib/net-features.h 2000-05-20 20:27:25.000000000 +0200 | |
2167 | +++ net-tools/lib/net-features.h 2001-11-12 04:12:05.000000000 +0200 | |
2168 | @@ -295,6 +295,13 @@ | |
2169 | "-" | |
2170 | #endif | |
2171 | "HDLC/LAPB " | |
2172 | + | |
2173 | +#if HAVE_HWEUI64 | |
2174 | +"+" | |
2175 | +#else | |
2176 | +"-" | |
2177 | +#endif | |
2178 | +"EUI64 " | |
2179 | ; | |
2180 | ||
2181 | ||
2182 | --- net-tools-1.60/lib/nstrcmp.c 1999-01-09 17:55:20.000000000 +0200 | |
2183 | +++ net-tools/lib/nstrcmp.c 2004-06-04 01:49:17.000000000 +0300 | |
2184 | @@ -1,34 +1,157 @@ | |
2185 | /* Copyright 1998 by Andi Kleen. Subject to the GPL. */ | |
2186 | -/* $Id$ */ | |
2187 | +/* rewritten by bernd eckenfels because of complicated alias semantic */ | |
2188 | +/* $Id$ */ | |
2189 | #include <ctype.h> | |
2190 | #include <stdlib.h> | |
2191 | +#include <string.h> | |
2192 | #include "util.h" | |
2193 | ||
2194 | -/* like strcmp(), but knows about numbers */ | |
2195 | -int nstrcmp(const char *astr, const char *b) | |
2196 | + | |
2197 | +/* return numerical :999 suffix or null. sideeffect: replace ':' with \0 */ | |
2198 | +char* cutalias(char* name) | |
2199 | { | |
2200 | - const char *a = astr; | |
2201 | + int digit = 0; | |
2202 | + int pos; | |
2203 | + | |
2204 | + for(pos=strlen(name); pos>0; pos--) | |
2205 | + { | |
2206 | + if (name[pos-1]==':' && digit) | |
2207 | + { | |
2208 | + name[pos-1]='\0'; | |
2209 | + return name+pos; | |
2210 | + } | |
2211 | + if (!isdigit(name[pos-1])) | |
2212 | + break; | |
2213 | + digit = 1; | |
2214 | + } | |
2215 | + return NULL; | |
2216 | +} | |
2217 | ||
2218 | - while (*a == *b) { | |
2219 | - if (*a == '\0') | |
2220 | - return 0; | |
2221 | - a++; | |
2222 | - b++; | |
2223 | - } | |
2224 | - if (isdigit(*a)) { | |
2225 | - if (!isdigit(*b)) | |
2226 | - return -1; | |
2227 | - while (a > astr) { | |
2228 | - a--; | |
2229 | - if (!isdigit(*a)) { | |
2230 | - a++; | |
2231 | - break; | |
2232 | - } | |
2233 | - if (!isdigit(*b)) | |
2234 | - return -1; | |
2235 | - b--; | |
2236 | + | |
2237 | +/* return index of last non digit or -1 if it does not end with digits */ | |
2238 | +int rindex_nondigit(char *name) | |
2239 | +{ | |
2240 | + int pos = strlen(name); | |
2241 | + | |
2242 | + for(pos=strlen(name); pos>0; pos--) | |
2243 | + { | |
2244 | + if (!isdigit(name[pos-1])) | |
2245 | + return pos; | |
2246 | } | |
2247 | - return atoi(a) > atoi(b) ? 1 : -1; | |
2248 | - } | |
2249 | - return *a - *b; | |
2250 | + return 0; | |
2251 | +} | |
2252 | + | |
2253 | + | |
2254 | +/* like strcmp(), but knows about numbers and ':' alias suffix */ | |
2255 | +int nstrcmp(const char *ap, const char *bp) | |
2256 | +{ | |
2257 | + char *a = (char*)strdup(ap); | |
2258 | + char *b = (char*)strdup(bp); | |
2259 | + char *an, *bn; | |
2260 | + int av = 0, bv = 0; | |
2261 | + char *aalias=cutalias(a); | |
2262 | + char *balias=cutalias(b); | |
2263 | + int aindex=rindex_nondigit(a); | |
2264 | + int bindex=rindex_nondigit(b); | |
2265 | + int complen=(aindex<bindex)?aindex:bindex; | |
2266 | + int res = strncmp(a, b, complen); | |
2267 | + | |
2268 | + if (res != 0) | |
2269 | + { free(a); free(b); return res; } | |
2270 | + | |
2271 | + if (aindex > bindex) | |
2272 | + { free(a); free(b); return 1; } | |
2273 | + | |
2274 | + if (aindex < bindex) | |
2275 | + { free(a); free(b); return -1; } | |
2276 | + | |
2277 | + an = a+aindex; | |
2278 | + bn = b+bindex; | |
2279 | + | |
2280 | + av = atoi(an); | |
2281 | + bv = atoi(bn); | |
2282 | + | |
2283 | + if (av < bv) | |
2284 | + { free(a); free(b); return -1; } | |
2285 | + | |
2286 | + if (av > bv) | |
2287 | + { free(a); free(b); return 1; } | |
2288 | + | |
2289 | + av = -1; | |
2290 | + if (aalias != NULL) | |
2291 | + av = atoi(aalias); | |
2292 | + | |
2293 | + bv = -1; | |
2294 | + if (balias != NULL) | |
2295 | + bv = atoi(balias); | |
2296 | + | |
2297 | + free(a); free(b); | |
2298 | + | |
2299 | + if (av < bv) | |
2300 | + return -1; | |
2301 | + | |
2302 | + if (av > bv) | |
2303 | + return 1; | |
2304 | + | |
2305 | + return 0; | |
2306 | +} | |
2307 | + | |
2308 | + | |
2309 | +#ifdef NSTRCMP_TEST | |
2310 | + | |
2311 | +int cs(int s) | |
2312 | +{ | |
2313 | + if (s < 0) return -1; | |
2314 | + if (s > 0) return 1; | |
2315 | + return 0; | |
2316 | +} | |
2317 | + | |
2318 | + | |
2319 | +int dotest(char* a, char* b, int exp) | |
2320 | +{ | |
2321 | + int res = nstrcmp(a, b); | |
2322 | + int err = (cs(res) != cs(exp)); | |
2323 | + printf("nstrcmp(\"%s\", \"%s\")=%d %d %s\n", a, b, res, exp, err?"WRONG":"OK"); | |
2324 | + return err; | |
2325 | } | |
2326 | + | |
2327 | +int main() | |
2328 | +{ | |
2329 | + int err = 0; | |
2330 | + | |
2331 | + err |= dotest("eth1", "eth1", 0); | |
2332 | + err |= dotest("eth0:1", "eth0:1", 0); | |
2333 | + err |= dotest("lan", "lan", 0); | |
2334 | + err |= dotest("100", "100", 0); | |
2335 | + err |= dotest("", "", 0); | |
2336 | + err |= dotest(":", ":", 0); | |
2337 | + err |= dotest("a:b:c", "a:b:c", 0); | |
2338 | + err |= dotest("a:", "a:", 0); | |
2339 | + err |= dotest(":a", ":a", 0); | |
2340 | + | |
2341 | + err |= dotest("a", "aa", -1); | |
2342 | + err |= dotest("eth0", "eth1", -1); | |
2343 | + err |= dotest("eth1", "eth20", -1); | |
2344 | + err |= dotest("eth20", "eth100", -1); | |
2345 | + err |= dotest("eth1", "eth13", -1); | |
2346 | + err |= dotest("eth", "eth2", -1); | |
2347 | + err |= dotest("eth0:1", "eth0:2", -1); | |
2348 | + err |= dotest("eth1:10", "eth13:10", -1); | |
2349 | + err |= dotest("eth1:1", "eth1:13", -1); | |
2350 | + err |= dotest("a", "a:", -1); | |
2351 | + | |
2352 | + err |= dotest("aa", "a", 1); | |
2353 | + err |= dotest("eth2", "eth1", 1); | |
2354 | + err |= dotest("eth13", "eth1", 1); | |
2355 | + err |= dotest("eth2", "eth", 1); | |
2356 | + err |= dotest("eth2:10", "eth2:1", 1); | |
2357 | + err |= dotest("eth2:5", "eth2:4", 1); | |
2358 | + err |= dotest("eth3:2", "eth2:3", 1); | |
2359 | + err |= dotest("eth13:1", "eth1:0", 1); | |
2360 | + err |= dotest("a:", "a", 1); | |
2361 | + err |= dotest("a1b12", "a1b2", 1); | |
2362 | + | |
2363 | + return err; | |
2364 | +} | |
2365 | + | |
2366 | +#endif | |
2367 | --- net-tools-1.60/lib/pathnames.h 2000-05-20 20:27:26.000000000 +0200 | |
2368 | +++ net-tools/lib/pathnames.h 2005-08-03 01:28:10.000000000 +0300 | |
2369 | @@ -1,4 +1,3 @@ | |
2370 | - | |
2371 | /* | |
2372 | * lib/pathnames.h This file contains the definitions of the path | |
2373 | * names used by the NET-LIB. | |
2374 | @@ -29,8 +28,10 @@ | |
2375 | #define _PATH_PROCNET_NR_NODES "/proc/net/nr_nodes" | |
2376 | #define _PATH_PROCNET_ARP "/proc/net/arp" | |
2377 | #define _PATH_PROCNET_AX25 "/proc/net/ax25" | |
2378 | -#define _PATH_PROCNET_IPX "/proc/net/ipx" | |
2379 | -#define _PATH_PROCNET_IPX_ROUTE "/proc/net/ipx_route" | |
2380 | +#define _PATH_PROCNET_IPX_SOCKET1 "/proc/net/ipx/socket" | |
2381 | +#define _PATH_PROCNET_IPX_SOCKET2 "/proc/net/ipx" | |
2382 | +#define _PATH_PROCNET_IPX_ROUTE1 "/proc/net/ipx/route" | |
2383 | +#define _PATH_PROCNET_IPX_ROUTE2 "/proc/net/ipx_route" | |
2384 | #define _PATH_PROCNET_ATALK "/proc/net/appletalk" | |
2385 | #define _PATH_PROCNET_IP_BLK "/proc/net/ip_block" | |
2386 | #define _PATH_PROCNET_IP_FWD "/proc/net/ip_forward" | |
2387 | @@ -45,6 +46,7 @@ | |
2388 | #define _PATH_PROCNET_X25 "/proc/net/x25" | |
2389 | #define _PATH_PROCNET_X25_ROUTE "/proc/net/x25_routes" | |
2390 | #define _PATH_PROCNET_DEV_MCAST "/proc/net/dev_mcast" | |
2391 | +#define _PATH_PROCNET_ATALK_ROUTE "/proc/net/atalk_route" | |
2392 | ||
2393 | /* pathname for the netlink device */ | |
2394 | #define _PATH_DEV_ROUTE "/dev/route" | |
2395 | --- net-tools-1.60/lib/tr.c 2000-02-20 23:46:45.000000000 +0200 | |
2396 | +++ net-tools/lib/tr.c 2005-05-16 06:15:12.000000000 +0300 | |
2397 | @@ -2,7 +2,7 @@ | |
2398 | * lib/tr.c This file contains an implementation of the "Tokenring" | |
2399 | * support functions. | |
2400 | * | |
2401 | - * Version: $Id$ | |
2402 | + * Version: $Id$ | |
2403 | * | |
2404 | * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> | |
2405 | * Copyright 1993 MicroWalt Corporation | |
2406 | @@ -30,8 +30,14 @@ | |
2407 | #include "net-support.h" | |
2408 | #include "pathnames.h" | |
2409 | #include "intl.h" | |
2410 | +#include "util.h" | |
2411 | ||
2412 | + | |
2413 | +/* actual definition at the end of file */ | |
2414 | extern struct hwtype tr_hwtype; | |
2415 | +#ifdef ARPHRD_IEEE802_TR | |
2416 | +extern struct hwtype tr_hwtype1; | |
2417 | +#endif | |
2418 | ||
2419 | static char *pr_tr(unsigned char *ptr) | |
2420 | { | |
2421 | @@ -42,7 +48,7 @@ | |
2422 | (ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377) | |
2423 | ); | |
2424 | return (buff); | |
2425 | -} | |
2426 | + } | |
2427 | ||
2428 | ||
2429 | static int in_tr(char *bufp, struct sockaddr *sap) | |
2430 | @@ -51,7 +57,17 @@ | |
2431 | char c, *orig; | |
2432 | int i, val; | |
2433 | ||
2434 | +#ifdef ARPHRD_IEEE802_TR | |
2435 | + if (kernel_version() < KRELEASE(2,3,30)) { | |
2436 | + sap->sa_family = tr_hwtype.type; | |
2437 | + } else { | |
2438 | + sap->sa_family = tr_hwtype1.type; | |
2439 | + } | |
2440 | +#else | |
2441 | sap->sa_family = tr_hwtype.type; | |
2442 | + #warning "Limited functionality, no support for ARPHRD_IEEE802_TR (old kernel headers?)" | |
2443 | +#endif | |
2444 | + | |
2445 | ptr = sap->sa_data; | |
2446 | ||
2447 | i = 0; | |
2448 | --- net-tools-1.60/lib/util-ank.c 1999-04-21 20:39:47.000000000 +0300 | |
2449 | +++ net-tools/lib/util-ank.c 2006-10-11 04:14:33.000000000 +0300 | |
2450 | @@ -293,7 +293,7 @@ | |
2451 | return 0; | |
2452 | } | |
2453 | ||
2454 | -const char *format_host(int af, void *addr, __u8 *abuf, int alen) | |
2455 | +const char *format_host(int af, void *addr, char *abuf, int alen) | |
2456 | { | |
2457 | #ifdef RESOLVE_HOSTNAMES | |
2458 | if (resolve_hosts) { | |
2459 | --- net-tools-1.60/lib/util.h 1999-01-09 17:55:29.000000000 +0200 | |
2460 | +++ net-tools/lib/util.h 2004-06-04 01:27:37.000000000 +0300 | |
2461 | @@ -14,3 +14,6 @@ | |
2462 | ||
2463 | char *safe_strncpy(char *dst, const char *src, size_t size); | |
2464 | ||
2465 | + | |
2466 | +#define netmin(a,b) ((a)<(b) ? (a) : (b)) | |
2467 | +#define netmax(a,b) ((a)>(b) ? (a) : (b)) | |
2468 | --- net-tools-1.60/lib/x25_sr.c 2000-05-20 15:38:10.000000000 +0200 | |
2469 | +++ net-tools/lib/x25_sr.c 2005-09-04 07:23:13.000000000 +0300 | |
2470 | @@ -67,7 +67,7 @@ | |
2471 | strcpy(target, *args++); | |
2472 | ||
2473 | /* Clean out the x25_route_struct structure. */ | |
2474 | - memset((char *) &rt, 0, sizeof(struct x25_route_struct)); | |
2475 | + memset((char *) &rt, 0, sizeof(rt)); | |
2476 | ||
2477 | ||
2478 | if ((sigdigits = x25_aftype.input(0, target, (struct sockaddr *)&sx25)) < 0) { | |
2479 | @@ -76,8 +76,8 @@ | |
2480 | } | |
2481 | rt.sigdigits=sigdigits; | |
2482 | ||
2483 | - /* x25_route_struct.address isn't type struct sockaddr_x25, Why? */ | |
2484 | - memcpy(&rt.address, &sx25.sx25_addr, sizeof(x25_address)); | |
2485 | + /* this works with 2.4 and 2.6 headers struct x25_address vs. typedef */ | |
2486 | + memcpy(&rt.address, &sx25.sx25_addr, sizeof(sx25.sx25_addr)); | |
2487 | ||
2488 | while (*args) { | |
2489 | if (!strcmp(*args,"device") || !strcmp(*args,"dev")) { | |
2490 | --- net-tools-1.60/man/de_DE/netstat.8 1999-03-15 22:31:20.000000000 +0200 | |
2491 | +++ net-tools/man/de_DE/netstat.8 2002-02-20 16:31:00.000000000 +0200 | |
2492 | @@ -9,7 +9,7 @@ | |
2493 | .\" Modified: Tuan Hoang tuan@optimus.mitre.org | |
2494 | .\" | |
2495 | .\" | |
2496 | -.TH NETSTAT 8 "6. M\(:arz 1999" "net-tools" "Handbuch f\(:ur Linuxprogrammierer" | |
2497 | +.TH NETSTAT 8 "2002-02-20" "net-tools" "Handbuch f\(:ur Linuxprogrammierer" | |
2498 | ||
2499 | .SH NAME | |
2500 | netstat \- Anzeige von Netzwerksverbindungen, Routentabellen, Schnittstellenstatistiken, maskierten Verbindungen, Netlink-Nachrichten und Mitgliedschaft in Multicastgruppen | |
2501 | @@ -44,7 +44,6 @@ | |
2502 | .B netstat | |
2503 | .RB [ \-veenpac ] | |
2504 | .RB { \-\-interfaces | \-i } | |
2505 | -.RI [ Schnittstelle ] | |
2506 | ||
2507 | .PP | |
2508 | ||
2509 | @@ -68,6 +67,8 @@ | |
2510 | .SH BESCHREIBUNG | |
2511 | .B Netstat | |
2512 | zeigt Informationen des Linux Netzwerkssystems an. | |
2513 | +.PP | |
2514 | +.B Bitte beachten Sie, dass der Inhalt der deutschen man-page nicht vollst\(:andig ist, im Moment. | |
2515 | ||
2516 | .SS "(no option)" | |
2517 | Ohne Optionen zeigt | |
2518 | @@ -103,18 +104,17 @@ | |
2519 | Wegen Details siehe | |
2520 | .BR route (8). | |
2521 | ||
2522 | -.SS "\-i, \-\-interface \fISchnittstelle\fI" | |
2523 | +.SS "\-i, \-\-interface" | |
2524 | Wird die | |
2525 | .BR -i ", " --interfaces | |
2526 | -Option verwendet, so wird eine Tabelle aller (oder der angegebenen | |
2527 | -.IR Schnittstellen ) | |
2528 | +Option verwendet, so wird eine Tabelle aller Schnittstellen | |
2529 | ausgedruckt. Die Ausgabe ist im Format von | |
2530 | .B "ifconfig -e" | |
2531 | und wird in | |
2532 | .BR ifconfig (8) | |
2533 | beschrieben. | |
2534 | .B "netstat -ei" | |
2535 | -druckt eine Tabelle oder einen Eintrag f\(:ur einen einzelnes Interface wie | |
2536 | +druckt eine Tabelle f\(:ur Interfaces wie | |
2537 | .BR ifconfig . | |
2538 | Die | |
2539 | .B -a | |
2540 | @@ -182,7 +182,7 @@ | |
2541 | und | |
2542 | .BR \-\-ddp. | |
2543 | ||
2544 | -.SS "\-c, \-\-continous" | |
2545 | +.SS "\-c, \-\-continuous" | |
2546 | Mit dieser Option wiederholt | |
2547 | .B netstat | |
2548 | im Sekundenabstand die Ausgabe, bis es abgebrochen wird. | |
2549 | --- net-tools-1.60/man/en_US/arp.8 2000-10-28 12:59:42.000000000 +0200 | |
2550 | +++ net-tools/man/en_US/arp.8 2005-05-16 07:30:18.000000000 +0300 | |
2551 | @@ -1,4 +1,4 @@ | |
2552 | -.TH ARP 8 "5 Jan 1999" "net-tools" "Linux Programmer's Manual" | |
2553 | +.TH ARP 8 "2005-05-16" "net-tools" "Linux Programmer's Manual" | |
2554 | .SH NAME | |
2555 | arp \- manipulate the system ARP cache | |
2556 | .SH SYNOPSIS | |
2557 | @@ -132,7 +132,10 @@ | |
2558 | entire subnet. Linux instead does automagic proxy arp when a route | |
2559 | exists and it is forwarding. See | |
2560 | .BR arp (7) | |
2561 | -for details. | |
2562 | +for details. Also the | |
2563 | +.B dontpub | |
2564 | +option which is available for delete and set operations cannot be | |
2565 | +used with 2.4 and newer kernels. | |
2566 | .TP | |
2567 | .B "\-f filename, \-\-file filename" | |
2568 | Similar to the | |
2569 | --- net-tools-1.60/man/en_US/ethers.5 1999-01-09 17:55:31.000000000 +0200 | |
2570 | +++ net-tools/man/en_US/ethers.5 2005-05-14 01:34:20.000000000 +0300 | |
2571 | @@ -1,4 +1,4 @@ | |
2572 | -.TH ETHERS 5 "April 26th, 1996" "" "File formats" | |
2573 | +.TH ETHERS 5 "May 15th, 2005" "" "File formats" | |
2574 | .SH NAME \"{{{roff}}}\"{{{ | |
2575 | ethers \- Ethernet address to IP number database | |
2576 | .\"}}} | |
2577 | @@ -10,8 +10,8 @@ | |
2578 | \fIEthernet-address\fP \fIIP-number\fP | |
2579 | .RE | |
2580 | .sp | |
2581 | -The two items are separated by any number of SPACE and/or TAB char | |
2582 | -acters. A \fB#\fP at the beginning of a line starts a comment | |
2583 | +The two items are separated by any number of SPACE and/or TAB characters. | |
2584 | +A \fB#\fP at the beginning of a line starts a comment | |
2585 | which extends to the end of the line. The \fIEthernet-address\fP is | |
2586 | written as | |
2587 | .IR x : x : x : x : x : x , | |
2588 | --- net-tools-1.60/man/en_US/ifconfig.8 2000-10-28 12:59:42.000000000 +0200 | |
2589 | +++ net-tools/man/en_US/ifconfig.8 2005-06-30 22:26:37.000000000 +0300 | |
2590 | @@ -1,10 +1,10 @@ | |
2591 | -.TH IFCONFIG 8 "14 August 2000" "net-tools" "Linux Programmer's Manual" | |
2592 | +.TH IFCONFIG 8 "2005-06-30" "net-tools" "Linux Programmer's Manual" | |
2593 | .SH NAME | |
2594 | ifconfig \- configure a network interface | |
2595 | .SH SYNOPSIS | |
2596 | -.B "ifconfig [interface]" | |
2597 | +.B "ifconfig [-v] [-a] [-s] [interface]" | |
2598 | .br | |
2599 | -.B "ifconfig interface [aftype] options | address ..." | |
2600 | +.B "ifconfig [-v] interface [aftype] options | address ..." | |
2601 | .SH DESCRIPTION | |
2602 | .B Ifconfig | |
2603 | is used to configure the kernel-resident network interfaces. It is | |
2604 | @@ -41,11 +41,27 @@ | |
2605 | (AMPR Packet radio). | |
2606 | .SH OPTIONS | |
2607 | .TP | |
2608 | +.B -a | |
2609 | +display all interfaces which are currently available, even if down | |
2610 | +.TP | |
2611 | +.B -s | |
2612 | +display a short list (like netstat -i) | |
2613 | +.TP | |
2614 | +.B -v | |
2615 | +be more verbose for some error conditions | |
2616 | +.TP | |
2617 | .B interface | |
2618 | The name of the interface. This is usually a driver name followed by | |
2619 | a unit number, for example | |
2620 | .B eth0 | |
2621 | -for the first Ethernet interface. | |
2622 | +for the first Ethernet interface. If your kernel supports alias interfaces, | |
2623 | +you can specify them with | |
2624 | +.B eth0:0 | |
2625 | +for the first alias of eth0. You can use them to assign a second address. To | |
2626 | +delete an alias interface use | |
2627 | +.B ifconfig eth0:0 down | |
2628 | +. Note: for every scope (i.e. same net with address/netmask combination) all | |
2629 | +aliases are deleted, if you delete the first (primary). | |
2630 | .TP | |
2631 | .B up | |
2632 | This flag causes the interface to be activated. It is implicitly | |
2633 | @@ -173,11 +189,20 @@ | |
2634 | are shared with all alias addresses on the same device. If you want per-address | |
2635 | statistics you should add explicit accounting | |
2636 | rules for the address using the | |
2637 | -.BR ipchains(8) | |
2638 | +.BR ipchains (8) | |
2639 | +or | |
2640 | +.BR iptables (8) | |
2641 | command. | |
2642 | .LP | |
2643 | -Interrupt problems with Ethernet device drivers fail with EAGAIN. See | |
2644 | -.I http://cesdis.gsfc.nasa.gov/linux/misc/irq-conflict.html | |
2645 | +Since net-tools 1.61 ifconfig is printing byte counters and human readable | |
2646 | +counters with IEC 60027-2 units. So 1 KiB are 2^10 byte. Note, the numbers | |
2647 | +are truncated to one decimal (which can by quite a large error if you | |
2648 | +consider 0.1 PiB is 112.589.990.684.262 bytes :) | |
2649 | +.LP | |
2650 | +Interrupt problems with Ethernet device drivers fail with EAGAIN | |
2651 | +.I (SIOCSIIFLAGS: Resource temporarily unavailable) | |
2652 | +it is most likely a interrupt conflict. See | |
2653 | +.I http://www.scyld.com/expert/irq-conflict.html | |
2654 | for more information. | |
2655 | .SH FILES | |
2656 | .I /proc/net/socket | |
2657 | @@ -189,7 +214,9 @@ | |
2658 | While appletalk DDP and IPX addresses will be displayed they cannot be | |
2659 | altered by this command. | |
2660 | .SH SEE ALSO | |
2661 | -route(8), netstat(8), arp(8), rarp(8), ipchains(8) | |
2662 | +route(8), netstat(8), arp(8), rarp(8), ipchains(8), iptables(8) | |
2663 | +.br | |
2664 | +http://physics.nist.gov/cuu/Units/binary.html - Prefixes for binary multiples | |
2665 | .SH AUTHORS | |
2666 | Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> | |
2667 | .br | |
2668 | @@ -198,3 +225,5 @@ | |
2669 | Phil Blundell, <Philip.Blundell@pobox.com> | |
2670 | .br | |
2671 | Andi Kleen | |
2672 | +.br | |
2673 | +Bernd Eckenfels, <net-tools@lina.inka.de> | |
2674 | --- net-tools-1.60/man/en_US/mii-tool.8 2000-05-21 16:21:38.000000000 +0200 | |
2675 | +++ net-tools/man/en_US/mii-tool.8 2005-05-14 01:31:41.000000000 +0300 | |
2676 | @@ -1,7 +1,7 @@ | |
2677 | .\" Copyright (C) 2000 David A. Hinds -- dhinds@pcmcia.sourceforge.org | |
2678 | .\" mii-tool.8 1.5 2000/04/25 22:58:19 | |
2679 | .\" | |
2680 | -.TH MII-TOOL 8 "2000/04/25 22:58:19" "net-tools" | |
2681 | +.TH MII-TOOL 8 "2004/03/28 23:30:00" "net-tools" | |
2682 | ||
2683 | .SH NAME | |
2684 | mii-tool \- view, manipulate media-independent interface status | |
2685 | @@ -72,7 +72,24 @@ | |
2686 | commas. Valid media are \fB100baseT4\fR, \fB100baseTx-FD\fR, | |
2687 | \fB100baseTx-HD\fR, \fB10baseT-FD\fR, and \fB10baseT-HD\fR. | |
2688 | ||
2689 | +.SH DIAGNOSTICS | |
2690 | +.TP | |
2691 | +SIOCGMIIPHY on 'eth?' failed: Invalid argument | |
2692 | +If the interface is not running (up), kernel will refuse to report its link state. | |
2693 | +.TP | |
2694 | +SIOCGMIIPHY on 'eth?' failed: Operation not permitted | |
2695 | +Most kernels restrict access to root. | |
2696 | +.TP | |
2697 | +SIOCGMIIPHY on 'eth?' failed: No such device | |
2698 | +This error is shown, if the kernel does not know about the named device. | |
2699 | +.TP | |
2700 | +SIOCGMIIPHY on 'eth?' failed: Operation not supported | |
2701 | +The interface in question does not support MII queries. Most likely, it does not have | |
2702 | +MII transceivers, at all. | |
2703 | + | |
2704 | .SH AUTHORS | |
2705 | David Hinds \- dhinds@pcmcia.sourceforge.org | |
2706 | .br | |
2707 | Donald Becker \- becker@scyld.com | |
2708 | +.br | |
2709 | +Bernd Eckenfels \- ecki@debian.org | |
2710 | --- net-tools-1.60/man/en_US/netstat.8 2001-01-07 14:43:57.000000000 +0200 | |
2711 | +++ net-tools/man/en_US/netstat.8 2004-06-29 23:28:08.000000000 +0300 | |
2712 | @@ -8,7 +8,7 @@ | |
2713 | .\" Modified: Tuan Hoang tqhoang@bigfoot.com | |
2714 | .\" | |
2715 | .\" | |
2716 | -.TH NETSTAT 8 "19 December 2000" "net-tools" "Linux Programmer's Manual" | |
2717 | +.TH NETSTAT 8 "02 October 2003" "net-tools" "Linux Programmer's Manual" | |
2718 | ||
2719 | .SH NAME | |
2720 | netstat \- Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships | |
2721 | @@ -23,7 +23,7 @@ | |
2722 | .RB [ \-\-listening | \-l ] | |
2723 | .RB [ \-\-all | \-a ] | |
2724 | .RB [ \-\-numeric | \-n ] | |
2725 | -.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ] | |
2726 | +.RB [ \-\-numeric-hosts "] [" \-\-numeric-ports "] [" \-\-numeric-users ] | |
2727 | .RB [ \-\-symbolic | \-N ] | |
2728 | .RB [ \-\-extend | \-e [ \-\-extend | \-e] ] | |
2729 | .RB [ \-\-timers | \-o ] | |
2730 | @@ -37,31 +37,30 @@ | |
2731 | .RB [ \-\-extend | \-e [ \-\-extend | \-e] ] | |
2732 | .RB [ \-\-verbose | \-v ] | |
2733 | .RB [ \-\-numeric | \-n ] | |
2734 | -.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ] | |
2735 | +.RB [ \-\-numeric-hosts "] [" \-\-numeric-ports "] [" \-\-numeric-users ] | |
2736 | .RB [ \-\-continuous | \-c] | |
2737 | .P | |
2738 | .B netstat | |
2739 | .RB { \-\-interfaces | \-i } | |
2740 | -.RI [ iface ] | |
2741 | .RB [ \-\-all | \-a ] | |
2742 | .RB [ \-\-extend | \-e [ \-\-extend | \-e] ] | |
2743 | .RB [ \-\-verbose | \-v ] | |
2744 | .RB [ \-\-program | \-p ] | |
2745 | .RB [ \-\-numeric | \-n ] | |
2746 | -.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ] | |
2747 | +.RB [ \-\-numeric-hosts "] [" \-\-numeric-ports "] [" \-\-numeric-users ] | |
2748 | .RB [ \-\-continuous | \-c] | |
2749 | .P | |
2750 | .B netstat | |
2751 | .RB { \-\-groups | \-g } | |
2752 | .RB [ \-\-numeric | \-n ] | |
2753 | -.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ] | |
2754 | +.RB [ \-\-numeric-hosts "] [" \-\-numeric-ports "] [" \-\-numeric-users ] | |
2755 | .RB [ \-\-continuous | \-c] | |
2756 | .P | |
2757 | .B netstat | |
2758 | .RB { \-\-masquerade | \-M } | |
2759 | .RB [ \-\-extend | \-e ] | |
2760 | .RB [ \-\-numeric | \-n ] | |
2761 | -.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ] | |
2762 | +.RB [ \-\-numeric-hosts "] [" \-\-numeric-ports "] [" \-\-numeric-users ] | |
2763 | .RB [ \-\-continuous | \-c] | |
2764 | .P | |
2765 | .B netstat | |
2766 | @@ -78,6 +77,8 @@ | |
2767 | .P | |
2768 | .IR address_family_options : | |
2769 | .PP | |
2770 | +.RB [ -4 ] | |
2771 | +.RB [ -6 ] | |
2772 | .RB [ \-\-protocol= { inet , unix , ipx , ax25 , netrom , ddp }[, ...] ] | |
2773 | .RB [ \-\-unix | \-x ] | |
2774 | .RB [ \-\-inet | \-\-ip ] | |
2775 | @@ -98,12 +99,17 @@ | |
2776 | address families, then the active sockets of all configured address | |
2777 | families will be printed. | |
2778 | .SS "\-\-route , \-r" | |
2779 | -Display the kernel routing tables. | |
2780 | +Display the kernel routing tables. See the description in | |
2781 | +.BR route (8) | |
2782 | +for details. | |
2783 | +.B netstat -r | |
2784 | +and | |
2785 | +.B route -e | |
2786 | +produce the same output. | |
2787 | .SS "\-\-groups , \-g" | |
2788 | Display multicast group membership information for IPv4 and IPv6. | |
2789 | -.SS "\-\-interface=\fIiface \fR, \fB\-i" | |
2790 | -Display a table of all network interfaces, or the specified | |
2791 | -.IR iface ) . | |
2792 | +.SS "\-\-interface, \-i" | |
2793 | +Display a table of all network interfaces. | |
2794 | .SS "\-\-masquerade , \-M" | |
2795 | Display a list of masqueraded connections. | |
2796 | .SS "\-\-statistics , \-s" | |
2797 | @@ -165,12 +171,11 @@ | |
2798 | .SS "\-a, \-\-all" | |
2799 | Show both listening and non-listening sockets. With the | |
2800 | .B --interfaces | |
2801 | -option, show interfaces that are not marked | |
2802 | +option, show interfaces that are not up | |
2803 | .SS "\-F" | |
2804 | Print routing information from the FIB. (This is the default.) | |
2805 | .SS "\-C" | |
2806 | Print routing information from the route cache. | |
2807 | -.IR UP . | |
2808 | .P | |
2809 | .SH OUTPUT | |
2810 | .P | |
2811 | @@ -221,7 +226,7 @@ | |
2812 | The socket is waiting after close to handle packets still in the network. | |
2813 | .TP | |
2814 | .I | |
2815 | -CLOSED | |
2816 | +CLOSE | |
2817 | The socket is not being used. | |
2818 | .TP | |
2819 | .I | |
2820 | @@ -438,7 +443,7 @@ | |
2821 | .P | |
2822 | .SH AUTHORS | |
2823 | The netstat user interface was written by Fred Baumgarten | |
2824 | -<dc6iq@insu1.etec.uni-karlsruhe.de> the man page basically | |
2825 | +<dc6iq@insu1.etec.uni-karlsruhe.de>, the man page basically | |
2826 | by Matt Welsh <mdw@tc.cornell.edu>. It was updated by | |
2827 | Alan Cox <Alan.Cox@linux.org> but could do with a bit more | |
2828 | work. It was updated again by Tuan Hoang | |
2829 | --- net-tools-1.60/man/en_US/rarp.8 2000-05-21 15:54:00.000000000 +0200 | |
2830 | +++ net-tools/man/en_US/rarp.8 2001-11-05 15:12:11.000000000 +0200 | |
2831 | @@ -61,8 +61,8 @@ | |
2832 | Create a RARP address mapping entry for host | |
2833 | .B hostname | |
2834 | with hardware address set to | |
2835 | -.B hw_addr | |
2836 | -. The format of the hardware address is dependent on the hardware | |
2837 | +.BR hw_addr . | |
2838 | +The format of the hardware address is dependent on the hardware | |
2839 | class, but for most classes one can assume that the usual presentation | |
2840 | can be used. For the Ethernet class, this is 6 bytes in hexadecimal, | |
2841 | separated by colons. | |
2842 | --- net-tools-1.60/man/en_US/route.8 2000-05-21 20:59:03.000000000 +0200 | |
2843 | +++ net-tools/man/en_US/route.8 2005-05-14 01:28:41.000000000 +0300 | |
2844 | @@ -1,4 +1,4 @@ | |
2845 | -.TH ROUTE 8 "2 January 2000" "net-tools" "Linux Programmer's Manual" | |
2846 | +.TH ROUTE 8 "02 October 2003" "net-tools" "Linux Programmer's Manual" | |
2847 | .SH NAME | |
2848 | route \- show / manipulate the IP routing table | |
2849 | .SH SYNOPSIS | |
2850 | @@ -141,7 +141,7 @@ | |
2851 | set the TCP Maximum Segment Size (MSS) for connections over this route | |
2852 | to M bytes. | |
2853 | The default is the device MTU minus headers, or a lower MTU when path mtu | |
2854 | -discovery occured. This setting can be used to force smaller TCP packets on the | |
2855 | +discovery occurred. This setting can be used to force smaller TCP packets on the | |
2856 | other end when path mtu discovery does not work (usually because of | |
2857 | misconfigured firewalls that block ICMP Fragmentation Needed) | |
2858 | .TP | |
2859 | @@ -182,7 +182,7 @@ | |
2860 | .B route add -net 127.0.0.0 | |
2861 | adds the normal loopback entry, using netmask 255.0.0.0 (class A net, | |
2862 | determined from the destination address) and associated with the | |
2863 | -"lo" device (assuming this device was prviously set up correctly with | |
2864 | +"lo" device (assuming this device was previously set up correctly with | |
2865 | .BR ifconfig (8)). | |
2866 | ||
2867 | .TP | |
2868 | @@ -289,7 +289,7 @@ | |
2869 | Interface to which packets for this route will be sent. | |
2870 | .TP | |
2871 | .B MSS | |
2872 | -Default maximum segement size for TCP connections over this route. | |
2873 | +Default maximum segment size for TCP connections over this route. | |
2874 | .TP | |
2875 | .B Window | |
2876 | Default window size for TCP connections over this route. | |
2877 | --- net-tools-1.60/man/en_US/slattach.8 1999-01-09 18:19:58.000000000 +0200 | |
2878 | +++ net-tools/man/en_US/slattach.8 2006-10-10 08:58:46.000000000 +0300 | |
2879 | @@ -1,4 +1,4 @@ | |
2880 | -.TH SLATTACH 8 "12 Feb 1994" "" "" | |
2881 | +.TH SLATTACH 8 "10 Oct 2006" "" "" | |
2882 | .SH NAME | |
2883 | slattach \- attach a network interface to a serial line | |
2884 | .SH SYNOPSIS | |
2885 | @@ -24,6 +24,7 @@ | |
2886 | .B "[-h]" | |
2887 | Exit when the carrier is lost. This works on both /dev/tty and /dev/cua | |
2888 | devices by directly monitoring the carrier status every 15 seconds. | |
2889 | +.TP | |
2890 | .B "[-v]" | |
2891 | Enable verbose output. Useful in shell scripts. | |
2892 | .TP | |
2893 | @@ -41,7 +42,7 @@ | |
2894 | .TP | |
2895 | .B "[-e]" | |
2896 | Exit right after initializing device, instead of waiting for the | |
2897 | -line to hangup. | |
2898 | +line to hang up. | |
2899 | .TP | |
2900 | .B "[-L]" | |
2901 | Enable 3 wire operation. The terminal is moved into CLOCAL mode, | |
2902 | @@ -50,8 +51,8 @@ | |
2903 | .B "[-p proto]" | |
2904 | Set a specific kind of protocol to use on the line. The default | |
2905 | is set to | |
2906 | -.B "cslip" | |
2907 | -, i.e. compressed SLIP. Other possible values are | |
2908 | +.BR "cslip" , | |
2909 | +i.e. compressed SLIP. Other possible values are | |
2910 | .B "slip" | |
2911 | (normal SLIP), | |
2912 | .B "adaptive" | |
2913 | --- net-tools-1.60/man/fr_FR/arp.8 1999-04-18 22:23:40.000000000 +0300 | |
2914 | +++ net-tools/man/fr_FR/arp.8 2001-11-05 15:12:11.000000000 +0200 | |
2915 | @@ -140,8 +140,8 @@ | |
2916 |