]>
Commit | Line | Data |
---|---|---|
0a3fc2a5 DL |
1 | /* |
2 | * OSPFd dump routine (parts used by ospfclient). | |
3 | * Copyright (C) 1999, 2000 Toshiaki Takada | |
4 | * | |
447a8fe9 | 5 | * This file is part of FRRouting (FRR). |
0a3fc2a5 DL |
6 | * |
7 | * FRR is free software; you can redistribute it and/or modify it under the | |
8 | * terms of the GNU General Public License as published by the Free Software | |
9 | * Foundation; either version 2, or (at your option) any later version. | |
10 | * | |
11 | * FRR is distributed in the hope that it will be useful, but WITHOUT ANY | |
12 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
14 | * details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License along | |
17 | * with FRR; see the file COPYING. If not, write to the Free Software | |
18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
19 | */ | |
20 | ||
21 | #include <zebra.h> | |
22 | ||
23 | #include "log.h" | |
24 | #include "prefix.h" | |
25 | ||
26 | #include "ospf_dump_api.h" | |
27 | #include "ospfd.h" | |
28 | #include "ospf_asbr.h" | |
29 | #include "ospf_lsa.h" | |
30 | #include "ospf_nsm.h" | |
31 | #include "ospf_ism.h" | |
32 | ||
33 | const struct message ospf_ism_state_msg[] = | |
34 | { | |
35 | { ISM_DependUpon, "DependUpon" }, | |
36 | { ISM_Down, "Down" }, | |
37 | { ISM_Loopback, "Loopback" }, | |
38 | { ISM_Waiting, "Waiting" }, | |
39 | { ISM_PointToPoint, "Point-To-Point" }, | |
40 | { ISM_DROther, "DROther" }, | |
41 | { ISM_Backup, "Backup" }, | |
42 | { ISM_DR, "DR" }, | |
43 | }; | |
44 | const int ospf_ism_state_msg_max = OSPF_ISM_STATE_MAX; | |
45 | ||
46 | const struct message ospf_nsm_state_msg[] = | |
47 | { | |
48 | { NSM_DependUpon, "DependUpon" }, | |
49 | { NSM_Deleted, "Deleted" }, | |
50 | { NSM_Down, "Down" }, | |
51 | { NSM_Attempt, "Attempt" }, | |
52 | { NSM_Init, "Init" }, | |
53 | { NSM_TwoWay, "2-Way" }, | |
54 | { NSM_ExStart, "ExStart" }, | |
55 | { NSM_Exchange, "Exchange" }, | |
56 | { NSM_Loading, "Loading" }, | |
57 | { NSM_Full, "Full" }, | |
58 | }; | |
59 | const int ospf_nsm_state_msg_max = OSPF_NSM_STATE_MAX; | |
60 | ||
61 | const struct message ospf_lsa_type_msg[] = | |
62 | { | |
63 | { OSPF_UNKNOWN_LSA, "unknown" }, | |
64 | { OSPF_ROUTER_LSA, "router-LSA" }, | |
65 | { OSPF_NETWORK_LSA, "network-LSA" }, | |
66 | { OSPF_SUMMARY_LSA, "summary-LSA" }, | |
67 | { OSPF_ASBR_SUMMARY_LSA, "summary-LSA" }, | |
68 | { OSPF_AS_EXTERNAL_LSA, "AS-external-LSA" }, | |
69 | { OSPF_GROUP_MEMBER_LSA, "GROUP MEMBER LSA" }, | |
70 | { OSPF_AS_NSSA_LSA, "NSSA-LSA" }, | |
71 | { 8, "Type-8 LSA" }, | |
72 | { OSPF_OPAQUE_LINK_LSA, "Link-Local Opaque-LSA" }, | |
73 | { OSPF_OPAQUE_AREA_LSA, "Area-Local Opaque-LSA" }, | |
74 | { OSPF_OPAQUE_AS_LSA, "AS-external Opaque-LSA" }, | |
75 | }; | |
76 | const int ospf_lsa_type_msg_max = OSPF_MAX_LSA; | |
77 | ||
78 | const struct message ospf_link_state_id_type_msg[] = | |
79 | { | |
80 | { OSPF_UNKNOWN_LSA, "(unknown)" }, | |
81 | { OSPF_ROUTER_LSA, "" }, | |
82 | { OSPF_NETWORK_LSA, "(address of Designated Router)" }, | |
83 | { OSPF_SUMMARY_LSA, "(summary Network Number)" }, | |
84 | { OSPF_ASBR_SUMMARY_LSA, "(AS Boundary Router address)" }, | |
85 | { OSPF_AS_EXTERNAL_LSA, "(External Network Number)" }, | |
86 | { OSPF_GROUP_MEMBER_LSA, "(Group membership information)" }, | |
87 | { OSPF_AS_NSSA_LSA, "(External Network Number for NSSA)" }, | |
88 | { 8, "(Type-8 LSID)" }, | |
89 | { OSPF_OPAQUE_LINK_LSA, "(Link-Local Opaque-Type/ID)" }, | |
90 | { OSPF_OPAQUE_AREA_LSA, "(Area-Local Opaque-Type/ID)" }, | |
91 | { OSPF_OPAQUE_AS_LSA, "(AS-external Opaque-Type/ID)" }, | |
92 | }; | |
93 | const int ospf_link_state_id_type_msg_max = OSPF_MAX_LSA; | |
94 | ||
95 | const struct message ospf_network_type_msg[] = | |
96 | { | |
97 | { OSPF_IFTYPE_NONE, "NONE" }, | |
98 | { OSPF_IFTYPE_POINTOPOINT, "Point-to-Point" }, | |
99 | { OSPF_IFTYPE_BROADCAST, "Broadcast" }, | |
100 | { OSPF_IFTYPE_NBMA, "NBMA" }, | |
101 | { OSPF_IFTYPE_POINTOMULTIPOINT, "Point-to-MultiPoint" }, | |
102 | { OSPF_IFTYPE_VIRTUALLINK, "Virtual-Link" }, | |
103 | }; | |
104 | const int ospf_network_type_msg_max = OSPF_IFTYPE_MAX; | |
105 | ||
106 | /* AuType */ | |
107 | const struct message ospf_auth_type_str[] = | |
108 | { | |
109 | { OSPF_AUTH_NULL, "Null" }, | |
110 | { OSPF_AUTH_SIMPLE, "Simple" }, | |
111 | { OSPF_AUTH_CRYPTOGRAPHIC, "Cryptographic" }, | |
112 | }; | |
113 | const size_t ospf_auth_type_str_max = sizeof (ospf_auth_type_str) / | |
114 | sizeof (ospf_auth_type_str[0]); | |
115 | ||
116 | #define OSPF_OPTION_STR_MAXLEN 24 | |
117 | ||
118 | char * | |
119 | ospf_options_dump (u_char options) | |
120 | { | |
121 | static char buf[OSPF_OPTION_STR_MAXLEN]; | |
122 | ||
123 | snprintf (buf, OSPF_OPTION_STR_MAXLEN, "*|%s|%s|%s|%s|%s|%s|%s", | |
124 | (options & OSPF_OPTION_O) ? "O" : "-", | |
125 | (options & OSPF_OPTION_DC) ? "DC" : "-", | |
126 | (options & OSPF_OPTION_EA) ? "EA" : "-", | |
127 | (options & OSPF_OPTION_NP) ? "N/P" : "-", | |
128 | (options & OSPF_OPTION_MC) ? "MC" : "-", | |
129 | (options & OSPF_OPTION_E) ? "E" : "-", | |
130 | (options & OSPF_OPTION_MT) ? "M/T" : "-"); | |
131 | ||
132 | return buf; | |
133 | } | |
134 | ||
135 | void | |
136 | ospf_lsa_header_dump (struct lsa_header *lsah) | |
137 | { | |
138 | const char *lsah_type = LOOKUP (ospf_lsa_type_msg, lsah->type); | |
139 | ||
140 | zlog_debug (" LSA Header"); | |
141 | zlog_debug (" LS age %d", ntohs (lsah->ls_age)); | |
142 | zlog_debug (" Options %d (%s)", lsah->options, | |
143 | ospf_options_dump (lsah->options)); | |
144 | zlog_debug (" LS type %d (%s)", lsah->type, | |
145 | (lsah->type ? lsah_type : "unknown type")); | |
146 | zlog_debug (" Link State ID %s", inet_ntoa (lsah->id)); | |
147 | zlog_debug (" Advertising Router %s", inet_ntoa (lsah->adv_router)); | |
148 | zlog_debug (" LS sequence number 0x%lx", (u_long)ntohl (lsah->ls_seqnum)); | |
149 | zlog_debug (" LS checksum 0x%x", ntohs (lsah->checksum)); | |
150 | zlog_debug (" length %d", ntohs (lsah->length)); | |
151 | } |