2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2010 Bjoern A. Zeeb <bz@FreeBSD.org>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #include <sys/cdefs.h>
30 __FBSDID("$FreeBSD$");
34 #include <sys/param.h>
35 #include <sys/systm.h>
36 #include <sys/socket.h>
43 #include <net/if_var.h>
45 #include <netinet/in.h>
46 #include <netinet/in_var.h>
50 in_show_sockaddr_in(struct sockaddr_in *sin)
53 #define SIN_DB_RPINTF(f, e) db_printf("\t %s = " f "\n", #e, sin->e);
54 db_printf("\tsockaddr_in = %p\n", sin);
55 SIN_DB_RPINTF("%u", sin_len);
56 SIN_DB_RPINTF("%u", sin_family);
57 SIN_DB_RPINTF("%u", sin_port);
58 SIN_DB_RPINTF("0x%08x", sin_addr.s_addr);
59 db_printf("\t %s = %02x%02x%02x%02x%02x%02x%02x%02x\n",
61 sin->sin_zero[0], sin->sin_zero[1],
62 sin->sin_zero[2], sin->sin_zero[3],
63 sin->sin_zero[4], sin->sin_zero[5],
64 sin->sin_zero[6], sin->sin_zero[7]);
68 DB_SHOW_COMMAND(sin, db_show_sin)
70 struct sockaddr_in *sin;
72 sin = (struct sockaddr_in *)addr;
74 /* usage: No need to confess if you didn't sin. */
75 db_printf("usage: show sin <struct sockaddr_in *>\n");
79 in_show_sockaddr_in(sin);
83 in_show_in_ifaddr(struct in_ifaddr *ia)
86 #define IA_DB_RPINTF(f, e) db_printf("\t %s = " f "\n", #e, ia->e);
87 #define IA_DB_RPINTF_PTR(f, e) db_printf("\t %s = " f "\n", #e, &ia->e);
88 #define IA_DB_RPINTF_DPTR(f, e) db_printf("\t *%s = " f "\n", #e, *ia->e);
89 db_printf("\tin_ifaddr = %p\n", ia);
90 IA_DB_RPINTF_PTR("%p", ia_ifa);
91 IA_DB_RPINTF("0x%08lx", ia_subnet);
92 IA_DB_RPINTF("0x%08lx", ia_subnetmask);
93 IA_DB_RPINTF("%p", ia_hash.le_next);
94 IA_DB_RPINTF("%p", ia_hash.le_prev);
95 IA_DB_RPINTF_DPTR("%p", ia_hash.le_prev);
96 IA_DB_RPINTF("%p", ia_link.cstqe_next);
97 IA_DB_RPINTF_PTR("%p", ia_addr);
98 IA_DB_RPINTF_PTR("%p", ia_dstaddr);
99 IA_DB_RPINTF_PTR("%p", ia_sockmask);
100 #undef IA_DB_RPINTF_DPTR
101 #undef IA_DB_RPINTF_PTR
105 DB_SHOW_COMMAND(in_ifaddr, db_show_in_ifaddr)
107 struct in_ifaddr *ia;
109 ia = (struct in_ifaddr *)addr;
111 db_printf("usage: show in_ifaddr <struct in_ifaddr *>\n");
115 in_show_in_ifaddr(ia);