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[] =
14 "@(#) $Header: /tcpdump/master/tcpdump/print-stp.c,v 1.6.6.1 2002/05/29 10:00:00 guy Exp $";
21 #include <sys/param.h>
23 #include <sys/socket.h>
25 #include <netinet/in.h>
31 #include "interface.h"
32 #include "addrtoname.h"
36 stp_print_bridge_id(const u_char *p)
38 printf("%.2x%.2x.%.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
39 p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
43 stp_print_config_bpdu(const u_char *p, u_int length)
47 printf("TOP_CHANGE ");
49 printf("TOP_CHANGE_ACK ");
51 stp_print_bridge_id(p+20);
52 printf(".%.2x%.2x ", p[28], p[29]);
55 stp_print_bridge_id(p+8);
57 printf(" pathcost %i ", (p[16] << 24) | (p[17] << 16) | (p[18] << 8) | p[19]);
59 printf("age %i ", p[30]);
60 printf("max %i ", p[32]);
61 printf("hello %i ", p[34]);
62 printf("fdelay %i ", p[36]);
66 stp_print_tcn_bpdu(const u_char *p, u_int length)
72 * Print 802.1d packets.
75 stp_print(const u_char *p, u_int length)
81 if (p[2] != 0x03 || p[3] || p[4] || p[5]) {
82 printf("unknown version");
91 stp_print_config_bpdu(p, length);
95 stp_print_tcn_bpdu(p, length);
99 printf("unknown type %i", p[6]);
105 printf("[|stp %d]", length);