The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netipx/spx_debug.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 1984, 1985, 1986, 1987, 1993
    3  *      The Regents of the University of California.  All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  * 4. Neither the name of the University nor the names of its contributors
   14  *    may be used to endorse or promote products derived from this software
   15  *    without specific prior written permission.
   16  *
   17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   27  * SUCH DAMAGE.
   28  *
   29  * Copyright (c) 1995, Mike Mitchell
   30  *
   31  * Redistribution and use in source and binary forms, with or without
   32  * modification, are permitted provided that the following conditions
   33  * are met:
   34  * 1. Redistributions of source code must retain the above copyright
   35  *    notice, this list of conditions and the following disclaimer.
   36  * 2. Redistributions in binary form must reproduce the above copyright
   37  *    notice, this list of conditions and the following disclaimer in the
   38  *    documentation and/or other materials provided with the distribution.
   39  * 3. All advertising materials mentioning features or use of this software
   40  *    must display the following acknowledgement:
   41  *      This product includes software developed by the University of
   42  *      California, Berkeley and its contributors.
   43  * 4. Neither the name of the University nor the names of its contributors
   44  *    may be used to endorse or promote products derived from this software
   45  *    without specific prior written permission.
   46  *
   47  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   48  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   49  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   50  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   51  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   52  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   53  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   54  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   55  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   56  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   57  * SUCH DAMAGE.
   58  *
   59  *      @(#)spx_debug.c
   60  */
   61 
   62 #include <sys/cdefs.h>
   63 __FBSDID("$FreeBSD: releng/9.0/sys/netipx/spx_debug.c 193892 2009-06-10 09:28:50Z bz $");
   64 
   65 #include "opt_inet.h"
   66 #include "opt_tcpdebug.h"
   67 
   68 #include <sys/param.h>
   69 #include <sys/systm.h>
   70 #include <sys/protosw.h>
   71 
   72 #define TCPSTATES               /* for logging */
   73 
   74 #include <netinet/in_systm.h>
   75 #include <netinet/tcp_fsm.h>
   76 
   77 #include <netipx/ipx.h>
   78 #include <netipx/ipx_var.h>
   79 #include <netipx/spx.h>
   80 #define SPXTIMERS
   81 #include <netipx/spx_timer.h>
   82 #define SANAMES
   83 #include <netipx/spx_debug.h>
   84 
   85 #ifdef INET
   86 #ifdef TCPDEBUG
   87 static  int spxconsdebug = 0;
   88 static  struct spx_debug spx_debug[SPX_NDEBUG];
   89 static  int spx_debx;
   90 #endif
   91 #endif
   92 
   93 /*
   94  * spx debug routines
   95  */
   96 void
   97 spx_trace(short act, u_char ostate, struct spxpcb *sp, struct spx *si,
   98     int req)
   99 {
  100 #ifdef INET
  101 #ifdef TCPDEBUG
  102         u_short seq, ack, len, alo;
  103         int flags;
  104         struct spx_debug *sd = &spx_debug[spx_debx++];
  105 
  106         if (spx_debx == SPX_NDEBUG)
  107                 spx_debx = 0;
  108         sd->sd_time = iptime();
  109         sd->sd_act = act;
  110         sd->sd_ostate = ostate;
  111         sd->sd_cb = (caddr_t)sp;
  112         if (sp != NULL)
  113                 sd->sd_sp = *sp;
  114         else
  115                 bzero((caddr_t)&sd->sd_sp, sizeof(*sp));
  116         if (si != NULL)
  117                 sd->sd_si = *si;
  118         else
  119                 bzero((caddr_t)&sd->sd_si, sizeof(*si));
  120         sd->sd_req = req;
  121         if (spxconsdebug == 0)
  122                 return;
  123         if (ostate >= TCP_NSTATES)
  124                 ostate = 0;
  125         if (act >= SA_DROP)
  126                 act = SA_DROP;
  127         if (sp != NULL)
  128                 printf("%p %s:", (void *)sp, tcpstates[ostate]);
  129         else
  130                 printf("???????? ");
  131         printf("%s ", spxnames[act]);
  132         switch (act) {
  133 
  134         case SA_RESPOND:
  135         case SA_INPUT:
  136         case SA_OUTPUT:
  137         case SA_DROP:
  138                 if (si == NULL)
  139                         break;
  140                 seq = si->si_seq;
  141                 ack = si->si_ack;
  142                 alo = si->si_alo;
  143                 len = si->si_len;
  144                 if (act == SA_OUTPUT) {
  145                         seq = ntohs(seq);
  146                         ack = ntohs(ack);
  147                         alo = ntohs(alo);
  148                         len = ntohs(len);
  149                 }
  150 #ifndef lint
  151 #define p1(f)  { printf("%s = %x, ", "f", f); }
  152                 p1(seq); p1(ack); p1(alo); p1(len);
  153 #endif
  154                 flags = si->si_cc;
  155                 if (flags) {
  156                         char *cp = "<";
  157 #ifndef lint
  158 #define pf(f) { if (flags & SPX_ ## f) { printf("%s%s", cp, "f"); cp = ","; } }
  159                         pf(SP); pf(SA); pf(OB); pf(EM);
  160 #else
  161                         cp = cp;
  162 #endif
  163                         printf(">");
  164                 }
  165 #ifndef lint
  166 #define p2(f)  { printf("%s = %x, ", "f", si->si_ ## f); }
  167                 p2(sid);p2(did);p2(dt);p2(pt);
  168 #endif
  169                 ipx_printhost(&si->si_sna);
  170                 ipx_printhost(&si->si_dna);
  171 
  172                 if (act == SA_RESPOND) {
  173                         printf("ipx_len = %x, ",
  174                                 ((struct ipx *)si)->ipx_len);
  175                 }
  176                 break;
  177 
  178         case SA_USER:
  179                 printf("%s", prurequests[req&0xff]);
  180                 if ((req & 0xff) == PRU_SLOWTIMO)
  181                         printf("<%s>", spxtimers[req>>8]);
  182                 break;
  183         }
  184         if (sp)
  185                 printf(" -> %s", tcpstates[sp->s_state]);
  186         /* print out internal state of sp !?! */
  187         printf("\n");
  188         if (sp == 0)
  189                 return;
  190 #ifndef lint
  191 #define p3(f)  { printf("%s = %x, ", "f", sp->s_ ## f); }
  192         printf("\t"); p3(rack);p3(ralo);p3(smax);p3(flags); printf("\n");
  193 #endif
  194 #endif
  195 #endif
  196 }

Cache object: c05b37341b403ccc6a374428e60acc9b


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.