This patch adds -e (extended information) to route and -r/-e (show routing
tables/extended information) to netstat.
This makes them behave (more) like their GNU counterparts.
diff --git a/networking/netstat.c b/networking/netstat.c
index 28ae9bc..b083b0d 100644
--- a/networking/netstat.c
+++ b/networking/netstat.c
@@ -33,6 +33,10 @@
#include "inet_common.h"
#include "busybox.h"
+#ifdef CONFIG_ROUTE
+extern void displayroutes(int noresolve, int netstatfmt);
+#endif
+
#define NETSTAT_CONNECTED 0x01
#define NETSTAT_LISTENING 0x02
#define NETSTAT_NUMERIC 0x04
@@ -462,7 +466,8 @@
{
int opt;
int new_flags=0;
- while ((opt = getopt(argc, argv, "lantuwx")) != -1)
+ int showroute = 0, extended = 0;
+ while ((opt = getopt(argc, argv, "laenrtuwx")) != -1)
switch (opt) {
case 'l':
flags &= ~NETSTAT_CONNECTED;
@@ -474,6 +479,12 @@
case 'n':
flags |= NETSTAT_NUMERIC;
break;
+ case 'r':
+ showroute = 1;
+ break;
+ case 'e':
+ extended = 1;
+ break;
case 't':
new_flags |= NETSTAT_TCP;
break;
@@ -489,6 +500,16 @@
default:
show_usage();
}
+ if ( showroute ) {
+#ifdef CONFIG_ROUTE
+ displayroutes ( flags & NETSTAT_NUMERIC, !extended );
+ return 0;
+#else
+ printf( "-r (display routing table) is not compiled in.\n" );
+ return 1;
+#endif
+ }
+
if (new_flags) {
flags &= ~(NETSTAT_TCP|NETSTAT_UDP|NETSTAT_RAW|NETSTAT_UNIX);
flags |= new_flags;