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/netns/spp_debug.c

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

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

Cache object: fffbe687168f0eb8bcfe5a89932bb6f0


[ 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.