Skip to content

Commit 603d007

Browse files
author
hannes
committed
-rework the OSPFv3 printer:
-share the grace and TE LSA printer with the OSPFv2 printer -change to multiple line output (behind vflag) -unambiguate datastructures such that the OSPFv3 printer can include OSPFv2 header files.
1 parent 298fb77 commit 603d007

File tree

2 files changed

+282
-391
lines changed

2 files changed

+282
-391
lines changed

ospf6.h

+32-45
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @(#) $Header: /tcpdump/master/tcpdump/ospf6.h,v 1.6 2002-12-11 07:13:56 guy Exp $ (LBL) */
1+
/* @(#) $Header: /tcpdump/master/tcpdump/ospf6.h,v 1.7 2006-09-05 15:50:26 hannes Exp $ (LBL) */
22
/*
33
* Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
44
* The Regents of the University of California. All rights reserved.
@@ -21,13 +21,11 @@
2121
*
2222
* OSPF support contributed by Jeffrey Honig ([email protected])
2323
*/
24-
#define OSPF_TYPE_UMD 0 /* UMd's special monitoring packets */
25-
#define OSPF_TYPE_HELLO 1 /* Hello */
26-
#define OSPF_TYPE_DB 2 /* Database Description */
27-
#define OSPF_TYPE_LSR 3 /* Link State Request */
28-
#define OSPF_TYPE_LSU 4 /* Link State Update */
29-
#define OSPF_TYPE_LSA 5 /* Link State Ack */
30-
#define OSPF_TYPE_MAX 6
24+
#define OSPF_TYPE_HELLO 1 /* Hello */
25+
#define OSPF_TYPE_DD 2 /* Database Description */
26+
#define OSPF_TYPE_LS_REQ 3 /* Link State Request */
27+
#define OSPF_TYPE_LS_UPDATE 4 /* Link State Update */
28+
#define OSPF_TYPE_LS_ACK 5 /* Link State Ack */
3129

3230
/* Options *_options */
3331
#define OSPF6_OPTION_V6 0x01 /* V6 bit: A bit for peeping tom */
@@ -50,23 +48,18 @@
5048
#define LS_TYPE_INTER_AR 4 /* Inter-Area-Router */
5149
#define LS_TYPE_ASE 5 /* ASE */
5250
#define LS_TYPE_GROUP 6 /* Group membership */
53-
#define LS_TYPE_TYPE7 7 /* Type 7 LSA */
51+
#define LS_TYPE_NSSA 7 /* NSSA */
5452
#define LS_TYPE_LINK 8 /* Link LSA */
5553
#define LS_TYPE_INTRA_AP 9 /* Intra-Area-Prefix */
56-
#define LS_TYPE_MAX 10
54+
#define LS_TYPE_INTRA_ATE 10 /* Intra-Area-TE */
55+
#define LS_TYPE_GRACE 11 /* Grace LSA */
5756
#define LS_TYPE_MASK 0x1fff
5857

5958
#define LS_SCOPE_LINKLOCAL 0x0000
6059
#define LS_SCOPE_AREA 0x2000
6160
#define LS_SCOPE_AS 0x4000
6261
#define LS_SCOPE_MASK 0x6000
63-
64-
/*************************************************
65-
*
66-
* is the above a bug in the documentation?
67-
*
68-
*************************************************/
69-
62+
#define LS_SCOPE_U 0x8000
7063

7164
/* rla_link.link_type */
7265
#define RLA_TYPE_ROUTER 1 /* point-to-point to another router */
@@ -78,26 +71,29 @@
7871
#define RLA_FLAG_E 0x02
7972
#define RLA_FLAG_V 0x04
8073
#define RLA_FLAG_W 0x08
74+
#define RLA_FLAG_N 0x10
75+
76+
/* lsa_prefix options */
77+
#define LSA_PREFIX_OPT_NU 0x01
78+
#define LSA_PREFIX_OPT_LA 0x02
79+
#define LSA_PREFIX_OPT_MC 0x04
80+
#define LSA_PREFIX_OPT_P 0x08
81+
#define LSA_PREFIX_OPT_DN 0x10
8182

8283
/* sla_tosmetric breakdown */
8384
#define SLA_MASK_TOS 0x7f000000
8485
#define SLA_MASK_METRIC 0x00ffffff
8586
#define SLA_SHIFT_TOS 24
8687

8788
/* asla_metric */
88-
#define ASLA_FLAG_EXTERNAL 0x04000000
8989
#define ASLA_FLAG_FWDADDR 0x02000000
9090
#define ASLA_FLAG_ROUTETAG 0x01000000
9191
#define ASLA_MASK_METRIC 0x00ffffff
9292

93-
/* multicast vertex type */
94-
#define MCLA_VERTEX_ROUTER 1
95-
#define MCLA_VERTEX_NETWORK 2
96-
9793
typedef u_int32_t rtrid_t;
9894

9995
/* link state advertisement header */
100-
struct lsa_hdr {
96+
struct lsa6_hdr {
10197
u_int16_t ls_age;
10298
u_int16_t ls_type;
10399
rtrid_t ls_stateid;
@@ -107,16 +103,16 @@ struct lsa_hdr {
107103
u_int16_t ls_length;
108104
};
109105

110-
struct lsa_prefix {
106+
struct lsa6_prefix {
111107
u_int8_t lsa_p_len;
112108
u_int8_t lsa_p_opt;
113-
u_int16_t lsa_p_mbz;
109+
u_int16_t lsa_p_metric;
114110
u_int8_t lsa_p_prefix[4];
115111
};
116112

117113
/* link state advertisement */
118-
struct lsa {
119-
struct lsa_hdr ls_hdr;
114+
struct lsa6 {
115+
struct lsa6_hdr ls_hdr;
120116

121117
/* Link state types */
122118
union {
@@ -128,7 +124,7 @@ struct lsa {
128124
} rla_flgandopt;
129125
#define rla_flags rla_flgandopt.flg
130126
#define rla_options rla_flgandopt.opt
131-
struct rlalink {
127+
struct rlalink6 {
132128
u_int8_t link_type;
133129
u_int8_t link_zero[1];
134130
u_int16_t link_metric;
@@ -147,13 +143,13 @@ struct lsa {
147143
/* Inter Area Prefix LSA */
148144
struct {
149145
u_int32_t inter_ap_metric;
150-
struct lsa_prefix inter_ap_prefix[1];
146+
struct lsa6_prefix inter_ap_prefix[1];
151147
} un_inter_ap;
152148

153149
/* AS external links advertisements */
154150
struct {
155151
u_int32_t asla_metric;
156-
struct lsa_prefix asla_prefix[1];
152+
struct lsa6_prefix asla_prefix[1];
157153
/* some optional fields follow */
158154
} un_asla;
159155

@@ -183,7 +179,7 @@ struct lsa {
183179
#define llsa_options llsa_priandopt.opt
184180
struct in6_addr llsa_lladdr;
185181
u_int32_t llsa_nprefix;
186-
struct lsa_prefix llsa_prefix[1];
182+
struct lsa6_prefix llsa_prefix[1];
187183
} un_llsa;
188184

189185
/* Intra-Area-Prefix */
@@ -192,21 +188,12 @@ struct lsa {
192188
u_int16_t intra_ap_lstype;
193189
rtrid_t intra_ap_lsid;
194190
rtrid_t intra_ap_rtid;
195-
struct lsa_prefix intra_ap_prefix[1];
191+
struct lsa6_prefix intra_ap_prefix[1];
196192
} un_intra_ap;
197193
} lsa_un;
198194
};
199195

200196

201-
/*
202-
* TOS metric struct (will be 0 or more in router links update)
203-
*/
204-
struct tos_metric {
205-
u_int8_t tos_type;
206-
u_int8_t tos_zero;
207-
u_int16_t tos_metric;
208-
};
209-
210197
#define OSPF_AUTH_SIZE 8
211198

212199
/*
@@ -246,11 +233,11 @@ struct ospf6hdr {
246233
u_int8_t db_mbz;
247234
u_int8_t db_flags;
248235
u_int32_t db_seq;
249-
struct lsa_hdr db_lshdr[1]; /* may repeat */
236+
struct lsa6_hdr db_lshdr[1]; /* may repeat */
250237
} un_db;
251238

252239
/* Link State Request */
253-
struct lsr {
240+
struct lsr6 {
254241
u_int16_t ls_mbz;
255242
u_int16_t ls_type;
256243
rtrid_t ls_stateid;
@@ -260,12 +247,12 @@ struct ospf6hdr {
260247
/* Link State Update */
261248
struct {
262249
u_int32_t lsu_count;
263-
struct lsa lsu_lsa[1]; /* may repeat */
250+
struct lsa6 lsu_lsa[1]; /* may repeat */
264251
} un_lsu;
265252

266253
/* Link State Acknowledgement */
267254
struct {
268-
struct lsa_hdr lsa_lshdr[1]; /* may repeat */
255+
struct lsa6_hdr lsa_lshdr[1]; /* may repeat */
269256
} un_lsa ;
270257
} ospf6_un ;
271258
};

0 commit comments

Comments
 (0)