]>
Commit | Line | Data |
---|---|---|
76b89b4a | 1 | @node Packet Binary Dump Format |
718e3744 | 2 | @appendix Packet Binary Dump Format |
3 | ||
7190f4ea | 4 | Quagga can dump routing protocol packet into file with a binary format |
718e3744 | 5 | (@pxref{Dump BGP packets and table}). |
6 | ||
7 | It seems to be better that we share the MRT's header format for | |
8 | backward compatibility with MRT's dump logs. We should also define the | |
9 | binary format excluding the header, because we must support both IP | |
10 | v4 and v6 addresses as socket addresses and / or routing entries. | |
11 | ||
12 | In the last meeting, we discussed to have a version field in the | |
13 | header. But Masaki told us that we can define new `type' value rather | |
14 | than having a `version' field, and it seems to be better because we | |
15 | don't need to change header format. | |
16 | ||
17 | Here is the common header format. This is same as that of MRT. | |
18 | ||
19 | @example | |
20 | @group | |
21 | 0 1 2 3 | |
22 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | |
23 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
24 | | Time | | |
25 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
26 | | Type | Subtype | | |
27 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
28 | | Length | | |
29 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
30 | @end group | |
4db5d90a AF |
31 | @end example |
32 | ||
33 | If `type' is PROTOCOL_BGP4MP_ET, the common header format will | |
34 | contain an additional microsecond field (RFC6396 2011). | |
35 | ||
36 | @example | |
37 | @group | |
38 | 0 1 2 3 | |
39 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | |
40 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
41 | | Time | | |
42 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
43 | | Type | Subtype | | |
44 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
45 | | Length | | |
46 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
47 | | Microsecond | | |
48 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
49 | @end group | |
718e3744 | 50 | @end example |
51 | ||
52 | If `type' is PROTOCOL_BGP4MP, `subtype' is BGP4MP_STATE_CHANGE, and | |
53 | Address Family == IP (version 4) | |
54 | ||
55 | @example | |
56 | @group | |
57 | 0 1 2 3 | |
58 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | |
59 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
60 | | Source AS number | Destination AS number | | |
61 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
62 | | Interface Index | Address Family | | |
63 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
64 | | Source IP address | | |
65 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
66 | | Destination IP address | | |
67 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
68 | | Old State | New State | | |
69 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
70 | @end group | |
71 | @end example | |
72 | ||
73 | Where State is the value defined in RFC1771. | |
74 | ||
75 | If `type' is PROTOCOL_BGP4MP, `subtype' is BGP4MP_STATE_CHANGE, | |
76 | and Address Family == IP version 6 | |
77 | ||
78 | @example | |
79 | @group | |
80 | 0 1 2 3 | |
81 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | |
82 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
83 | | Source AS number | Destination AS number | | |
84 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
85 | | Interface Index | Address Family | | |
86 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
87 | | Source IP address | | |
88 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
89 | | Source IP address (Cont'd) | | |
90 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
91 | | Source IP address (Cont'd) | | |
92 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
93 | | Source IP address (Cont'd) | | |
94 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
95 | | Destination IP address | | |
96 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
97 | | Destination IP address (Cont'd) | | |
98 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
99 | | Destination IP address (Cont'd) | | |
100 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
101 | | Destination IP address (Cont'd) | | |
102 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
103 | | Old State | New State | | |
104 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
105 | @end group | |
106 | @end example | |
107 | ||
108 | If `type' is PROTOCOL_BGP4MP, `subtype' is BGP4MP_MESSAGE, | |
109 | and Address Family == IP (version 4) | |
110 | ||
111 | @example | |
112 | @group | |
113 | 0 1 2 3 | |
114 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | |
115 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
116 | | Source AS number | Destination AS number | | |
117 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
118 | | Interface Index | Address Family | | |
119 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
120 | | Source IP address | | |
121 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
122 | | Destination IP address | | |
123 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
124 | | BGP Message Packet | | |
125 | | | | |
126 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
127 | @end group | |
128 | @end example | |
129 | ||
130 | Where BGP Message Packet is the whole contents of the | |
131 | BGP4 message including header portion. | |
132 | ||
133 | If `type' is PROTOCOL_BGP4MP, `subtype' is BGP4MP_MESSAGE, | |
134 | and Address Family == IP version 6 | |
135 | ||
136 | @example | |
137 | @group | |
138 | 0 1 2 3 | |
139 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | |
140 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
141 | | Source AS number | Destination AS number | | |
142 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
143 | | Interface Index | Address Family | | |
144 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
145 | | Source IP address | | |
146 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
147 | | Source IP address (Cont'd) | | |
148 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
149 | | Source IP address (Cont'd) | | |
150 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
151 | | Source IP address (Cont'd) | | |
152 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
153 | | Destination IP address | | |
154 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
155 | | Destination IP address (Cont'd) | | |
156 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
157 | | Destination IP address (Cont'd) | | |
158 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
159 | | Destination IP address (Cont'd) | | |
160 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
161 | | BGP Message Packet | | |
162 | | | | |
163 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
164 | @end group | |
165 | @end example | |
166 | ||
167 | If `type' is PROTOCOL_BGP4MP, `subtype' is BGP4MP_ENTRY, | |
168 | and Address Family == IP (version 4) | |
169 | ||
170 | @example | |
171 | @group | |
172 | 0 1 2 3 | |
173 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | |
174 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
175 | | View # | Status | | |
176 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
177 | | Time Last Change | | |
178 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
179 | | Address Family | SAFI | Next-Hop-Len | | |
180 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
181 | | Next Hop Address | | |
182 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
183 | | Prefix Length | Address Prefix [variable] | | |
184 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
185 | | Attribute Length | | |
186 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
187 | | BGP Attribute [variable length] | | |
188 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
189 | @end group | |
190 | @end example | |
191 | ||
192 | If `type' is PROTOCOL_BGP4MP, `subtype' is BGP4MP_ENTRY, | |
193 | and Address Family == IP version 6 | |
194 | ||
195 | @example | |
196 | @group | |
197 | 0 1 2 3 | |
198 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | |
199 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
200 | | View # | Status | | |
201 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
202 | | Time Last Change | | |
203 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
204 | | Address Family | SAFI | Next-Hop-Len | | |
205 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
206 | | Next Hop Address | | |
207 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
208 | | Next Hop Address (Cont'd) | | |
209 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
210 | | Next Hop Address (Cont'd) | | |
211 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
212 | | Next Hop Address (Cont'd) | | |
213 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
214 | | Prefix Length | Address Prefix [variable] | | |
215 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
216 | | Address Prefix (cont'd) [variable] | | |
217 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
218 | | Attribute Length | | |
219 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
220 | | BGP Attribute [variable length] | | |
221 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
222 | @end group | |
223 | @end example | |
224 | ||
225 | BGP4 Attribute must not contain MP_UNREACH_NLRI. | |
226 | If BGP Attribute has MP_REACH_NLRI field, it must has | |
227 | zero length NLRI, e.g., MP_REACH_NLRI has only Address | |
228 | Family, SAFI and next-hop values. | |
229 | ||
230 | If `type' is PROTOCOL_BGP4MP and `subtype' is BGP4MP_SNAPSHOT, | |
231 | ||
232 | @example | |
233 | @group | |
234 | 0 1 2 3 | |
235 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | |
236 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
237 | | View # | File Name [variable] | | |
238 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
239 | @end group | |
240 | @end example | |
241 | ||
242 | The file specified in "File Name" contains all routing entries, | |
243 | which are in the format of ``subtype == BGP4MP_ENTRY''. | |
244 | ||
245 | @example | |
246 | @group | |
247 | Constants: | |
248 | /* type value */ | |
4db5d90a AF |
249 | #define MSG_PROTOCOL_BGP4MP 16 |
250 | #define MSG_PROTOCOL_BGP4MP_ET 17 | |
718e3744 | 251 | /* subtype value */ |
252 | #define BGP4MP_STATE_CHANGE 0 | |
253 | #define BGP4MP_MESSAGE 1 | |
254 | #define BGP4MP_ENTRY 2 | |
255 | #define BGP4MP_SNAPSHOT 3 | |
256 | @end group | |
257 | @end example |