aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-08-27 17:57:27 +0000
committerEric Andersen <andersen@codepoet.org>2001-08-27 17:57:27 +0000
commit863a3e15d6f08e187238ded7fc17422dd947ef1e (patch)
tree4109f717a0734be8f36d4ba15c492d64f5fe6632
parentab3d839ef455739f8a52e7e44f8f3eed158e2acf (diff)
downloadbusybox-w32-863a3e15d6f08e187238ded7fc17422dd947ef1e.tar.gz
busybox-w32-863a3e15d6f08e187238ded7fc17422dd947ef1e.tar.bz2
busybox-w32-863a3e15d6f08e187238ded7fc17422dd947ef1e.zip
patch from vodz -- route cleanup to display all route entries
-rw-r--r--networking/route.c39
-rw-r--r--route.c39
2 files changed, 60 insertions, 18 deletions
diff --git a/networking/route.c b/networking/route.c
index 8e12a3f2e..bb88307a8 100644
--- a/networking/route.c
+++ b/networking/route.c
@@ -15,7 +15,7 @@
15 * Foundation; either version 2 of the License, or (at 15 * Foundation; either version 2 of the License, or (at
16 * your option) any later version. 16 * your option) any later version.
17 * 17 *
18 * $Id: route.c,v 1.11 2001/08/23 22:05:33 andersen Exp $ 18 * $Id: route.c,v 1.12 2001/08/27 17:57:27 andersen Exp $
19 * 19 *
20 * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru> 20 * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru>
21 * adjustments by Larry Doolittle <LRDoolittle@lbl.gov> 21 * adjustments by Larry Doolittle <LRDoolittle@lbl.gov>
@@ -345,6 +345,23 @@ INET_setroute(int action, int options, char **args)
345 return EXIT_SUCCESS; 345 return EXIT_SUCCESS;
346} 346}
347 347
348#ifndef RTF_UP
349/* Keep this in sync with /usr/src/linux/include/linux/route.h */
350#define RTF_UP 0x0001 /* route usable */
351#define RTF_GATEWAY 0x0002 /* destination is a gateway */
352#define RTF_HOST 0x0004 /* host entry (net otherwise) */
353#define RTF_REINSTATE 0x0008 /* reinstate route after tmout */
354#define RTF_DYNAMIC 0x0010 /* created dyn. (by redirect) */
355#define RTF_MODIFIED 0x0020 /* modified dyn. (by redirect) */
356#define RTF_MTU 0x0040 /* specific MTU for this route */
357#ifndef RTF_MSS
358#define RTF_MSS RTF_MTU /* Compatibility :-( */
359#endif
360#define RTF_WINDOW 0x0080 /* per route window clamping */
361#define RTF_IRTT 0x0100 /* Initial round trip time */
362#define RTF_REJECT 0x0200 /* Reject route */
363#endif
364
348static void displayroutes(void) 365static void displayroutes(void)
349{ 366{
350 char buff[256]; 367 char buff[256];
@@ -371,21 +388,25 @@ static void displayroutes(void)
371 &d, &g, &flgs, &ref, &use, &metric, &m)!=7) { 388 &d, &g, &flgs, &ref, &use, &metric, &m)!=7) {
372 error_msg_and_die( "Unsuported kernel route format\n"); 389 error_msg_and_die( "Unsuported kernel route format\n");
373 } 390 }
374 if(nl==1) { 391 if(nl==1)
375 printf("Kernel IP routing table\n" 392 printf("Kernel IP routing table\n"
376"Destination Gateway Genmask Flags Metric Ref Use Iface\n"); 393"Destination Gateway Genmask Flags Metric Ref Use Iface\n");
377 } else {
378 nl++;
379 continue;
380 }
381 394
382 ifl = 0; /* parse flags */ 395 ifl = 0; /* parse flags */
383 if(flgs&1) 396 if(flgs&RTF_UP)
384 flags[ifl++]='U'; 397 flags[ifl++]='U';
385 if(flgs&2) 398 if(flgs&RTF_GATEWAY)
386 flags[ifl++]='G'; 399 flags[ifl++]='G';
387 if(flgs&4) 400 if(flgs&RTF_HOST)
401 flags[ifl++]='H';
402 if(flgs&RTF_REINSTATE)
403 flags[ifl++]='R';
404 if(flgs&RTF_DYNAMIC)
405 flags[ifl++]='D';
406 if(flgs&RTF_MODIFIED)
388 flags[ifl++]='H'; 407 flags[ifl++]='H';
408 if(flgs&RTF_REJECT)
409 flags[ifl++]='!';
389 flags[ifl]=0; 410 flags[ifl]=0;
390 dest.s_addr = d; 411 dest.s_addr = d;
391 gw.s_addr = g; 412 gw.s_addr = g;
diff --git a/route.c b/route.c
index 8e12a3f2e..bb88307a8 100644
--- a/route.c
+++ b/route.c
@@ -15,7 +15,7 @@
15 * Foundation; either version 2 of the License, or (at 15 * Foundation; either version 2 of the License, or (at
16 * your option) any later version. 16 * your option) any later version.
17 * 17 *
18 * $Id: route.c,v 1.11 2001/08/23 22:05:33 andersen Exp $ 18 * $Id: route.c,v 1.12 2001/08/27 17:57:27 andersen Exp $
19 * 19 *
20 * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru> 20 * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru>
21 * adjustments by Larry Doolittle <LRDoolittle@lbl.gov> 21 * adjustments by Larry Doolittle <LRDoolittle@lbl.gov>
@@ -345,6 +345,23 @@ INET_setroute(int action, int options, char **args)
345 return EXIT_SUCCESS; 345 return EXIT_SUCCESS;
346} 346}
347 347
348#ifndef RTF_UP
349/* Keep this in sync with /usr/src/linux/include/linux/route.h */
350#define RTF_UP 0x0001 /* route usable */
351#define RTF_GATEWAY 0x0002 /* destination is a gateway */
352#define RTF_HOST 0x0004 /* host entry (net otherwise) */
353#define RTF_REINSTATE 0x0008 /* reinstate route after tmout */
354#define RTF_DYNAMIC 0x0010 /* created dyn. (by redirect) */
355#define RTF_MODIFIED 0x0020 /* modified dyn. (by redirect) */
356#define RTF_MTU 0x0040 /* specific MTU for this route */
357#ifndef RTF_MSS
358#define RTF_MSS RTF_MTU /* Compatibility :-( */
359#endif
360#define RTF_WINDOW 0x0080 /* per route window clamping */
361#define RTF_IRTT 0x0100 /* Initial round trip time */
362#define RTF_REJECT 0x0200 /* Reject route */
363#endif
364
348static void displayroutes(void) 365static void displayroutes(void)
349{ 366{
350 char buff[256]; 367 char buff[256];
@@ -371,21 +388,25 @@ static void displayroutes(void)
371 &d, &g, &flgs, &ref, &use, &metric, &m)!=7) { 388 &d, &g, &flgs, &ref, &use, &metric, &m)!=7) {
372 error_msg_and_die( "Unsuported kernel route format\n"); 389 error_msg_and_die( "Unsuported kernel route format\n");
373 } 390 }
374 if(nl==1) { 391 if(nl==1)
375 printf("Kernel IP routing table\n" 392 printf("Kernel IP routing table\n"
376"Destination Gateway Genmask Flags Metric Ref Use Iface\n"); 393"Destination Gateway Genmask Flags Metric Ref Use Iface\n");
377 } else {
378 nl++;
379 continue;
380 }
381 394
382 ifl = 0; /* parse flags */ 395 ifl = 0; /* parse flags */
383 if(flgs&1) 396 if(flgs&RTF_UP)
384 flags[ifl++]='U'; 397 flags[ifl++]='U';
385 if(flgs&2) 398 if(flgs&RTF_GATEWAY)
386 flags[ifl++]='G'; 399 flags[ifl++]='G';
387 if(flgs&4) 400 if(flgs&RTF_HOST)
401 flags[ifl++]='H';
402 if(flgs&RTF_REINSTATE)
403 flags[ifl++]='R';
404 if(flgs&RTF_DYNAMIC)
405 flags[ifl++]='D';
406 if(flgs&RTF_MODIFIED)
388 flags[ifl++]='H'; 407 flags[ifl++]='H';
408 if(flgs&RTF_REJECT)
409 flags[ifl++]='!';
389 flags[ifl]=0; 410 flags[ifl]=0;
390 dest.s_addr = d; 411 dest.s_addr = d;
391 gw.s_addr = g; 412 gw.s_addr = g;