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.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
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]
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 #include <sys/types.h>
29 #include <sys/socket.h>
30 #include <sys/ethernet.h>
35 uchar_t cb_protid
[2]; /* Protocol Identifier */
36 uchar_t cb_protvers
; /* Protocol Version Identifier */
37 uchar_t cb_type
; /* BPDU Type */
38 uchar_t cb_flags
; /* BPDU Flags */
39 uchar_t cb_rootid
[8]; /* Root Identifier */
40 uchar_t cb_rootcost
[4]; /* Root Path Cost */
41 uchar_t cb_bridgeid
[8]; /* Bridge Identifier */
42 uchar_t cb_portid
[2]; /* Port Identifier */
43 uchar_t cb_messageage
[2]; /* Message Age */
44 uchar_t cb_maxage
[2]; /* Max Age */
45 uchar_t cb_hello
[2]; /* Hello Time */
46 uchar_t cb_fwddelay
[2]; /* Forward Delay */
49 #define BPDU_TYPE_CONF 0
50 #define BPDU_TYPE_RCONF 2
51 #define BPDU_TYPE_TCNOTIF 0x80
54 interpret_bpdu(int flags
, char *data
, int dlen
)
60 (void) snprintf(get_sum_line(), MAXLINE
,
61 "BPDU (short packet)");
65 cb
= (struct conf_bpdu
*)data
;
68 (void) snprintf(get_sum_line(), MAXLINE
,
69 "Bridge PDU T:%d L:%d", cb
->cb_type
, dlen
);
72 if (flags
& F_DTAIL
) {
73 show_header("Bridge-PDU: ",
74 "Bridge PDU Frame", dlen
);
76 switch (cb
->cb_type
) {
78 pdutype
= "Configuration";
81 pdutype
= "Rapid Configuration";
83 case BPDU_TYPE_TCNOTIF
:
84 pdutype
= "TC Notification";
90 (void) snprintf(get_line(0, 0), get_line_remain(),
91 "PDU type = %d (%s)", cb
->cb_type
, pdutype
);