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

Diff for /src/usr.bin/netstat/show.c between version 1.9 and 1.10

version 1.9, 2007/07/24 20:36:34 version 1.10, 2007/07/25 11:50:47
Line 95 
Line 95 
         { 0 }          { 0 }
 };  };
   
 void     pr_rthdr(int, int);  
 void     p_rtentry(struct rt_msghdr *);  void     p_rtentry(struct rt_msghdr *);
 void     p_pfkentry(struct sadb_msg *);  void     p_pfkentry(struct sadb_msg *);
 void     pr_family(int);  void     pr_family(int);
Line 112 
Line 111 
  * Print routing tables.   * Print routing tables.
  */   */
 void  void
 p_rttables(int af)  p_rttables(int af, u_int tableid)
 {  {
         struct rt_msghdr *rtm;          struct rt_msghdr *rtm;
         struct sadb_msg *msg;          struct sadb_msg *msg;
         char *buf = NULL, *next, *lim = NULL;          char *buf = NULL, *next, *lim = NULL;
         size_t needed;          size_t needed;
         int mib[6];          int mib[7];
         struct sockaddr *sa;          struct sockaddr *sa;
   
         mib[0] = CTL_NET;          mib[0] = CTL_NET;
Line 127 
Line 126 
         mib[3] = af;          mib[3] = af;
         mib[4] = NET_RT_DUMP;          mib[4] = NET_RT_DUMP;
         mib[5] = 0;          mib[5] = 0;
         if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)          mib[6] = tableid;
   
           if (sysctl(mib, 7, NULL, &needed, NULL, 0) < 0)
                 err(1, "route-sysctl-estimate");                  err(1, "route-sysctl-estimate");
         if (needed > 0) {          if (needed > 0) {
                 if ((buf = malloc(needed)) == 0)                  if ((buf = malloc(needed)) == 0)
                         err(1, NULL);                          err(1, NULL);
                 if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0)                  if (sysctl(mib, 7, buf, &needed, NULL, 0) < 0)
                         err(1, "sysctl of routing table");                          err(1, "sysctl of routing table");
                 lim = buf + needed;                  lim = buf + needed;
         }          }

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10