1*4eaa4710SRishi Srivatsavai /*
2*4eaa4710SRishi Srivatsavai * CDDL HEADER START
3*4eaa4710SRishi Srivatsavai *
4*4eaa4710SRishi Srivatsavai * The contents of this file are subject to the terms of the
5*4eaa4710SRishi Srivatsavai * Common Development and Distribution License (the "License").
6*4eaa4710SRishi Srivatsavai * You may not use this file except in compliance with the License.
7*4eaa4710SRishi Srivatsavai *
8*4eaa4710SRishi Srivatsavai * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*4eaa4710SRishi Srivatsavai * or http://www.opensolaris.org/os/licensing.
10*4eaa4710SRishi Srivatsavai * See the License for the specific language governing permissions
11*4eaa4710SRishi Srivatsavai * and limitations under the License.
12*4eaa4710SRishi Srivatsavai *
13*4eaa4710SRishi Srivatsavai * When distributing Covered Code, include this CDDL HEADER in each
14*4eaa4710SRishi Srivatsavai * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*4eaa4710SRishi Srivatsavai * If applicable, add the following below this CDDL HEADER, with the
16*4eaa4710SRishi Srivatsavai * fields enclosed by brackets "[]" replaced with your own identifying
17*4eaa4710SRishi Srivatsavai * information: Portions Copyright [yyyy] [name of copyright owner]
18*4eaa4710SRishi Srivatsavai *
19*4eaa4710SRishi Srivatsavai * CDDL HEADER END
20*4eaa4710SRishi Srivatsavai */
21*4eaa4710SRishi Srivatsavai
22*4eaa4710SRishi Srivatsavai /*
23*4eaa4710SRishi Srivatsavai * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24*4eaa4710SRishi Srivatsavai * Use is subject to license terms.
25*4eaa4710SRishi Srivatsavai */
26*4eaa4710SRishi Srivatsavai
27*4eaa4710SRishi Srivatsavai #include <stdio.h>
28*4eaa4710SRishi Srivatsavai #include <sys/types.h>
29*4eaa4710SRishi Srivatsavai #include <sys/socket.h>
30*4eaa4710SRishi Srivatsavai #include <sys/ethernet.h>
31*4eaa4710SRishi Srivatsavai #include <sys/vlan.h>
32*4eaa4710SRishi Srivatsavai #include <net/trill.h>
33*4eaa4710SRishi Srivatsavai
34*4eaa4710SRishi Srivatsavai #include <snoop.h>
35*4eaa4710SRishi Srivatsavai
36*4eaa4710SRishi Srivatsavai #define PDUTYPE_OFFSET 4
37*4eaa4710SRishi Srivatsavai #define PDUTYPE_HELLO1 15
38*4eaa4710SRishi Srivatsavai #define PDUTYPE_HELLO2 16
39*4eaa4710SRishi Srivatsavai #define PDUTYPE_HELLOP2P 17
40*4eaa4710SRishi Srivatsavai #define PDUTYPE_LSP1 18
41*4eaa4710SRishi Srivatsavai #define PDUTYPE_LSP2 20
42*4eaa4710SRishi Srivatsavai #define PDUTYPE_CSN1 24
43*4eaa4710SRishi Srivatsavai #define PDUTYPE_CSN2 25
44*4eaa4710SRishi Srivatsavai #define PDUTYPE_PSN1 26
45*4eaa4710SRishi Srivatsavai #define PDUTYPE_PSN2 27
46*4eaa4710SRishi Srivatsavai
47*4eaa4710SRishi Srivatsavai int
interpret_isis(int flags,char * data,int dlen,boolean_t istrill)48*4eaa4710SRishi Srivatsavai interpret_isis(int flags, char *data, int dlen, boolean_t istrill)
49*4eaa4710SRishi Srivatsavai {
50*4eaa4710SRishi Srivatsavai uint8_t pdutypenum;
51*4eaa4710SRishi Srivatsavai char *pdutype;
52*4eaa4710SRishi Srivatsavai
53*4eaa4710SRishi Srivatsavai pdutypenum = *(data+ PDUTYPE_OFFSET);
54*4eaa4710SRishi Srivatsavai switch (pdutypenum) {
55*4eaa4710SRishi Srivatsavai case PDUTYPE_HELLO1:
56*4eaa4710SRishi Srivatsavai case PDUTYPE_HELLO2:
57*4eaa4710SRishi Srivatsavai pdutype = "Hello";
58*4eaa4710SRishi Srivatsavai break;
59*4eaa4710SRishi Srivatsavai case PDUTYPE_HELLOP2P:
60*4eaa4710SRishi Srivatsavai pdutype = "P2P Hello";
61*4eaa4710SRishi Srivatsavai break;
62*4eaa4710SRishi Srivatsavai case PDUTYPE_LSP1:
63*4eaa4710SRishi Srivatsavai case PDUTYPE_LSP2:
64*4eaa4710SRishi Srivatsavai pdutype = "Link State";
65*4eaa4710SRishi Srivatsavai break;
66*4eaa4710SRishi Srivatsavai case PDUTYPE_CSN1:
67*4eaa4710SRishi Srivatsavai case PDUTYPE_CSN2:
68*4eaa4710SRishi Srivatsavai pdutype = "CSN";
69*4eaa4710SRishi Srivatsavai break;
70*4eaa4710SRishi Srivatsavai case PDUTYPE_PSN1:
71*4eaa4710SRishi Srivatsavai case PDUTYPE_PSN2:
72*4eaa4710SRishi Srivatsavai pdutype = "PSN";
73*4eaa4710SRishi Srivatsavai break;
74*4eaa4710SRishi Srivatsavai default:
75*4eaa4710SRishi Srivatsavai pdutype = "Unknown";
76*4eaa4710SRishi Srivatsavai break;
77*4eaa4710SRishi Srivatsavai }
78*4eaa4710SRishi Srivatsavai
79*4eaa4710SRishi Srivatsavai if (flags & F_SUM) {
80*4eaa4710SRishi Srivatsavai (void) snprintf(get_sum_line(), MAXLINE,
81*4eaa4710SRishi Srivatsavai "%s %s L:%d", istrill ? "Core TRILL IS-IS" : "IS-IS",
82*4eaa4710SRishi Srivatsavai pdutype, dlen);
83*4eaa4710SRishi Srivatsavai }
84*4eaa4710SRishi Srivatsavai
85*4eaa4710SRishi Srivatsavai if (flags & F_DTAIL) {
86*4eaa4710SRishi Srivatsavai if (istrill) {
87*4eaa4710SRishi Srivatsavai show_header("TRILL-IS-IS: ",
88*4eaa4710SRishi Srivatsavai "Core TRILL IS-IS Frame", dlen);
89*4eaa4710SRishi Srivatsavai } else {
90*4eaa4710SRishi Srivatsavai show_header("IS-IS: ",
91*4eaa4710SRishi Srivatsavai "IS-IS Frame", dlen);
92*4eaa4710SRishi Srivatsavai }
93*4eaa4710SRishi Srivatsavai show_space();
94*4eaa4710SRishi Srivatsavai (void) snprintf(get_line(0, 0), get_line_remain(),
95*4eaa4710SRishi Srivatsavai "Frame type = %02X (%s)", pdutypenum, pdutype);
96*4eaa4710SRishi Srivatsavai show_trailer();
97*4eaa4710SRishi Srivatsavai }
98*4eaa4710SRishi Srivatsavai return (0);
99*4eaa4710SRishi Srivatsavai }
100