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-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  * 3. All advertising materials mentioning features or use of this software
   14  *    must display the following acknowledgement:
   15  *      This product includes software developed by the University of
   16  *      California, Berkeley and its contributors.
   17  * 4. Neither the name of the University nor the names of its contributors
   18  *    may be used to endorse or promote products derived from this software
   19  *    without specific prior written permission.
   20  *
   21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   31  * SUCH DAMAGE.
   32  *
   33  *      @(#)spp_debug.c 8.1 (Berkeley) 6/10/93
   34  * $FreeBSD$
   35  */
   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 int     sppconsdebug = 0;
   64 /*
   65  * spp debug routines
   66  */
   67 spp_trace(act, ostate, sp, si, req)
   68         short act;
   69         u_char ostate;
   70         struct sppcb *sp;
   71         struct spidp *si;
   72         int req;
   73 {
   74 #ifdef INET
   75 #ifdef TCPDEBUG
   76         u_short seq, ack, len, alo;
   77         unsigned long iptime();
   78         int flags;
   79         struct spp_debug *sd = &spp_debug[spp_debx++];
   80         extern char *prurequests[];
   81         extern char *sanames[];
   82         extern char *tcpstates[];
   83         extern char *spptimers[];
   84 
   85         if (spp_debx == SPP_NDEBUG)
   86                 spp_debx = 0;
   87         sd->sd_time = iptime();
   88         sd->sd_act = act;
   89         sd->sd_ostate = ostate;
   90         sd->sd_cb = (caddr_t)sp;
   91         if (sp)
   92                 sd->sd_sp = *sp;
   93         else
   94                 bzero((caddr_t)&sd->sd_sp, sizeof (*sp));
   95         if (si)
   96                 sd->sd_si = *si;
   97         else
   98                 bzero((caddr_t)&sd->sd_si, sizeof (*si));
   99         sd->sd_req = req;
  100         if (sppconsdebug == 0)
  101                 return;
  102         if (ostate >= TCP_NSTATES) ostate = 0;
  103         if (act >= SA_DROP) act = SA_DROP;
  104         if (sp)
  105                 printf("%x %s:", sp, tcpstates[ostate]);
  106         else
  107                 printf("???????? ");
  108         printf("%s ", sanames[act]);
  109         switch (act) {
  110 
  111         case SA_RESPOND:
  112         case SA_INPUT:
  113         case SA_OUTPUT:
  114         case SA_DROP:
  115                 if (si == 0)
  116                         break;
  117                 seq = si->si_seq;
  118                 ack = si->si_ack;
  119                 alo = si->si_alo;
  120                 len = si->si_len;
  121                 if (act == SA_OUTPUT) {
  122                         seq = ntohs(seq);
  123                         ack = ntohs(ack);
  124                         alo = ntohs(alo);
  125                         len = ntohs(len);
  126                 }
  127 #ifndef lint
  128 #define p1(f)  { printf("%s = %x, ", "f", f); }
  129                 p1(seq); p1(ack); p1(alo); p1(len);
  130 #endif
  131                 flags = si->si_cc;
  132                 if (flags) {
  133                         char *cp = "<";
  134 #ifndef lint
  135 #define pf(f) { if (flags&SP_/**/f) { printf("%s%s", cp, "f"); cp = ","; } }
  136                         pf(SP); pf(SA); pf(OB); pf(EM);
  137 #else
  138                         cp = cp;
  139 #endif
  140                         printf(">");
  141                 }
  142 #ifndef lint
  143 #define p2(f)  { printf("%s = %x, ", "f", si->si_/**/f); }
  144                 p2(sid);p2(did);p2(dt);p2(pt);
  145 #endif
  146                 ns_printhost(&si->si_sna);
  147                 ns_printhost(&si->si_dna);
  148 
  149                 if (act==SA_RESPOND) {
  150                         printf("idp_len = %x, ",
  151                                 ((struct idp *)si)->idp_len);
  152                 }
  153                 break;
  154 
  155         case SA_USER:
  156                 printf("%s", prurequests[req&0xff]);
  157                 if ((req & 0xff) == PRU_SLOWTIMO)
  158                         printf("<%s>", spptimers[req>>8]);
  159                 break;
  160         }
  161         if (sp)
  162                 printf(" -> %s", tcpstates[sp->s_state]);
  163         /* print out internal state of sp !?! */
  164         printf("\n");
  165         if (sp == 0)
  166                 return;
  167 #ifndef lint
  168 #define p3(f)  { printf("%s = %x, ", "f", sp->s_/**/f); }
  169         printf("\t"); p3(rack);p3(ralo);p3(smax);p3(flags); printf("\n");
  170 #endif
  171 #endif
  172 #endif
  173 }

Cache object: 2d6ca5be817b1a2642b87d2241c04762


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