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