bgpd: Update dump to allow Extended Time Format

Allow the bgp dump functionality to handle the Extended Time format
as specified in RFC 6396.

Fixes a segmentation fault with multiple dump rules as well.

Signed-off-by: Alexis Fasquel <alexis@pch.net>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
diff --git a/doc/appendix.texi b/doc/appendix.texi
index 87276c5..3904c5f 100644
--- a/doc/appendix.texi
+++ b/doc/appendix.texi
@@ -30,6 +30,25 @@
 @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)
 
@@ -227,7 +246,8 @@
 @group
 Constants:
   /* type value */
-  #define MSG_PROTOCOL_BGP4MP 16
+  #define MSG_PROTOCOL_BGP4MP    16
+  #define MSG_PROTOCOL_BGP4MP_ET 17
   /* subtype value */
   #define BGP4MP_STATE_CHANGE 0
   #define BGP4MP_MESSAGE 1
diff --git a/doc/bgpd.texi b/doc/bgpd.texi
index 7d92b5e..5eb0851 100644
--- a/doc/bgpd.texi
+++ b/doc/bgpd.texi
@@ -1326,21 +1326,36 @@
 @node Dump BGP packets and table
 @section Dump BGP packets and table
 
-@deffn Command {dump bgp all @var{path}} {}
-@deffnx Command {dump bgp all @var{path} @var{interval}} {}
+@deffn Command {dump bgp all @var{path} [@var{interval}]} {}
+@deffnx Command {dump bgp all-et @var{path} [@var{interval}]} {}
+@deffnx Command {no dump bgp all [@var{path}] [@var{interval}]} {}
 Dump all BGP packet and events to @var{path} file.
+If @var{interval} is set, a new file will be created for echo @var{interval} of seconds.
+The path @var{path} can be set with date and time formatting (strftime).
+The type ‘all-et’ enables support for Extended Timestamp Header (@pxref{Packet Binary Dump Format}).
+(@pxref{Packet Binary Dump Format})
 @end deffn 
 
-@deffn Command {dump bgp updates @var{path}} {}
-@deffnx Command {dump bgp updates @var{path} @var{interval}} {}
-Dump BGP updates to @var{path} file.
+@deffn Command {dump bgp updates @var{path} [@var{interval}]} {}
+@deffnx Command {dump bgp updates-et @var{path} [@var{interval}]} {}
+@deffnx Command {no dump bgp updates [@var{path}] [@var{interval}]} {}
+Dump only BGP updates messages to @var{path} file.
+If @var{interval} is set, a new file will be created for echo @var{interval} of seconds.
+The path @var{path} can be set with date and time formatting (strftime).
+The type ‘updates-et’ enables support for Extended Timestamp Header (@pxref{Packet Binary Dump Format}).
 @end deffn
 
-@deffn Command {dump bgp routes @var{path}} {}
-@deffnx Command {dump bgp routes @var{path}} {}
+@deffn Command {dump bgp routes-mrt @var{path}} {}
+@deffnx Command {dump bgp routes-mrt @var{path} @var{interval}} {}
+@deffnx Command {no dump bgp route-mrt [@var{path}] [@var{interval}]} {}
 Dump whole BGP routing table to @var{path}.  This is heavy process.
+The path @var{path} can be set with date and time formatting (strftime).
+If @var{interval} is set, a new file will be created for echo @var{interval} of seconds.
 @end deffn
 
+Note: the interval variable can also be set using hours and minutes: 04h20m00.
+
+
 @node BGP Configuration Examples
 @section BGP Configuration Examples