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/netinet/in_debug.c

Version: -  FREEBSD  -  FREEBSD11  -  FREEBSD10  -  FREEBSD9  -  FREEBSD92  -  FREEBSD91  -  FREEBSD90  -  FREEBSD8  -  FREEBSD82  -  FREEBSD81  -  FREEBSD80  -  FREEBSD7  -  FREEBSD74  -  FREEBSD73  -  FREEBSD72  -  FREEBSD71  -  FREEBSD70  -  FREEBSD6  -  FREEBSD64  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  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 /*-
    2  * Copyright (c) 2010 Bjoern A. Zeeb <bz@FreeBSD.org>
    3  * 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  *
   14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   17  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   24  * SUCH DAMAGE.
   25  */
   26 
   27 #include <sys/cdefs.h>
   28 __FBSDID("$FreeBSD: stable/7/sys/netinet/in_debug.c 214557 2010-10-30 16:02:16Z bz $");
   29 
   30 #include "opt_ddb.h"
   31 
   32 #include <sys/param.h>
   33 #include <sys/kernel.h>
   34 #include <sys/systm.h>
   35 #include <sys/socket.h>
   36 
   37 #ifdef DDB
   38 #include <ddb/ddb.h>
   39 #endif
   40 
   41 #include <net/if.h>
   42 #include <net/if_var.h>
   43 
   44 #include <netinet/in.h>
   45 #include <netinet/in_var.h>
   46 
   47 #ifdef DDB
   48 static void
   49 in_show_sockaddr_in(struct sockaddr_in *sin)
   50 {
   51 
   52 #define SIN_DB_RPINTF(f, e)     db_printf("\t   %s = " f "\n", #e, sin->e);
   53         db_printf("\tsockaddr_in = %p\n", sin);
   54         SIN_DB_RPINTF("%u", sin_len);
   55         SIN_DB_RPINTF("%u", sin_family);
   56         SIN_DB_RPINTF("%u", sin_port);
   57         SIN_DB_RPINTF("0x%08x", sin_addr.s_addr);
   58         db_printf("\t   %s = %02x%02x%02x%02x%02x%02x%02x%02x\n",
   59             "sin_zero[8]",
   60             sin->sin_zero[0], sin->sin_zero[1],
   61             sin->sin_zero[2], sin->sin_zero[3],
   62             sin->sin_zero[4], sin->sin_zero[5],
   63             sin->sin_zero[6], sin->sin_zero[7]);
   64 #undef SIN_DB_RPINTF
   65 }
   66 
   67 DB_SHOW_COMMAND(sin, db_show_sin)
   68 {
   69         struct sockaddr_in *sin;
   70 
   71         sin = (struct sockaddr_in *)addr;
   72         if (sin == NULL) {
   73                 /* usage: No need to confess if you didn't sin. */
   74                 db_printf("usage: show sin <struct sockaddr_in *>\n");
   75                 return;
   76         }
   77 
   78         in_show_sockaddr_in(sin);
   79 }
   80 
   81 static void
   82 in_show_in_ifaddr(struct in_ifaddr *ia)
   83 {
   84 
   85 #define IA_DB_RPINTF(f, e)      db_printf("\t   %s = " f "\n", #e, ia->e);
   86 #define IA_DB_RPINTF_PTR(f, e)  db_printf("\t   %s = " f "\n", #e, &ia->e);
   87 #define IA_DB_RPINTF_DPTR(f, e) db_printf("\t  *%s = " f "\n", #e, *ia->e);
   88         db_printf("\tin_ifaddr = %p\n", ia);
   89         IA_DB_RPINTF_PTR("%p", ia_ifa);
   90         IA_DB_RPINTF("0x%08lx", ia_net);
   91         IA_DB_RPINTF("0x%08lx", ia_netmask);
   92         IA_DB_RPINTF("0x%08lx", ia_subnet);
   93         IA_DB_RPINTF("0x%08lx", ia_subnetmask);
   94         IA_DB_RPINTF("0x%08x", ia_netbroadcast.s_addr);
   95         IA_DB_RPINTF("%p", ia_hash.le_next);
   96         IA_DB_RPINTF("%p", ia_hash.le_prev);
   97         IA_DB_RPINTF_DPTR("%p", ia_hash.le_prev);
   98         IA_DB_RPINTF("%p", ia_link.tqe_next);
   99         IA_DB_RPINTF("%p", ia_link.tqe_prev);
  100         IA_DB_RPINTF_DPTR("%p", ia_link.tqe_prev);
  101         IA_DB_RPINTF_PTR("%p", ia_addr);
  102         IA_DB_RPINTF_PTR("%p", ia_dstaddr);
  103         IA_DB_RPINTF_PTR("%p", ia_sockmask);
  104 #undef IA_DB_RPINTF_DPTR
  105 #undef IA_DB_RPINTF_PTR
  106 #undef IA_DB_RPINTF
  107 }
  108 
  109 DB_SHOW_COMMAND(in_ifaddr, db_show_in_ifaddr)
  110 {
  111         struct in_ifaddr *ia;
  112 
  113         ia = (struct in_ifaddr *)addr;
  114         if (ia == NULL) {
  115                 db_printf("usage: show in_ifaddr <struct in_ifaddr *>\n");
  116                 return;
  117         }
  118 
  119         in_show_in_ifaddr(ia);
  120 }
  121 #endif

Cache object: 16bd8273709e46fe31e9e19f06bc42e2


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