Diff for /src/usr.sbin/IPXrouted/trace.c between versions 1.2 and 1.3

version 1.2, 2003/06/17 04:29:52 version 1.3, 2004/03/11 09:38:59
Line 36 Line 36
  * SUCH DAMAGE.   * SUCH DAMAGE.
  *   *
  * $FreeBSD: src/usr.sbin/IPXrouted/trace.c,v 1.6.2.1 2000/07/20 10:35:22 kris Exp $   * $FreeBSD: src/usr.sbin/IPXrouted/trace.c,v 1.6.2.1 2000/07/20 10:35:22 kris Exp $
  * $DragonFly: src/usr.sbin/IPXrouted/trace.c,v 1.1 2003/06/16 07:16:27 dillon Exp $   * $DragonFly$
  *   *
  * @(#)trace.c  8.1 (Berkeley) 6/5/93   * @(#)trace.c  8.1 (Berkeley) 6/5/93
  */   */
Line 65  void dumpif(FILE *fd, struct interface * Line 65  void dumpif(FILE *fd, struct interface *
 void dumptrace(FILE *fd, char *dir, struct ifdebug *ifd);  void dumptrace(FILE *fd, char *dir, struct ifdebug *ifd);
   
 void  void
 traceinit(ifp)  traceinit(struct interface *ifp)
         register struct interface *ifp;  
 {  {
         static int iftraceinit();          static int iftraceinit();
   
Line 78  traceinit(ifp) Line 77  traceinit(ifp)
 }  }
   
 static int  static int
 iftraceinit(ifp, ifd)  iftraceinit(struct interface *ifp, struct ifdebug *ifd)
         struct interface *ifp;  
         register struct ifdebug *ifd;  
 {  {
         register struct iftrace *t;          struct iftrace *t;
   
         ifd->ifd_records =          ifd->ifd_records =
           (struct iftrace *)malloc(NRECORDS * sizeof (struct iftrace));            (struct iftrace *)malloc(NRECORDS * sizeof (struct iftrace));
Line 99  iftraceinit(ifp, ifd) Line 96  iftraceinit(ifp, ifd)
 }  }
   
 void  void
 traceon(file)  traceon(char *file)
         char *file;  
 {  {
   
         if (ftrace != NULL)          if (ftrace != NULL)
Line 125  traceoff(void) Line 121  traceoff(void)
 }  }
   
 void  void
 trace(ifd, who, p, len, m)  trace(struct ifdebug *ifd, struct sockaddr *who, char *p, int len, int m)
         register struct ifdebug *ifd;  
         struct sockaddr *who;  
         char *p;  
         int len, m;  
 {  {
         register struct iftrace *t;          struct iftrace *t;
   
         if (ifd->ifd_records == 0)          if (ifd->ifd_records == 0)
                 return;                  return;
Line 157  trace(ifd, who, p, len, m) Line 149  trace(ifd, who, p, len, m)
 }  }
   
 void  void
 traceaction(fd, action, rt)  traceaction(FILE *fd, char *action, struct rt_entry *rt)
         FILE *fd;  
         char *action;  
         struct rt_entry *rt;  
 {  {
         struct sockaddr_ipx *dst, *gate;          struct sockaddr_ipx *dst, *gate;
         static struct bits {          static struct bits {
Line 178  traceaction(fd, action, rt) Line 167  traceaction(fd, action, rt)
                 { RTS_CHANGED,  "CHANGED" },                  { RTS_CHANGED,  "CHANGED" },
                 { 0 }                  { 0 }
         };          };
         register struct bits *p;          struct bits *p;
         register int first;          int first;
         char *cp;          char *cp;
   
         if (fd == NULL)          if (fd == NULL)
Line 218  traceaction(fd, action, rt) Line 207  traceaction(fd, action, rt)
 }  }
   
 void  void
 traceactionlog(action, rt)  traceactionlog(char *action, struct rt_entry *rt)
         char *action;  
         struct rt_entry *rt;  
 {  {
         struct sockaddr_ipx *dst, *gate;          struct sockaddr_ipx *dst, *gate;
         static struct bits {          static struct bits {
Line 238  traceactionlog(action, rt) Line 225  traceactionlog(action, rt)
                 { RTS_CHANGED,  "CHANGED" },                  { RTS_CHANGED,  "CHANGED" },
                 { 0 }                  { 0 }
         };          };
         register struct bits *p;          struct bits *p;
         register int first;          int first;
         char *cp;          char *cp;
         char *lstr, *olstr;          char *lstr, *olstr;
   
Line 283  traceactionlog(action, rt) Line 270  traceactionlog(action, rt)
 }  }
   
 void  void
 tracesapactionlog(action, sap)  tracesapactionlog(char *action, struct sap_entry *sap)
         char *action;  
         struct sap_entry *sap;  
 {  {
         syslog(LOG_DEBUG, "%-12.12s  service %04X %-20.20s "          syslog(LOG_DEBUG, "%-12.12s  service %04X %-20.20s "
                     "addr %s.%04X %c metric %d\n",                      "addr %s.%04X %c metric %d\n",
Line 299  tracesapactionlog(action, sap) Line 284  tracesapactionlog(action, sap)
 }  }
   
 void  void
 dumpif(fd, ifp)  dumpif(FILE *fd, struct interface *ifp)
         register struct interface *ifp;  
         FILE *fd;  
 {  {
         if (ifp->int_input.ifd_count || ifp->int_output.ifd_count) {          if (ifp->int_input.ifd_count || ifp->int_output.ifd_count) {
                 fprintf(fd, "*** Packet history for interface %s ***\n",                  fprintf(fd, "*** Packet history for interface %s ***\n",
Line 313  dumpif(fd, ifp) Line 296  dumpif(fd, ifp)
 }  }
   
 void  void
 dumptrace(fd, dir, ifd)  dumptrace(FILE *fd, char *dir, struct ifdebug *ifd)
         FILE *fd;  
         char *dir;  
         register struct ifdebug *ifd;  
 {  {
         register struct iftrace *t;          struct iftrace *t;
         char *cp = !strcmp(dir, "to") ? "Output" : "Input";          char *cp;
   
           cp = !strcmp(dir, "to") ? "Output" : "Input";
         if (ifd->ifd_front == ifd->ifd_records &&          if (ifd->ifd_front == ifd->ifd_records &&
             ifd->ifd_front->ift_size == 0) {              ifd->ifd_front->ift_size == 0) {
                 fprintf(fd, "%s: no packets.\n", cp);                  fprintf(fd, "%s: no packets.\n", cp);
Line 342  dumptrace(fd, dir, ifd) Line 323  dumptrace(fd, dir, ifd)
 }  }
   
 void  void
 dumppacket(fd, dir, source, cp, size)  dumppacket(FILE *fd, char *dir, struct sockaddr *source, char *cp, int size)
         FILE *fd;  
         char *dir;  
         struct sockaddr *source;  
         char *cp;  
         register int size;  
 {  {
         register struct rip *msg = (struct rip *)cp;          struct rip *msg = (struct rip *)cp;
         register struct netinfo *n;          struct netinfo *n;
         struct sockaddr_ipx *who = (struct sockaddr_ipx *)source;          struct sockaddr_ipx *who = (struct sockaddr_ipx *)source;
   
         if (msg->rip_cmd && ntohs(msg->rip_cmd) < RIPCMD_MAX)          if (msg->rip_cmd && ntohs(msg->rip_cmd) < RIPCMD_MAX)
Line 386  dumppacket(fd, dir, source, cp, size) Line 362  dumppacket(fd, dir, source, cp, size)
 }  }
   
 void  void
 dumpsappacket(fd, dir, source, cp, size)  dumpsappacket(FILE *fd, char *dir, struct sockaddr *source, char *cp, int size)
         FILE *fd;  
         char *dir;  
         struct sockaddr *source;  
         char *cp;  
         register int size;  
 {  {
         register struct sap_packet *msg = (struct sap_packet *)cp;          struct sap_packet *msg = (struct sap_packet *)cp;
         register struct sap_info *n;          struct sap_info *n;
         struct sockaddr_ipx *who = (struct sockaddr_ipx *)source;          struct sockaddr_ipx *who = (struct sockaddr_ipx *)source;
   
         if (msg->sap_cmd && ntohs(msg->sap_cmd) < SAPCMD_MAX)          if (msg->sap_cmd && ntohs(msg->sap_cmd) < SAPCMD_MAX)
Line 435  dumpsappacket(fd, dir, source, cp, size) Line 406  dumpsappacket(fd, dir, source, cp, size)
 }  }
   
 void  void
 dumpsaptable(fd, sh)  dumpsaptable(FILE *fd, struct sap_hash *sh)
         FILE *fd;  
         struct sap_hash *sh;  
 {  {
         register struct sap_entry *sap;          struct sap_entry *sap;
         struct sap_hash *hash;          struct sap_hash *hash;
         int x = 0;          int x = 0;
   
Line 462  dumpsaptable(fd, sh) Line 431  dumpsaptable(fd, sh)
 }  }
   
 void  void
 dumpriptable(fd)  dumpriptable(FILE *fd)
         FILE *fd;  
 {  {
         register struct rt_entry *rip;          struct rt_entry *rip;
         struct rthash *hash;          struct rthash *hash;
         int x;          int x;
         struct rthash *rh = nethash;          struct rthash *rh = nethash;
Line 492  dumpriptable(fd) Line 460  dumpriptable(fd)
 union ipx_net_u net;  union ipx_net_u net;
   
 char *  char *
 ipxdp_nettoa(val)  ipxdp_nettoa(union ipx_net val)
 union ipx_net val;  
 {  {
         static char buf[100];          static char buf[100];
           
         net.net_e = val;          net.net_e = val;
         (void)sprintf(buf, "%lx", ntohl(net.long_e));          (void)sprintf(buf, "%lx", ntohl(net.long_e));
         return (buf);          return (buf);
Line 503  union ipx_net val; Line 471  union ipx_net val;
   
   
 char *  char *
 ipxdp_ntoa(addr)  ipxdp_ntoa(struct ipx_addr *addr)
 struct ipx_addr *addr;  
 {  {
     static char buf[100];      static char buf[100];
   

Removed from v.1.2  
changed lines
  Added in v.1.3