- if (Aflag)
- printf("%-8.8s ","Address");
- printf("%-16.16s %-18.18s %-6.6s %6.6s%8.8s %s\n",
- "Destination", "Gateway",
- "Flags", "Refs", "Use", "Interface");
- if (treeaddr)
- return treestuff(treeaddr);
- if (hostaddr == 0) {
- printf("rthost: symbol not in namelist\n");
- return;
- }
- if (netaddr == 0) {
- printf("rtnet: symbol not in namelist\n");
- return;
- }
- if (hashsizeaddr == 0) {
- printf("rthashsize: symbol not in namelist\n");
- return;
- }
- kget(hashsizeaddr, hashsize);
- routehash = (struct mbuf **)malloc( hashsize*sizeof (struct mbuf *) );
- kvm_read(hostaddr, (char *)routehash, hashsize*sizeof (struct mbuf *));
-again:
- for (i = 0; i < hashsize; i++) {
- if (routehash[i] == 0)
- continue;
- m = routehash[i];
- while (m) {
- kget(m, mb);
- if (Aflag)
- printf("%8.8x ", m);
- p_ortentry((struct ortentry *)(mb.m_dat));
- m = mb.m_next;
+
+ if (Aflag == 0 && NewTree)
+ ntreestuff();
+ else {
+ if (rtree == 0) {
+ printf("rt_tables: symbol not in namelist\n");
+ return;
+ }
+
+ kget(rtree, rt_tables);
+ for (i = 0; i <= AF_MAX; i++) {
+ if ((rnh = rt_tables[i]) == 0)
+ continue;
+ kget(rnh, head);
+ if (i == AF_UNSPEC) {
+ if (Aflag && af == 0) {
+ printf("Netmasks:\n");
+ p_tree(head.rnh_treetop);
+ }
+ } else if (af == AF_UNSPEC || af == i) {
+ pr_family(i);
+ do_rtent = 1;
+ pr_rthdr();
+ p_tree(head.rnh_treetop);
+ }