1 |
vapier 08/04/19 07:11:09 |
2 |
|
3 |
Added: |
4 |
0001-revert-621a2f376334f8097604b9fee5783e0f1141e66d-for.patch |
5 |
Log: |
6 |
Revert ifconfig output style until packages can be updated #217775. |
7 |
(Portage version: 2.2_pre5) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 sys-apps/net-tools/files/1.60_p20071202044231/0001-revert-621a2f376334f8097604b9fee5783e0f1141e66d-for.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/net-tools/files/1.60_p20071202044231/0001-revert-621a2f376334f8097604b9fee5783e0f1141e66d-for.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/net-tools/files/1.60_p20071202044231/0001-revert-621a2f376334f8097604b9fee5783e0f1141e66d-for.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: 0001-revert-621a2f376334f8097604b9fee5783e0f1141e66d-for.patch |
16 |
=================================================================== |
17 |
From 2eed7d25830422bf6d61c48f911111acb56e5b06 Mon Sep 17 00:00:00 2001 |
18 |
From: Mike Frysinger <vapier@g.o> |
19 |
Date: Sat, 19 Apr 2008 03:07:09 -0400 |
20 |
Subject: [PATCH] revert 621a2f376334f8097604b9fee5783e0f1141e66d for ifconfig output format |
21 |
|
22 |
--- |
23 |
lib/interface.c | 293 +++++++++++++++++++++++++----------------------------- |
24 |
1 files changed, 136 insertions(+), 157 deletions(-) |
25 |
|
26 |
diff --git a/lib/interface.c b/lib/interface.c |
27 |
index be7017e..368e677 100644 |
28 |
--- a/lib/interface.c |
29 |
+++ b/lib/interface.c |
30 |
@@ -101,7 +101,6 @@ static struct interface *if_cache_add(char *name) |
31 |
if (!int_list) |
32 |
int_last = NULL; |
33 |
|
34 |
- /* the cache is sorted, so if we hit a smaller if, exit */ |
35 |
for (ife = int_last; ife; ife = ife->prev) { |
36 |
int n = nstrcmp(ife->name, name); |
37 |
if (n == 0) |
38 |
@@ -111,7 +110,7 @@ static struct interface *if_cache_add(char *name) |
39 |
} |
40 |
new(new); |
41 |
safe_strncpy(new->name, name, IFNAMSIZ); |
42 |
- nextp = ife ? &ife->next : &int_list; // keep sorting |
43 |
+ nextp = ife ? &ife->next : &int_list; |
44 |
new->prev = ife; |
45 |
new->next = *nextp; |
46 |
if (new->next) |
47 |
@@ -686,70 +685,32 @@ void ife_print_long(struct interface *ptr) |
48 |
if (hw == NULL) |
49 |
hw = get_hwntype(-1); |
50 |
|
51 |
- sprintf(flags, "flags=%d<", ptr->flags); |
52 |
- /* DONT FORGET TO ADD THE FLAGS IN ife_print_short, too */ |
53 |
- if (ptr->flags == 0) |
54 |
- strcat(flags,">"); |
55 |
- if (ptr->flags & IFF_UP) |
56 |
- strcat(flags,_("UP,")); |
57 |
- if (ptr->flags & IFF_BROADCAST) |
58 |
- strcat(flags,_("BROADCAST,")); |
59 |
- if (ptr->flags & IFF_DEBUG) |
60 |
- strcat(flags,_("DEBUG,")); |
61 |
- if (ptr->flags & IFF_LOOPBACK) |
62 |
- strcat(flags,_("LOOPBACK,")); |
63 |
- if (ptr->flags & IFF_POINTOPOINT) |
64 |
- strcat(flags,_("POINTOPOINT,")); |
65 |
- if (ptr->flags & IFF_NOTRAILERS) |
66 |
- strcat(flags,_("NOTRAILERS,")); |
67 |
- if (ptr->flags & IFF_RUNNING) |
68 |
- strcat(flags,_("RUNNING,")); |
69 |
- if (ptr->flags & IFF_NOARP) |
70 |
- strcat(flags,_("NOARP,")); |
71 |
- if (ptr->flags & IFF_PROMISC) |
72 |
- strcat(flags,_("PROMISC,")); |
73 |
- if (ptr->flags & IFF_ALLMULTI) |
74 |
- strcat(flags,_("ALLMULTI,")); |
75 |
- if (ptr->flags & IFF_SLAVE) |
76 |
- strcat(flags,_("SLAVE,")); |
77 |
- if (ptr->flags & IFF_MASTER) |
78 |
- strcat(flags,_("MASTER,")); |
79 |
- if (ptr->flags & IFF_MULTICAST) |
80 |
- strcat(flags,_("MULTICAST,")); |
81 |
-#ifdef HAVE_DYNAMIC |
82 |
- if (ptr->flags & IFF_DYNAMIC) |
83 |
- strcat(flags,_("DYNAMIC,")); |
84 |
-#endif |
85 |
- /* DONT FORGET TO ADD THE FLAGS IN ife_print_short */ |
86 |
- if (flags[strlen(flags)-1] == ',') |
87 |
- flags[strlen(flags)-1] = '>'; |
88 |
- else |
89 |
- flags[strlen(flags)-1] = 0; |
90 |
- |
91 |
- |
92 |
- printf(_("%s: %s mtu %d metric %d"), |
93 |
- ptr->name, flags, ptr->mtu, ptr->metric ? ptr->metric : 1); |
94 |
-#ifdef SIOCSKEEPALIVE |
95 |
- if (ptr->outfill || ptr->keepalive) |
96 |
- printf(_(" outfill %d keepalive %d"), |
97 |
- ptr->outfill, ptr->keepalive); |
98 |
+ printf(_("%-9.9s Link encap:%s "), ptr->name, hw->title); |
99 |
+ /* For some hardware types (eg Ash, ATM) we don't print the |
100 |
+ hardware address if it's null. */ |
101 |
+ if (hw->print != NULL && (! (hw_null_address(hw, ptr->hwaddr) && |
102 |
+ hw->suppress_null_addr))) |
103 |
+ printf(_("HWaddr %s "), hw->print(ptr->hwaddr)); |
104 |
+#ifdef IFF_PORTSEL |
105 |
+ if (ptr->flags & IFF_PORTSEL) { |
106 |
+ printf(_("Media:%s"), if_port_text[ptr->map.port][0]); |
107 |
+ if (ptr->flags & IFF_AUTOMEDIA) |
108 |
+ printf(_("(auto)")); |
109 |
+ } |
110 |
#endif |
111 |
printf("\n"); |
112 |
|
113 |
- |
114 |
- |
115 |
#if HAVE_AFINET |
116 |
if (ptr->has_ip) { |
117 |
- printf(_(" %s %s"), ap->name, |
118 |
+ printf(_(" %s addr:%s "), ap->name, |
119 |
ap->sprint(&ptr->addr, 1)); |
120 |
- printf(_(" netmask %s"), ap->sprint(&ptr->netmask, 1)); |
121 |
- if (ptr->flags & IFF_BROADCAST) { |
122 |
- printf(_(" broadcast %s"), ap->sprint(&ptr->broadaddr, 1)); |
123 |
- } |
124 |
if (ptr->flags & IFF_POINTOPOINT) { |
125 |
- printf(_(" destination %s"), ap->sprint(&ptr->dstaddr, 1)); |
126 |
+ printf(_(" P-t-P:%s "), ap->sprint(&ptr->dstaddr, 1)); |
127 |
} |
128 |
- printf("\n"); |
129 |
+ if (ptr->flags & IFF_BROADCAST) { |
130 |
+ printf(_(" Bcast:%s "), ap->sprint(&ptr->broadaddr, 1)); |
131 |
+ } |
132 |
+ printf(_(" Mask:%s\n"), ap->sprint(&ptr->netmask, 1)); |
133 |
} |
134 |
#endif |
135 |
|
136 |
@@ -766,30 +727,29 @@ void ife_print_long(struct interface *ptr) |
137 |
addr6p[0], addr6p[1], addr6p[2], addr6p[3], |
138 |
addr6p[4], addr6p[5], addr6p[6], addr6p[7]); |
139 |
inet6_aftype.input(1, addr6, (struct sockaddr *) &sap); |
140 |
- printf(_(" %s %s prefixlen %d"), |
141 |
- inet6_aftype.name, |
142 |
- inet6_aftype.sprint((struct sockaddr *) &sap, 1), |
143 |
- plen); |
144 |
- printf(_(" scopeid 0x%x"), scope); |
145 |
- |
146 |
- flags[0] = '<'; flags[1] = 0; |
147 |
- if (scope & IPV6_ADDR_COMPATv4) { |
148 |
- strcat(flags, _("compat,")); |
149 |
- scope -= IPV6_ADDR_COMPATv4; |
150 |
+ printf(_(" inet6 addr: %s/%d"), |
151 |
+ inet6_aftype.sprint((struct sockaddr *) &sap, 1), plen); |
152 |
+ printf(_(" Scope:")); |
153 |
+ switch (scope) { |
154 |
+ case 0: |
155 |
+ printf(_("Global")); |
156 |
+ break; |
157 |
+ case IPV6_ADDR_LINKLOCAL: |
158 |
+ printf(_("Link")); |
159 |
+ break; |
160 |
+ case IPV6_ADDR_SITELOCAL: |
161 |
+ printf(_("Site")); |
162 |
+ break; |
163 |
+ case IPV6_ADDR_COMPATv4: |
164 |
+ printf(_("Compat")); |
165 |
+ break; |
166 |
+ case IPV6_ADDR_LOOPBACK: |
167 |
+ printf(_("Host")); |
168 |
+ break; |
169 |
+ default: |
170 |
+ printf(_("Unknown")); |
171 |
} |
172 |
- if (scope == 0) |
173 |
- strcat(flags, _("global,")); |
174 |
- if (scope & IPV6_ADDR_LINKLOCAL) |
175 |
- strcat(flags, _("link,")); |
176 |
- if (scope & IPV6_ADDR_SITELOCAL) |
177 |
- strcat(flags, _("site,")); |
178 |
- if (scope & IPV6_ADDR_LOOPBACK) |
179 |
- strcat(flags, _("host,")); |
180 |
- if (flags[strlen(flags)-1] == ',') |
181 |
- flags[strlen(flags)-1] = '>'; |
182 |
- else |
183 |
- flags[strlen(flags)-1] = 0; |
184 |
- printf("%s\n", flags); |
185 |
+ printf("\n"); |
186 |
} |
187 |
} |
188 |
fclose(f); |
189 |
@@ -802,17 +762,17 @@ void ife_print_long(struct interface *ptr) |
190 |
|
191 |
if (ipxtype != NULL) { |
192 |
if (ptr->has_ipx_bb) |
193 |
- printf(_(" %s Ethernet-II %s\n"), |
194 |
- ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_bb, 1)); |
195 |
+ printf(_(" IPX/Ethernet II addr:%s\n"), |
196 |
+ ipxtype->sprint(&ptr->ipxaddr_bb, 1)); |
197 |
if (ptr->has_ipx_sn) |
198 |
- printf(_(" %s Ethernet-SNAP %s\n"), |
199 |
- ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_sn, 1)); |
200 |
+ printf(_(" IPX/Ethernet SNAP addr:%s\n"), |
201 |
+ ipxtype->sprint(&ptr->ipxaddr_sn, 1)); |
202 |
if (ptr->has_ipx_e2) |
203 |
- printf(_(" %s Ethernet802.2 %s\n"), |
204 |
- ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_e2, 1)); |
205 |
+ printf(_(" IPX/Ethernet 802.2 addr:%s\n"), |
206 |
+ ipxtype->sprint(&ptr->ipxaddr_e2, 1)); |
207 |
if (ptr->has_ipx_e3) |
208 |
- printf(_(" %s Ethernet802.3 %s\n"), |
209 |
- ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_e3, 1)); |
210 |
+ printf(_(" IPX/Ethernet 802.3 addr:%s\n"), |
211 |
+ ipxtype->sprint(&ptr->ipxaddr_e3, 1)); |
212 |
} |
213 |
#endif |
214 |
|
215 |
@@ -821,7 +781,7 @@ void ife_print_long(struct interface *ptr) |
216 |
ddptype = get_afntype(AF_APPLETALK); |
217 |
if (ddptype != NULL) { |
218 |
if (ptr->has_ddp) |
219 |
- printf(_(" %s %s\n"), ddptype->name, ddptype->sprint(&ptr->ddpaddr, 1)); |
220 |
+ printf(_(" EtherTalk Phase 2 addr:%s\n"), ddptype->sprint(&ptr->ddpaddr, 1)); |
221 |
} |
222 |
#endif |
223 |
|
224 |
@@ -830,30 +790,53 @@ void ife_print_long(struct interface *ptr) |
225 |
ectype = get_afntype(AF_ECONET); |
226 |
if (ectype != NULL) { |
227 |
if (ptr->has_econet) |
228 |
- printf(_(" %s %s\n"), ectype->name, ectype->sprint(&ptr->ecaddr, 1)); |
229 |
+ printf(_(" econet addr:%s\n"), ectype->sprint(&ptr->ecaddr, 1)); |
230 |
} |
231 |
#endif |
232 |
|
233 |
- /* For some hardware types (eg Ash, ATM) we don't print the |
234 |
- hardware address if it's null. */ |
235 |
- if (hw->print != NULL && (! (hw_null_address(hw, ptr->hwaddr) && |
236 |
- hw->suppress_null_addr))) |
237 |
- printf(_(" %s %s"), hw->name, hw->print(ptr->hwaddr)); |
238 |
- else |
239 |
- printf(_(" %s"), hw->name); |
240 |
- if (ptr->tx_queue_len != -1) |
241 |
- printf(_(" txqueuelen %d"), ptr->tx_queue_len); |
242 |
- printf(" (%s)\n", hw->title); |
243 |
- |
244 |
-#ifdef IFF_PORTSEL |
245 |
- if (ptr->flags & IFF_PORTSEL) { |
246 |
- printf(_(" media %s"), if_port_text[ptr->map.port][0]); |
247 |
- if (ptr->flags & IFF_AUTOMEDIA) |
248 |
- printf(_("autoselect")); |
249 |
- printf("\n"); |
250 |
- } |
251 |
+ printf(" "); |
252 |
+ /* DONT FORGET TO ADD THE FLAGS IN ife_print_short, too */ |
253 |
+ if (ptr->flags == 0) |
254 |
+ printf(_("[NO FLAGS] ")); |
255 |
+ if (ptr->flags & IFF_UP) |
256 |
+ printf(_("UP ")); |
257 |
+ if (ptr->flags & IFF_BROADCAST) |
258 |
+ printf(_("BROADCAST ")); |
259 |
+ if (ptr->flags & IFF_DEBUG) |
260 |
+ printf(_("DEBUG ")); |
261 |
+ if (ptr->flags & IFF_LOOPBACK) |
262 |
+ printf(_("LOOPBACK ")); |
263 |
+ if (ptr->flags & IFF_POINTOPOINT) |
264 |
+ printf(_("POINTOPOINT ")); |
265 |
+ if (ptr->flags & IFF_NOTRAILERS) |
266 |
+ printf(_("NOTRAILERS ")); |
267 |
+ if (ptr->flags & IFF_RUNNING) |
268 |
+ printf(_("RUNNING ")); |
269 |
+ if (ptr->flags & IFF_NOARP) |
270 |
+ printf(_("NOARP ")); |
271 |
+ if (ptr->flags & IFF_PROMISC) |
272 |
+ printf(_("PROMISC ")); |
273 |
+ if (ptr->flags & IFF_ALLMULTI) |
274 |
+ printf(_("ALLMULTI ")); |
275 |
+ if (ptr->flags & IFF_SLAVE) |
276 |
+ printf(_("SLAVE ")); |
277 |
+ if (ptr->flags & IFF_MASTER) |
278 |
+ printf(_("MASTER ")); |
279 |
+ if (ptr->flags & IFF_MULTICAST) |
280 |
+ printf(_("MULTICAST ")); |
281 |
+#ifdef HAVE_DYNAMIC |
282 |
+ if (ptr->flags & IFF_DYNAMIC) |
283 |
+ printf(_("DYNAMIC ")); |
284 |
#endif |
285 |
- |
286 |
+ /* DONT FORGET TO ADD THE FLAGS IN ife_print_short */ |
287 |
+ printf(_(" MTU:%d Metric:%d"), |
288 |
+ ptr->mtu, ptr->metric ? ptr->metric : 1); |
289 |
+#ifdef SIOCSKEEPALIVE |
290 |
+ if (ptr->outfill || ptr->keepalive) |
291 |
+ printf(_(" Outfill:%d Keepalive:%d"), |
292 |
+ ptr->outfill, ptr->keepalive); |
293 |
+#endif |
294 |
+ printf("\n"); |
295 |
|
296 |
/* If needed, display the interface statistics. */ |
297 |
|
298 |
@@ -862,16 +845,27 @@ void ife_print_long(struct interface *ptr) |
299 |
* not for the aliases, although strictly speaking they're shared |
300 |
* by all addresses. |
301 |
*/ |
302 |
+ printf(" "); |
303 |
+ |
304 |
+ printf(_("RX packets:%llu errors:%lu dropped:%lu overruns:%lu frame:%lu\n"), |
305 |
+ ptr->stats.rx_packets, ptr->stats.rx_errors, |
306 |
+ ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors, |
307 |
+ ptr->stats.rx_frame_errors); |
308 |
+ if (can_compress) |
309 |
+ printf(_(" compressed:%lu\n"), ptr->stats.rx_compressed); |
310 |
+ |
311 |
rx = ptr->stats.rx_bytes; |
312 |
+ tx = ptr->stats.tx_bytes; |
313 |
short_rx = rx * 10; |
314 |
- if (rx > 1125899906842624ull) { |
315 |
- short_rx /= 1125899906842624ull; |
316 |
+ short_tx = tx * 10; |
317 |
+ if (rx > 1125899906842624) { |
318 |
+ short_rx /= 1125899906842624; |
319 |
Rext = "PiB"; |
320 |
- } else if (rx > 1099511627776ull) { |
321 |
- short_rx /= 1099511627776ull; |
322 |
+ } else if (rx > 1099511627776) { |
323 |
+ short_rx /= 1099511627776; |
324 |
Rext = "TiB"; |
325 |
- } else if (rx > 1073741824ull) { |
326 |
- short_rx /= 1073741824ull; |
327 |
+ } else if (rx > 1073741824) { |
328 |
+ short_rx /= 1073741824; |
329 |
Rext = "GiB"; |
330 |
} else if (rx > 1048576) { |
331 |
short_rx /= 1048576; |
332 |
@@ -880,16 +874,14 @@ void ife_print_long(struct interface *ptr) |
333 |
short_rx /= 1024; |
334 |
Rext = "KiB"; |
335 |
} |
336 |
- tx = ptr->stats.tx_bytes; |
337 |
- short_tx = tx * 10; |
338 |
- if (tx > 1125899906842624ull) { |
339 |
- short_tx /= 1125899906842624ull; |
340 |
+ if (tx > 1125899906842624) { |
341 |
+ short_tx /= 1125899906842624; |
342 |
Text = "PiB"; |
343 |
- } else if (tx > 1099511627776ull) { |
344 |
- short_tx /= 1099511627776ull; |
345 |
+ } else if (tx > 1099511627776) { |
346 |
+ short_tx /= 1099511627776; |
347 |
Text = "TiB"; |
348 |
- } else if (tx > 1073741824ull) { |
349 |
- short_tx /= 1073741824ull; |
350 |
+ } else if (tx > 1073741824) { |
351 |
+ short_tx /= 1073741824; |
352 |
Text = "GiB"; |
353 |
} else if (tx > 1048576) { |
354 |
short_tx /= 1048576; |
355 |
@@ -899,50 +891,37 @@ void ife_print_long(struct interface *ptr) |
356 |
Text = "KiB"; |
357 |
} |
358 |
|
359 |
- printf(" "); |
360 |
- printf(_("RX packets %llu bytes %llu (%lu.%lu %s)\n"), |
361 |
- ptr->stats.rx_packets, |
362 |
- rx, (unsigned long)(short_rx / 10), |
363 |
- (unsigned long)(short_rx % 10), Rext); |
364 |
- if (can_compress) { |
365 |
- printf(" "); |
366 |
- printf(_("RX compressed:%lu\n"), ptr->stats.rx_compressed); |
367 |
- } |
368 |
- printf(" "); |
369 |
- printf(_("RX errors %lu dropped %lu overruns %lu frame %lu\n"), |
370 |
- ptr->stats.rx_errors, ptr->stats.rx_dropped, |
371 |
- ptr->stats.rx_fifo_errors, ptr->stats.rx_frame_errors); |
372 |
- |
373 |
- |
374 |
- printf(" "); |
375 |
- printf(_("TX packets %llu bytes %llu (%lu.%lu %s)\n"), |
376 |
- ptr->stats.tx_packets, |
377 |
- tx, (unsigned long)(short_tx / 10), |
378 |
- (unsigned long)(short_tx % 10), Text); |
379 |
- if (can_compress) { |
380 |
- printf(" "); |
381 |
- printf(_("TX compressed %lu\n"), ptr->stats.tx_compressed); |
382 |
- } |
383 |
- printf(" "); |
384 |
- printf(_("TX errors %lu dropped %lu overruns %lu carrier %lu collisions %lu\n"), |
385 |
- ptr->stats.tx_errors, |
386 |
+ printf(" "); |
387 |
+ printf(_("TX packets:%llu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n"), |
388 |
+ ptr->stats.tx_packets, ptr->stats.tx_errors, |
389 |
ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors, |
390 |
- ptr->stats.tx_carrier_errors, ptr->stats.collisions); |
391 |
+ ptr->stats.tx_carrier_errors); |
392 |
+ printf(_(" collisions:%lu "), ptr->stats.collisions); |
393 |
+ if (can_compress) |
394 |
+ printf(_("compressed:%lu "), ptr->stats.tx_compressed); |
395 |
+ if (ptr->tx_queue_len != -1) |
396 |
+ printf(_("txqueuelen:%d "), ptr->tx_queue_len); |
397 |
+ printf("\n "); |
398 |
+ printf(_("RX bytes:%llu (%lu.%lu %s) TX bytes:%llu (%lu.%lu %s)\n"), |
399 |
+ rx, (unsigned long)(short_rx / 10), |
400 |
+ (unsigned long)(short_rx % 10), Rext, |
401 |
+ tx, (unsigned long)(short_tx / 10), |
402 |
+ (unsigned long)(short_tx % 10), Text); |
403 |
} |
404 |
|
405 |
if ((ptr->map.irq || ptr->map.mem_start || ptr->map.dma || |
406 |
ptr->map.base_addr >= 0x100)) { |
407 |
- printf(" device "); |
408 |
+ printf(" "); |
409 |
if (ptr->map.irq) |
410 |
- printf(_("interrupt %d "), ptr->map.irq); |
411 |
+ printf(_("Interrupt:%d "), ptr->map.irq); |
412 |
if (ptr->map.base_addr >= 0x100) /* Only print devices using it for |
413 |
I/O maps */ |
414 |
- printf(_("base 0x%x "), ptr->map.base_addr); |
415 |
+ printf(_("Base address:0x%x "), ptr->map.base_addr); |
416 |
if (ptr->map.mem_start) { |
417 |
- printf(_("memory 0x%lx-%lx "), ptr->map.mem_start, ptr->map.mem_end); |
418 |
+ printf(_("Memory:%lx-%lx "), ptr->map.mem_start, ptr->map.mem_end); |
419 |
} |
420 |
if (ptr->map.dma) |
421 |
- printf(_(" dma 0x%x"), ptr->map.dma); |
422 |
+ printf(_("DMA chan:%x "), ptr->map.dma); |
423 |
printf("\n"); |
424 |
} |
425 |
printf("\n"); |
426 |
-- |
427 |
1.5.5 |
428 |
|
429 |
|
430 |
|
431 |
|
432 |
-- |
433 |
gentoo-commits@l.g.o mailing list |