neti.c (381a2a9a) neti.c (f4b3ec61)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 5 unchanged lines hidden (view full) ---

14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 5 unchanged lines hidden (view full) ---

14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26#pragma ident "%Z%%M% %I% %E% SMI"
27
28#include <sys/types.h>
29#include <sys/rwlock.h>
30#include <mdb/mdb_modapi.h>
31#include <sys/queue.h>
32#include <sys/neti.h>
33
34
35/*
36 * PROT_LENGTH is the max length. If the true length is bigger
37 * it is truncated.
38 */
39#define PROT_LENGTH 32
40
23 * Use is subject to license terms.
24 */
25
26#pragma ident "%Z%%M% %I% %E% SMI"
27
28#include <sys/types.h>
29#include <sys/rwlock.h>
30#include <mdb/mdb_modapi.h>
31#include <sys/queue.h>
32#include <sys/neti.h>
33
34
35/*
36 * PROT_LENGTH is the max length. If the true length is bigger
37 * it is truncated.
38 */
39#define PROT_LENGTH 32
40
41LIST_HEAD(netd_listhead, net_data);
42
43/*
44 * List pfhooks netinfo information.
45 */
46/*ARGSUSED*/
47int
48netinfolist(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
49{
41/*
42 * List pfhooks netinfo information.
43 */
44/*ARGSUSED*/
45int
46netinfolist(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
47{
48 struct neti_stack *nts;
50 struct netd_listhead nlh;
51 struct net_data nd, *p;
52 char str[PROT_LENGTH];
53
54 if (argc)
55 return (DCMD_USAGE);
56
49 struct netd_listhead nlh;
50 struct net_data nd, *p;
51 char str[PROT_LENGTH];
52
53 if (argc)
54 return (DCMD_USAGE);
55
57 if (mdb_readvar(&nlh, "netd_head") == -1) {
58 mdb_warn("couldn't read symbol 'netd_head'");
56 if (mdb_vread((void *)&nts, sizeof (nts),
57 (uintptr_t)(addr + OFFSETOF(netstack_t, netstack_neti))) == -1) {
58 mdb_warn("couldn't read netstack_neti");
59 return (DCMD_ERR);
60 }
59 return (DCMD_ERR);
60 }
61
62 if (mdb_vread((void *)&nlh, sizeof (nlh), (uintptr_t)((uintptr_t)nts +
63 OFFSETOF(neti_stack_t, nts_netd_head))) == -1) {
64 mdb_warn("couldn't read netd list head");
65 return (DCMD_ERR);
66 }
61 mdb_printf("%<u>%?s %?s %10s%</u>\n",
62 "ADDR(netinfo)", "ADDR(hookevent)", "netinfo");
63 p = LIST_FIRST(&nlh);
64 while (p) {
65 if (mdb_vread((void *)&nd, sizeof (nd), (uintptr_t)p) == -1) {
66 mdb_warn("couldn't read netinfo at %p", p);
67 return (DCMD_ERR);
68 }

--- 35 unchanged lines hidden ---
67 mdb_printf("%<u>%?s %?s %10s%</u>\n",
68 "ADDR(netinfo)", "ADDR(hookevent)", "netinfo");
69 p = LIST_FIRST(&nlh);
70 while (p) {
71 if (mdb_vread((void *)&nd, sizeof (nd), (uintptr_t)p) == -1) {
72 mdb_warn("couldn't read netinfo at %p", p);
73 return (DCMD_ERR);
74 }

--- 35 unchanged lines hidden ---