uses vector of routing trees rather than linked list
authorKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Wed, 21 Aug 1991 11:31:56 +0000 (03:31 -0800)
committerKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Wed, 21 Aug 1991 11:31:56 +0000 (03:31 -0800)
SCCS-vsn: usr.bin/netstat/route.c 5.22
SCCS-vsn: usr.bin/netstat/main.c 5.25

usr/src/usr.bin/netstat/main.c
usr/src/usr.bin/netstat/route.c

index 9e40169..5f67cd3 100644 (file)
@@ -12,7 +12,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     5.24 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c     5.25 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -72,7 +72,7 @@ struct nlist nl[] = {
 #define N_NIMP         20
        { "_nimp"},
 #define N_RTREE                21
 #define N_NIMP         20
        { "_nimp"},
 #define N_RTREE                21
-       { "_radix_node_head"},
+       { "_rt_tables"},
 #define N_CLTP         22
        { "_cltb"},
 #define N_CLTPSTAT     23
 #define N_CLTP         22
        { "_cltb"},
 #define N_CLTPSTAT     23
index 15aeea5..3279491 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)route.c    5.21 (Berkeley) %G%";
+static char sccsid[] = "@(#)route.c    5.22 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -51,6 +51,7 @@ struct bits {
        { RTF_XRESOLVE, 'X' },
        { RTF_LLINFO,   'L' },
        { RTF_REJECT,   'R' },
        { RTF_XRESOLVE, 'X' },
        { RTF_LLINFO,   'L' },
        { RTF_REJECT,   'R' },
+       { RTF_STATIC,   'S' },
        { 0 }
 };
 
        { 0 }
 };
 
@@ -73,6 +74,7 @@ routepr(rtree)
        off_t rtree;
 {
        struct radix_node_head *rnh, head;
        off_t rtree;
 {
        struct radix_node_head *rnh, head;
+       int i;
 
        printf("Routing tables\n");
 
 
        printf("Routing tables\n");
 
@@ -80,19 +82,22 @@ routepr(rtree)
                ntreestuff();
        else {
                if (rtree == 0) {
                ntreestuff();
        else {
                if (rtree == 0) {
-                       printf("radix_node_head: symbol not in namelist\n");
+                       printf("rt_tables: symbol not in namelist\n");
                        return;
                }
 
                        return;
                }
 
-               for (kget(rtree, rnh); rnh; rnh = head.rnh_next) {
+               kget(rtree, rt_tables);
+               for (i = 0; i <= AF_MAX; i++) {
+                       if ((rnh = rt_tables[i]) == 0)
+                               continue;
                        kget(rnh, head);
                        kget(rnh, head);
-                       if (head.rnh_af == AF_UNSPEC) {
-                               if (Aflag) { 
+                       if (i == AF_UNSPEC) {
+                               if (Aflag && af == 0) { 
                                        printf("Netmasks:\n");
                                        p_tree(head.rnh_treetop);
                                }
                                        printf("Netmasks:\n");
                                        p_tree(head.rnh_treetop);
                                }
-                       } else if (af == AF_UNSPEC || af == head.rnh_af) {
-                               pr_family(head.rnh_af);
+                       } else if (af == AF_UNSPEC || af == i) {
+                               pr_family(i);
                                do_rtent = 1;
                                pr_rthdr();
                                p_tree(head.rnh_treetop);
                                do_rtent = 1;
                                pr_rthdr();
                                p_tree(head.rnh_treetop);
@@ -119,6 +124,9 @@ pr_family(af)
        case AF_ISO:
                afname = "ISO";
                break;
        case AF_ISO:
                afname = "ISO";
                break;
+       case AF_CCITT:
+               afname = "X.25";
+               break;
        default:
                afname = NULL;
                break;
        default:
                afname = NULL;
                break;