2 * Copyright (c) 2000 Lennert Buytenhek
4 * This software may be distributed either under the terms of the
5 * BSD-style license that accompanies tcpdump or the GNU General
8 * Format and print IEEE 802.1d spanning tree protocol packets.
9 * Contributed by Lennert Buytenhek <buytenh@gnu.org>
13 static const char rcsid
[] _U_
=
14 "@(#) $Header: /tcpdump/master/tcpdump/print-stp.c,v 1.13.2.1 2005/04/26 07:27:17 guy Exp $";
21 #include <tcpdump-stdinc.h>
27 #include "interface.h"
28 #include "addrtoname.h"
32 stp_print_bridge_id(const u_char
*p
)
34 printf("%.2x%.2x.%.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
35 p
[0], p
[1], p
[2], p
[3], p
[4], p
[5], p
[6], p
[7]);
39 stp_print_config_bpdu(const u_char
*p
)
43 printf("TOP_CHANGE ");
45 printf("TOP_CHANGE_ACK ");
47 stp_print_bridge_id(p
+17);
48 printf(".%.2x%.2x ", p
[25], p
[26]);
51 stp_print_bridge_id(p
+5);
53 printf(" pathcost %i ", (p
[13] << 24) | (p
[14] << 16) | (p
[15] << 8) | p
[16]);
55 printf("age %i ", p
[27]);
56 printf("max %i ", p
[29]);
57 printf("hello %i ", p
[31]);
58 printf("fdelay %i ", p
[33]);
62 stp_print_tcn_bpdu(void)
68 * Print 802.1d packets.
71 stp_print(const u_char
*p
, u_int length
)
77 if (p
[0] || p
[1] || p
[2]) {
78 printf("unknown version");
87 stp_print_config_bpdu(p
);
95 printf("unknown type %i", p
[3]);
101 printf("[|stp %d]", length
);