mirror of
				https://git.proxmox.com/git/mirror_frr
				synced 2025-11-04 08:04:27 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			258 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			258 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
@node  Packet Binary Dump Format
 | 
						|
@appendix Packet Binary Dump Format
 | 
						|
 | 
						|
  FRR can dump routing protocol packet into file with a binary format
 | 
						|
(@pxref{Dump BGP packets and table}).
 | 
						|
 | 
						|
  It seems to be better that we share the MRT's header format for
 | 
						|
backward compatibility with MRT's dump logs. We should also define the
 | 
						|
binary format excluding the header, because we must support both IP
 | 
						|
v4 and v6 addresses as socket addresses and / or routing entries.
 | 
						|
 | 
						|
  In the last meeting, we discussed to have a version field in the
 | 
						|
header. But Masaki told us that we can define new `type' value rather
 | 
						|
than having a `version' field, and it seems to be better because we
 | 
						|
don't need to change header format.
 | 
						|
 | 
						|
  Here is the common header format. This is same as that of MRT.
 | 
						|
 | 
						|
@example
 | 
						|
@group
 | 
						|
0                   1                   2                   3
 | 
						|
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
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                              Time                             |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|             Type              |            Subtype            |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                             Length                            |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
@end group
 | 
						|
@end example
 | 
						|
 | 
						|
  If `type' is PROTOCOL_BGP4MP_ET, the common header format will
 | 
						|
contain an additional microsecond field (RFC6396 2011).
 | 
						|
 | 
						|
@example
 | 
						|
@group
 | 
						|
0                   1                   2                   3
 | 
						|
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
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                              Time                             |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|             Type              |            Subtype            |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                             Length                            |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                          Microsecond                          |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
@end group
 | 
						|
@end example
 | 
						|
 | 
						|
  If `type' is PROTOCOL_BGP4MP, `subtype' is BGP4MP_STATE_CHANGE, and
 | 
						|
Address Family == IP (version 4)
 | 
						|
 | 
						|
@example
 | 
						|
@group
 | 
						|
 0                   1                   2                   3
 | 
						|
 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
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|        Source AS number       |     Destination AS number     |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|        Interface Index        |      Address Family           |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                        Source IP address                      |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                     Destination IP address                    |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|            Old State          |           New State           |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
@end group
 | 
						|
@end example
 | 
						|
 | 
						|
Where State is the value defined in RFC1771.
 | 
						|
 | 
						|
If `type' is PROTOCOL_BGP4MP, `subtype' is BGP4MP_STATE_CHANGE,
 | 
						|
and Address Family == IP version 6
 | 
						|
 | 
						|
@example
 | 
						|
@group
 | 
						|
 0                   1                   2                   3
 | 
						|
 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
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|        Source AS number       |     Destination AS number     |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|        Interface Index        |      Address Family           |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                        Source IP address                      |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                        Source IP address (Cont'd)             |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                        Source IP address (Cont'd)             |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                        Source IP address (Cont'd)             |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                     Destination IP address                    |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                     Destination IP address (Cont'd)           |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                     Destination IP address (Cont'd)           |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                     Destination IP address (Cont'd)           |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|            Old State          |           New State           |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
@end group
 | 
						|
@end example
 | 
						|
 | 
						|
If `type' is PROTOCOL_BGP4MP, `subtype' is BGP4MP_MESSAGE,
 | 
						|
and Address Family == IP (version 4)
 | 
						|
 | 
						|
@example
 | 
						|
@group
 | 
						|
 0                   1                   2                   3
 | 
						|
 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
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|        Source AS number       |     Destination AS number     |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|        Interface Index        |      Address Family           |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                        Source IP address                      |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                     Destination IP address                    |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                       BGP Message Packet                      |
 | 
						|
|                                                               |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
@end group
 | 
						|
@end example
 | 
						|
 | 
						|
Where BGP Message Packet is the whole contents of the
 | 
						|
BGP4 message including header portion.
 | 
						|
 | 
						|
If `type' is PROTOCOL_BGP4MP, `subtype' is BGP4MP_MESSAGE,
 | 
						|
and Address Family == IP version 6
 | 
						|
 | 
						|
@example
 | 
						|
@group
 | 
						|
 0                   1                   2                   3
 | 
						|
 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
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|        Source AS number       |     Destination AS number     |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|        Interface Index        |      Address Family           |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                        Source IP address                      |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                        Source IP address (Cont'd)             |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                        Source IP address (Cont'd)             |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                        Source IP address (Cont'd)             |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                     Destination IP address                    |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                     Destination IP address (Cont'd)           |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                     Destination IP address (Cont'd)           |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                     Destination IP address (Cont'd)           |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                       BGP Message Packet                      |
 | 
						|
|                                                               |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
@end group
 | 
						|
@end example
 | 
						|
 | 
						|
If `type' is PROTOCOL_BGP4MP, `subtype' is BGP4MP_ENTRY,
 | 
						|
and Address Family == IP (version 4)
 | 
						|
 | 
						|
@example
 | 
						|
@group
 | 
						|
 0                   1                   2                   3
 | 
						|
 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
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|            View #             |            Status             |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                        Time Last Change                       |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|       Address Family          |    SAFI       | Next-Hop-Len  |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                        Next Hop Address                       |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
| Prefix Length |             Address Prefix [variable]         |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|       Attribute Length        |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|      BGP Attribute [variable length]    			|
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
@end group
 | 
						|
@end example
 | 
						|
 | 
						|
If `type' is PROTOCOL_BGP4MP, `subtype' is BGP4MP_ENTRY,
 | 
						|
and Address Family == IP version 6
 | 
						|
 | 
						|
@example
 | 
						|
@group
 | 
						|
 0                   1                   2                   3
 | 
						|
 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
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|            View #             |            Status             |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                        Time Last Change                       |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|       Address Family          |    SAFI       | Next-Hop-Len  |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                        Next Hop Address                       |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                        Next Hop Address (Cont'd)              |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                        Next Hop Address (Cont'd)              |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|                        Next Hop Address (Cont'd)              |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
| Prefix Length |             Address Prefix [variable]         |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|     Address Prefix (cont'd) [variable]        |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|       Attribute Length        |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|      BGP Attribute [variable length]    			    |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
@end group
 | 
						|
@end example
 | 
						|
 | 
						|
	BGP4 Attribute must not contain MP_UNREACH_NLRI.
 | 
						|
	If BGP Attribute has MP_REACH_NLRI field, it must has
 | 
						|
	zero length NLRI, e.g., MP_REACH_NLRI has only Address
 | 
						|
	Family, SAFI and next-hop values.
 | 
						|
 | 
						|
If `type' is PROTOCOL_BGP4MP and `subtype' is BGP4MP_SNAPSHOT,
 | 
						|
 | 
						|
@example
 | 
						|
@group
 | 
						|
 0                   1                   2                   3
 | 
						|
 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
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
|           View #              |       File Name [variable]    |
 | 
						|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | 
						|
@end group
 | 
						|
@end example
 | 
						|
 | 
						|
    The file specified in "File Name" contains all routing entries,
 | 
						|
    which are in the format of ``subtype == BGP4MP_ENTRY''.
 | 
						|
 | 
						|
@example
 | 
						|
@group
 | 
						|
Constants:
 | 
						|
  /* type value */
 | 
						|
  #define MSG_PROTOCOL_BGP4MP    16
 | 
						|
  #define MSG_PROTOCOL_BGP4MP_ET 17
 | 
						|
  /* subtype value */
 | 
						|
  #define BGP4MP_STATE_CHANGE 0
 | 
						|
  #define BGP4MP_MESSAGE 1
 | 
						|
  #define BGP4MP_ENTRY 2
 | 
						|
  #define BGP4MP_SNAPSHOT 3
 | 
						|
@end group
 | 
						|
@end example
 |