[BACK]Return to route.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / netstat

Diff for /src/usr.bin/netstat/route.c between version 1.72 and 1.73

version 1.72, 2006/05/27 19:16:37 version 1.73, 2006/08/29 21:51:13
Line 76 
Line 76 
         ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))          ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
 #define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))  #define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
   
 struct radix_node_head *rt_tables[AF_MAX+1];  struct radix_node_head ***rt_head;
   struct radix_node_head ***rnt;                  /* provides enough space */
   struct radix_node_head *rt_tables[AF_MAX+1];    /* provides enough space */
   u_int8_t                  af2rtafidx[AF_MAX+1];
   
 static union {  static union {
         struct          sockaddr u_sa;          struct          sockaddr u_sa;
Line 100 
Line 103 
  * Print routing tables.   * Print routing tables.
  */   */
 void  void
 routepr(u_long rtree)  routepr(u_long rtree, u_long mtree, u_long af2idx, u_long rtbl_id_max)
 {  {
         struct radix_node_head *rnh, head;          struct radix_node_head *rnh, head;
         int i;          int i, idxmax = 0;
           u_int rtidxmax;
   
         printf("Routing tables\n");          printf("Routing tables\n");
   
         if (rtree == 0) {          if (rtree == 0 || af2idx == 0) {
                 printf("rt_tables: symbol not in namelist\n");                  printf("rt_tables: symbol not in namelist\n");
                 return;                  return;
         }          }
   
         kget(rtree, rt_tables);          kget(rtree, rt_head);
           kget(rtbl_id_max, rtidxmax);
           kget(af2idx, af2rtafidx);
   
         for (i = 0; i <= AF_MAX; i++) {          for (i = 0; i <= AF_MAX; i++) {
                 if ((rnh = rt_tables[i]) == 0)                  if (af2rtafidx[i] > idxmax)
                         continue;                          idxmax = af2rtafidx[i];
                 kget(rnh, head);          }
   
           if ((rnt = calloc(rtidxmax + 1, sizeof(struct radix_node_head **))) ==
               NULL)
                   err(1, NULL);
   
           kread((u_long)rt_head, rnt, (rtidxmax + 1) *
               sizeof(struct radix_node_head **));
           kread((u_long)rnt[0], rt_tables, (idxmax + 1) * sizeof(rnh));
   
           for (i = 0; i <= AF_MAX; i++) {
                 if (i == AF_UNSPEC) {                  if (i == AF_UNSPEC) {
                         if (Aflag && (af == 0 || af == 0xff)) {                          if (Aflag && (af == AF_UNSPEC || af == 0xff)) {
                                   kget(mtree, rnh);
                                   kget(rnh, head);
                                 printf("Netmasks:\n");                                  printf("Netmasks:\n");
                                 p_tree(head.rnh_treetop);                                  p_tree(head.rnh_treetop);
                         }                          }
                 } else if (af == AF_UNSPEC || af == i) {                          continue;
                   }
                   if (af2rtafidx[i] == 0)
                           /* no table for this AF */
                           continue;
                   if ((rnh = rt_tables[af2rtafidx[i]]) == 0)
                           continue;
                   kget(rnh, head);
                   if (af == AF_UNSPEC || af == i) {
                         pr_family(i);                          pr_family(i);
                         do_rtent = 1;                          do_rtent = 1;
                         pr_rthdr(i, Aflag);                          pr_rthdr(i, Aflag);

Legend:
Removed from v.1.72  
changed lines
  Added in v.1.73