]> The Tcpdump Group git mirrors - tcpdump/blob - ospf.h
show opaque-LSA specific fields of the LSA header
[tcpdump] / ospf.h
1 /* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.9 2003-10-03 13:00:33 hannes Exp $ (LBL) */
2 /*
3 * Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
4 * The Regents of the University of California. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that: (1) source code distributions
8 * retain the above copyright notice and this paragraph in its entirety, (2)
9 * distributions including binary code include the above copyright notice and
10 * this paragraph in its entirety in the documentation or other materials
11 * provided with the distribution, and (3) all advertising materials mentioning
12 * features or use of this software display the following acknowledgement:
13 * ``This product includes software developed by the University of California,
14 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
15 * the University nor the names of its contributors may be used to endorse
16 * or promote products derived from this software without specific prior
17 * written permission.
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 *
22 * OSPF support contributed by Jeffrey Honig (jch@mitchell.cit.cornell.edu)
23 */
24 #define OSPF_TYPE_UMD 0 /* UMd's special monitoring packets */
25 #define OSPF_TYPE_HELLO 1 /* Hello */
26 #define OSPF_TYPE_DD 2 /* Database Description */
27 #define OSPF_TYPE_LS_REQ 3 /* Link State Request */
28 #define OSPF_TYPE_LS_UPDATE 4 /* Link State Update */
29 #define OSPF_TYPE_LS_ACK 5 /* Link State Ack */
30
31 /* Options field
32 *
33 * +------------------------------------+
34 * | * | O | DC | EA | N/P | MC | E | T |
35 * +------------------------------------+
36 *
37 */
38
39 #define OSPF_OPTION_T 0x01 /* T bit: TOS support */
40 #define OSPF_OPTION_E 0x02 /* E bit: External routes advertised */
41 #define OSPF_OPTION_MC 0x04 /* MC bit: Multicast capable */
42 #define OSPF_OPTION_NP 0x08 /* N/P bit: NSSA capable */
43 #define OSPF_OPTION_EA 0x10 /* EA bit: External Attribute capable */
44 #define OSPF_OPTION_DC 0x20 /* DC bit: Demand circuit capable */
45 #define OSPF_OPTION_O 0x40 /* O bit: Opaque LSA capable */
46
47 /* ospf_authtype */
48 #define OSPF_AUTH_NONE 0 /* No auth-data */
49 #define OSPF_AUTH_SIMPLE 1 /* Simple password */
50 #define OSPF_AUTH_MD5 2 /* MD5 authentication */
51 #define OSPF_AUTH_MD5_LEN 16 /* length of MD5 authentication */
52
53 /* db_flags */
54 #define OSPF_DB_INIT 0x04 /* */
55 #define OSPF_DB_MORE 0x02
56 #define OSPF_DB_MASTER 0x01
57
58 /* ls_type */
59 #define LS_TYPE_ROUTER 1 /* router link */
60 #define LS_TYPE_NETWORK 2 /* network link */
61 #define LS_TYPE_SUM_IP 3 /* summary link */
62 #define LS_TYPE_SUM_ABR 4 /* summary area link */
63 #define LS_TYPE_ASE 5 /* ASE */
64 #define LS_TYPE_GROUP 6 /* Group membership (multicast */
65 /* extensions 23 July 1991) */
66 #define LS_TYPE_NSSA 7 /* rfc1587 - Not so Stubby Areas */
67 #define LS_TYPE_OPAQUE_LL 9 /* rfc2370 - Opaque Link Local */
68 #define LS_TYPE_OPAQUE_AL 10 /* rfc2370 - Opaque Link Local */
69 #define LS_TYPE_OPAQUE_DW 11 /* rfc2370 - Opaque Domain Wide */
70
71 /*************************************************
72 *
73 * is the above a bug in the documentation?
74 *
75 *************************************************/
76
77
78 /* rla_link.link_type */
79 #define RLA_TYPE_ROUTER 1 /* point-to-point to another router */
80 #define RLA_TYPE_TRANSIT 2 /* connection to transit network */
81 #define RLA_TYPE_STUB 3 /* connection to stub network */
82 #define RLA_TYPE_VIRTUAL 4 /* virtual link */
83
84 /* rla_flags */
85 #define RLA_FLAG_B 0x01
86 #define RLA_FLAG_E 0x02
87 #define RLA_FLAG_W1 0x04
88 #define RLA_FLAG_W2 0x08
89
90 /* sla_tosmetric breakdown */
91 #define SLA_MASK_TOS 0x7f000000
92 #define SLA_MASK_METRIC 0x00ffffff
93 #define SLA_SHIFT_TOS 24
94
95 /* asla_tosmetric breakdown */
96 #define ASLA_FLAG_EXTERNAL 0x80000000
97 #define ASLA_MASK_TOS 0x7f000000
98 #define ASLA_SHIFT_TOS 24
99 #define ASLA_MASK_METRIC 0x00ffffff
100
101 /* multicast vertex type */
102 #define MCLA_VERTEX_ROUTER 1
103 #define MCLA_VERTEX_NETWORK 2
104
105 /* link state advertisement header */
106 struct lsa_hdr {
107 u_int16_t ls_age;
108 u_int8_t ls_options;
109 u_int8_t ls_type;
110 union {
111 struct in_addr ls_stateid;
112 struct { /* opaque LSAs change the LSA-ID field */
113 u_int8_t opaque_type;
114 u_int8_t opaque_id[3];
115 };
116 };
117 struct in_addr ls_router;
118 u_int32_t ls_seq;
119 u_int16_t ls_chksum;
120 u_int16_t ls_length;
121 };
122
123 /* link state advertisement */
124 struct lsa {
125 struct lsa_hdr ls_hdr;
126
127 /* Link state types */
128 union {
129 /* Router links advertisements */
130 struct {
131 u_int8_t rla_flags;
132 u_int8_t rla_zero[1];
133 u_int16_t rla_count;
134 struct rlalink {
135 struct in_addr link_id;
136 struct in_addr link_data;
137 u_int8_t link_type;
138 u_int8_t link_toscount;
139 u_int16_t link_tos0metric;
140 } rla_link[1]; /* may repeat */
141 } un_rla;
142
143 /* Network links advertisements */
144 struct {
145 struct in_addr nla_mask;
146 struct in_addr nla_router[1]; /* may repeat */
147 } un_nla;
148
149 /* Summary links advertisements */
150 struct {
151 struct in_addr sla_mask;
152 u_int32_t sla_tosmetric[1]; /* may repeat */
153 } un_sla;
154
155 /* AS external links advertisements */
156 struct {
157 struct in_addr asla_mask;
158 struct aslametric {
159 u_int32_t asla_tosmetric;
160 struct in_addr asla_forward;
161 struct in_addr asla_tag;
162 } asla_metric[1]; /* may repeat */
163 } un_asla;
164
165 /* Multicast group membership */
166 struct mcla {
167 u_int32_t mcla_vtype;
168 struct in_addr mcla_vid;
169 } un_mcla[1];
170
171 /* Unknown LSA */
172 struct unknown {
173 u_int8_t data[1]; /* may repeat */
174 } un_unknown[1];
175
176 } lsa_un;
177 };
178
179
180 /*
181 * TOS metric struct (will be 0 or more in router links update)
182 */
183 struct tos_metric {
184 u_int8_t tos_type;
185 u_int8_t tos_zero;
186 u_int16_t tos_metric;
187 };
188
189 #define OSPF_AUTH_SIZE 8
190
191 /*
192 * the main header
193 */
194 struct ospfhdr {
195 u_int8_t ospf_version;
196 u_int8_t ospf_type;
197 u_int16_t ospf_len;
198 struct in_addr ospf_routerid;
199 struct in_addr ospf_areaid;
200 u_int16_t ospf_chksum;
201 u_int16_t ospf_authtype;
202 u_int8_t ospf_authdata[OSPF_AUTH_SIZE];
203 union {
204
205 /* Hello packet */
206 struct {
207 struct in_addr hello_mask;
208 u_int16_t hello_helloint;
209 u_int8_t hello_options;
210 u_int8_t hello_priority;
211 u_int32_t hello_deadint;
212 struct in_addr hello_dr;
213 struct in_addr hello_bdr;
214 struct in_addr hello_neighbor[1]; /* may repeat */
215 } un_hello;
216
217 /* Database Description packet */
218 struct {
219 u_int8_t db_zero[2];
220 u_int8_t db_options;
221 u_int8_t db_flags;
222 u_int32_t db_seq;
223 struct lsa_hdr db_lshdr[1]; /* may repeat */
224 } un_db;
225
226 /* Link State Request */
227 struct lsr {
228 u_int32_t ls_type;
229 struct in_addr ls_stateid;
230 struct in_addr ls_router;
231 } un_lsr[1]; /* may repeat */
232
233 /* Link State Update */
234 struct {
235 u_int32_t lsu_count;
236 struct lsa lsu_lsa[1]; /* may repeat */
237 } un_lsu;
238
239 /* Link State Acknowledgement */
240 struct {
241 struct lsa_hdr lsa_lshdr[1]; /* may repeat */
242 } un_lsa ;
243 } ospf_un ;
244 };
245
246 #define ospf_hello ospf_un.un_hello
247 #define ospf_db ospf_un.un_db
248 #define ospf_lsr ospf_un.un_lsr
249 #define ospf_lsu ospf_un.un_lsu
250 #define ospf_lsa ospf_un.un_lsa
251