History log of /openbsd-current/usr.sbin/bgpctl/mrtparser.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.22 01-Feb-2024 claudio

Convert the mrtparser to use ibufs in many places.

More is possible but for now this covers most of the message parsers.
OK tb@


# 1.21 23-Jan-2024 claudio

Adopt bgpctl code to the ibuf changes done in bgpd.

Adjust code that calls nlri_get_prefix() and friends to work with
an ibuf. show_mrt_update() is mostly converted because of this.
The output functions and the rest of the mrtparser are just
minimally touched to keep the diff reasonable.
OK tb@


# 1.20 20-Nov-2023 claudio

KNF


Revision tags: OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.19 18-Oct-2022 job

Fix some spelling errors

Thanks Marco D'Itri for spotting them

OK claudio@


Revision tags: OPENBSD_7_2_BASE
# 1.18 17-Aug-2022 claudio

Use memset() instead of bzero().
OK tb@ deraadt@


Revision tags: OPENBSD_7_1_BASE
# 1.17 06-Feb-2022 claudio

Switch from u_intX_t types to stdint.h uintX_t like it was done in bgpd.
OK florian@ tb@


Revision tags: OPENBSD_7_0_BASE
# 1.16 22-Sep-2021 claudio

Adjust handling of RIB_GENERIC_ADDPATH MRT messages. Parse it the way
OpenBGPD and GoBGP dump so that it works with all the MRT implementations
out there supporting this.
While there do some additional minor cleanup.
OK deraadt@


# 1.15 27-Jul-2021 claudio

Implemnt the RFC8050 in the MRT parser. With this MRT dumps containing
add-path information will be dumped properly.

There is one bit where this implementation is not in line with the RFC.
The encoding of DUMP_V2_RIB_GENERIC_ADDPATH for non IPv4 or IPv6 prefixes
is implemented the way gobgp did it (which seems to be the only other BGP
implementation that supports generic encoding). The RFC puts the path_id
in the NLRI for generic encoding instead of adding it to RIB entry struct
like in the IPv4 and IPv6 encoding. This is an open discussion point with
the RFC author.

OK benno@


Revision tags: OPENBSD_6_9_BASE
# 1.14 18-Jan-2021 claudio

Adjust code to the change of struct bgpd_addr in bgpd.
OK denis@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.13 03-Jul-2019 claudio

Add a default case to subtype switch in the table v2 parser.
If a unknown subtype is encountered it is better to fail.


# 1.12 28-Jun-2019 claudio

Implement the bits and pieces that are needed to dump MRT_DUMP_V2_RIB_GENERIC
messages and BGP MPLS VPNs.
OK benno@


# 1.11 17-Jun-2019 claudio

Cleanup some spaces here as well. Again no binary change.


Revision tags: OPENBSD_6_5_BASE
# 1.10 25-Feb-2019 claudio

Use struct bgpd_addr instead of a union of sockaddrs to store addresses
in the mrt dump structs. This is more compatible with bgpctl since it uses
struct bgpd_addr in most cases anyway.
OK kn@


Revision tags: OPENBSD_6_4_BASE
# 1.9 20-Jul-2018 claudio

Print the timestamp embedded in mrt files for update and status messages.
Also implemented the extended precision format so microseconds are printed
as well when available. The output is relative to the previous message and
follows what kdump does.
OK benno@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.8 23-Dec-2015 mmcc

Remove NULL-checks before free(). I think I've almost scrubbed the
entire tree of these...


# 1.7 24-Oct-2015 claudio

Implement the missing bits to parse the other MRT message types.
Printing bgp messages is still missing lots but at least it is a start.
I onced abused tcpdump's bgp protocol handler for this but that is an ugly hack.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.6 09-Jan-2015 henning

move the ignore-microsec-timestamp bit from mrt_parse to mrt_parse_dump_mp
fixes a coredump reachable via show mrt file
From: Benjamin Baier <programmer at netzbasis dot de>, ok claudio


# 1.5 08-Oct-2014 deraadt

Use reallocarray() throughout to spot multiplicative int overflow.
ok henning benno


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.4 07-May-2013 jsg

fix some leaks in error paths
ok claudio@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.3 26-Mar-2012 claudio

Add a function to extract an address instead of copying the same code over
and over again. Also allow the dump attr of struct mrt_parser to be NULL.


# 1.2 06-Mar-2012 claudio

Implement a better way to detect the encoding of the MP_REACH_NLRI attr.
Check the addr length value of the RFC 6396 encoding to decide if it is
one or not. While there try to make the comment more clear.


Revision tags: OPENBSD_5_1_BASE
# 1.1 21-Sep-2011 claudio

Make it possible to parse MRT table dumps (all 3 formats) and display
them like the show rib / show rib detail output. It is also possible
to filter the output. e.g.
bgpctl show mrt file ./bview.20110914.1600 as 22512 204.209.0.0/16 all
OK sthen@, put it in henning@


# 1.21 23-Jan-2024 claudio

Adopt bgpctl code to the ibuf changes done in bgpd.

Adjust code that calls nlri_get_prefix() and friends to work with
an ibuf. show_mrt_update() is mostly converted because of this.
The output functions and the rest of the mrtparser are just
minimally touched to keep the diff reasonable.
OK tb@


# 1.20 20-Nov-2023 claudio

KNF


Revision tags: OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.19 18-Oct-2022 job

Fix some spelling errors

Thanks Marco D'Itri for spotting them

OK claudio@


Revision tags: OPENBSD_7_2_BASE
# 1.18 17-Aug-2022 claudio

Use memset() instead of bzero().
OK tb@ deraadt@


Revision tags: OPENBSD_7_1_BASE
# 1.17 06-Feb-2022 claudio

Switch from u_intX_t types to stdint.h uintX_t like it was done in bgpd.
OK florian@ tb@


Revision tags: OPENBSD_7_0_BASE
# 1.16 22-Sep-2021 claudio

Adjust handling of RIB_GENERIC_ADDPATH MRT messages. Parse it the way
OpenBGPD and GoBGP dump so that it works with all the MRT implementations
out there supporting this.
While there do some additional minor cleanup.
OK deraadt@


# 1.15 27-Jul-2021 claudio

Implemnt the RFC8050 in the MRT parser. With this MRT dumps containing
add-path information will be dumped properly.

There is one bit where this implementation is not in line with the RFC.
The encoding of DUMP_V2_RIB_GENERIC_ADDPATH for non IPv4 or IPv6 prefixes
is implemented the way gobgp did it (which seems to be the only other BGP
implementation that supports generic encoding). The RFC puts the path_id
in the NLRI for generic encoding instead of adding it to RIB entry struct
like in the IPv4 and IPv6 encoding. This is an open discussion point with
the RFC author.

OK benno@


Revision tags: OPENBSD_6_9_BASE
# 1.14 18-Jan-2021 claudio

Adjust code to the change of struct bgpd_addr in bgpd.
OK denis@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.13 03-Jul-2019 claudio

Add a default case to subtype switch in the table v2 parser.
If a unknown subtype is encountered it is better to fail.


# 1.12 28-Jun-2019 claudio

Implement the bits and pieces that are needed to dump MRT_DUMP_V2_RIB_GENERIC
messages and BGP MPLS VPNs.
OK benno@


# 1.11 17-Jun-2019 claudio

Cleanup some spaces here as well. Again no binary change.


Revision tags: OPENBSD_6_5_BASE
# 1.10 25-Feb-2019 claudio

Use struct bgpd_addr instead of a union of sockaddrs to store addresses
in the mrt dump structs. This is more compatible with bgpctl since it uses
struct bgpd_addr in most cases anyway.
OK kn@


Revision tags: OPENBSD_6_4_BASE
# 1.9 20-Jul-2018 claudio

Print the timestamp embedded in mrt files for update and status messages.
Also implemented the extended precision format so microseconds are printed
as well when available. The output is relative to the previous message and
follows what kdump does.
OK benno@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.8 23-Dec-2015 mmcc

Remove NULL-checks before free(). I think I've almost scrubbed the
entire tree of these...


# 1.7 24-Oct-2015 claudio

Implement the missing bits to parse the other MRT message types.
Printing bgp messages is still missing lots but at least it is a start.
I onced abused tcpdump's bgp protocol handler for this but that is an ugly hack.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.6 09-Jan-2015 henning

move the ignore-microsec-timestamp bit from mrt_parse to mrt_parse_dump_mp
fixes a coredump reachable via show mrt file
From: Benjamin Baier <programmer at netzbasis dot de>, ok claudio


# 1.5 08-Oct-2014 deraadt

Use reallocarray() throughout to spot multiplicative int overflow.
ok henning benno


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.4 07-May-2013 jsg

fix some leaks in error paths
ok claudio@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.3 26-Mar-2012 claudio

Add a function to extract an address instead of copying the same code over
and over again. Also allow the dump attr of struct mrt_parser to be NULL.


# 1.2 06-Mar-2012 claudio

Implement a better way to detect the encoding of the MP_REACH_NLRI attr.
Check the addr length value of the RFC 6396 encoding to decide if it is
one or not. While there try to make the comment more clear.


Revision tags: OPENBSD_5_1_BASE
# 1.1 21-Sep-2011 claudio

Make it possible to parse MRT table dumps (all 3 formats) and display
them like the show rib / show rib detail output. It is also possible
to filter the output. e.g.
bgpctl show mrt file ./bview.20110914.1600 as 22512 204.209.0.0/16 all
OK sthen@, put it in henning@


# 1.20 20-Nov-2023 claudio

KNF


Revision tags: OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.19 18-Oct-2022 job

Fix some spelling errors

Thanks Marco D'Itri for spotting them

OK claudio@


Revision tags: OPENBSD_7_2_BASE
# 1.18 17-Aug-2022 claudio

Use memset() instead of bzero().
OK tb@ deraadt@


Revision tags: OPENBSD_7_1_BASE
# 1.17 06-Feb-2022 claudio

Switch from u_intX_t types to stdint.h uintX_t like it was done in bgpd.
OK florian@ tb@


Revision tags: OPENBSD_7_0_BASE
# 1.16 22-Sep-2021 claudio

Adjust handling of RIB_GENERIC_ADDPATH MRT messages. Parse it the way
OpenBGPD and GoBGP dump so that it works with all the MRT implementations
out there supporting this.
While there do some additional minor cleanup.
OK deraadt@


# 1.15 27-Jul-2021 claudio

Implemnt the RFC8050 in the MRT parser. With this MRT dumps containing
add-path information will be dumped properly.

There is one bit where this implementation is not in line with the RFC.
The encoding of DUMP_V2_RIB_GENERIC_ADDPATH for non IPv4 or IPv6 prefixes
is implemented the way gobgp did it (which seems to be the only other BGP
implementation that supports generic encoding). The RFC puts the path_id
in the NLRI for generic encoding instead of adding it to RIB entry struct
like in the IPv4 and IPv6 encoding. This is an open discussion point with
the RFC author.

OK benno@


Revision tags: OPENBSD_6_9_BASE
# 1.14 18-Jan-2021 claudio

Adjust code to the change of struct bgpd_addr in bgpd.
OK denis@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.13 03-Jul-2019 claudio

Add a default case to subtype switch in the table v2 parser.
If a unknown subtype is encountered it is better to fail.


# 1.12 28-Jun-2019 claudio

Implement the bits and pieces that are needed to dump MRT_DUMP_V2_RIB_GENERIC
messages and BGP MPLS VPNs.
OK benno@


# 1.11 17-Jun-2019 claudio

Cleanup some spaces here as well. Again no binary change.


Revision tags: OPENBSD_6_5_BASE
# 1.10 25-Feb-2019 claudio

Use struct bgpd_addr instead of a union of sockaddrs to store addresses
in the mrt dump structs. This is more compatible with bgpctl since it uses
struct bgpd_addr in most cases anyway.
OK kn@


Revision tags: OPENBSD_6_4_BASE
# 1.9 20-Jul-2018 claudio

Print the timestamp embedded in mrt files for update and status messages.
Also implemented the extended precision format so microseconds are printed
as well when available. The output is relative to the previous message and
follows what kdump does.
OK benno@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.8 23-Dec-2015 mmcc

Remove NULL-checks before free(). I think I've almost scrubbed the
entire tree of these...


# 1.7 24-Oct-2015 claudio

Implement the missing bits to parse the other MRT message types.
Printing bgp messages is still missing lots but at least it is a start.
I onced abused tcpdump's bgp protocol handler for this but that is an ugly hack.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.6 09-Jan-2015 henning

move the ignore-microsec-timestamp bit from mrt_parse to mrt_parse_dump_mp
fixes a coredump reachable via show mrt file
From: Benjamin Baier <programmer at netzbasis dot de>, ok claudio


# 1.5 08-Oct-2014 deraadt

Use reallocarray() throughout to spot multiplicative int overflow.
ok henning benno


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.4 07-May-2013 jsg

fix some leaks in error paths
ok claudio@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.3 26-Mar-2012 claudio

Add a function to extract an address instead of copying the same code over
and over again. Also allow the dump attr of struct mrt_parser to be NULL.


# 1.2 06-Mar-2012 claudio

Implement a better way to detect the encoding of the MP_REACH_NLRI attr.
Check the addr length value of the RFC 6396 encoding to decide if it is
one or not. While there try to make the comment more clear.


Revision tags: OPENBSD_5_1_BASE
# 1.1 21-Sep-2011 claudio

Make it possible to parse MRT table dumps (all 3 formats) and display
them like the show rib / show rib detail output. It is also possible
to filter the output. e.g.
bgpctl show mrt file ./bview.20110914.1600 as 22512 204.209.0.0/16 all
OK sthen@, put it in henning@


# 1.19 18-Oct-2022 job

Fix some spelling errors

Thanks Marco D'Itri for spotting them

OK claudio@


Revision tags: OPENBSD_7_2_BASE
# 1.18 17-Aug-2022 claudio

Use memset() instead of bzero().
OK tb@ deraadt@


Revision tags: OPENBSD_7_1_BASE
# 1.17 06-Feb-2022 claudio

Switch from u_intX_t types to stdint.h uintX_t like it was done in bgpd.
OK florian@ tb@


Revision tags: OPENBSD_7_0_BASE
# 1.16 22-Sep-2021 claudio

Adjust handling of RIB_GENERIC_ADDPATH MRT messages. Parse it the way
OpenBGPD and GoBGP dump so that it works with all the MRT implementations
out there supporting this.
While there do some additional minor cleanup.
OK deraadt@


# 1.15 27-Jul-2021 claudio

Implemnt the RFC8050 in the MRT parser. With this MRT dumps containing
add-path information will be dumped properly.

There is one bit where this implementation is not in line with the RFC.
The encoding of DUMP_V2_RIB_GENERIC_ADDPATH for non IPv4 or IPv6 prefixes
is implemented the way gobgp did it (which seems to be the only other BGP
implementation that supports generic encoding). The RFC puts the path_id
in the NLRI for generic encoding instead of adding it to RIB entry struct
like in the IPv4 and IPv6 encoding. This is an open discussion point with
the RFC author.

OK benno@


Revision tags: OPENBSD_6_9_BASE
# 1.14 18-Jan-2021 claudio

Adjust code to the change of struct bgpd_addr in bgpd.
OK denis@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.13 03-Jul-2019 claudio

Add a default case to subtype switch in the table v2 parser.
If a unknown subtype is encountered it is better to fail.


# 1.12 28-Jun-2019 claudio

Implement the bits and pieces that are needed to dump MRT_DUMP_V2_RIB_GENERIC
messages and BGP MPLS VPNs.
OK benno@


# 1.11 17-Jun-2019 claudio

Cleanup some spaces here as well. Again no binary change.


Revision tags: OPENBSD_6_5_BASE
# 1.10 25-Feb-2019 claudio

Use struct bgpd_addr instead of a union of sockaddrs to store addresses
in the mrt dump structs. This is more compatible with bgpctl since it uses
struct bgpd_addr in most cases anyway.
OK kn@


Revision tags: OPENBSD_6_4_BASE
# 1.9 20-Jul-2018 claudio

Print the timestamp embedded in mrt files for update and status messages.
Also implemented the extended precision format so microseconds are printed
as well when available. The output is relative to the previous message and
follows what kdump does.
OK benno@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.8 23-Dec-2015 mmcc

Remove NULL-checks before free(). I think I've almost scrubbed the
entire tree of these...


# 1.7 24-Oct-2015 claudio

Implement the missing bits to parse the other MRT message types.
Printing bgp messages is still missing lots but at least it is a start.
I onced abused tcpdump's bgp protocol handler for this but that is an ugly hack.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.6 09-Jan-2015 henning

move the ignore-microsec-timestamp bit from mrt_parse to mrt_parse_dump_mp
fixes a coredump reachable via show mrt file
From: Benjamin Baier <programmer at netzbasis dot de>, ok claudio


# 1.5 08-Oct-2014 deraadt

Use reallocarray() throughout to spot multiplicative int overflow.
ok henning benno


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.4 07-May-2013 jsg

fix some leaks in error paths
ok claudio@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.3 26-Mar-2012 claudio

Add a function to extract an address instead of copying the same code over
and over again. Also allow the dump attr of struct mrt_parser to be NULL.


# 1.2 06-Mar-2012 claudio

Implement a better way to detect the encoding of the MP_REACH_NLRI attr.
Check the addr length value of the RFC 6396 encoding to decide if it is
one or not. While there try to make the comment more clear.


Revision tags: OPENBSD_5_1_BASE
# 1.1 21-Sep-2011 claudio

Make it possible to parse MRT table dumps (all 3 formats) and display
them like the show rib / show rib detail output. It is also possible
to filter the output. e.g.
bgpctl show mrt file ./bview.20110914.1600 as 22512 204.209.0.0/16 all
OK sthen@, put it in henning@


# 1.18 17-Aug-2022 claudio

Use memset() instead of bzero().
OK tb@ deraadt@


Revision tags: OPENBSD_7_1_BASE
# 1.17 06-Feb-2022 claudio

Switch from u_intX_t types to stdint.h uintX_t like it was done in bgpd.
OK florian@ tb@


Revision tags: OPENBSD_7_0_BASE
# 1.16 22-Sep-2021 claudio

Adjust handling of RIB_GENERIC_ADDPATH MRT messages. Parse it the way
OpenBGPD and GoBGP dump so that it works with all the MRT implementations
out there supporting this.
While there do some additional minor cleanup.
OK deraadt@


# 1.15 27-Jul-2021 claudio

Implemnt the RFC8050 in the MRT parser. With this MRT dumps containing
add-path information will be dumped properly.

There is one bit where this implementation is not in line with the RFC.
The encoding of DUMP_V2_RIB_GENERIC_ADDPATH for non IPv4 or IPv6 prefixes
is implemented the way gobgp did it (which seems to be the only other BGP
implementation that supports generic encoding). The RFC puts the path_id
in the NLRI for generic encoding instead of adding it to RIB entry struct
like in the IPv4 and IPv6 encoding. This is an open discussion point with
the RFC author.

OK benno@


Revision tags: OPENBSD_6_9_BASE
# 1.14 18-Jan-2021 claudio

Adjust code to the change of struct bgpd_addr in bgpd.
OK denis@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.13 03-Jul-2019 claudio

Add a default case to subtype switch in the table v2 parser.
If a unknown subtype is encountered it is better to fail.


# 1.12 28-Jun-2019 claudio

Implement the bits and pieces that are needed to dump MRT_DUMP_V2_RIB_GENERIC
messages and BGP MPLS VPNs.
OK benno@


# 1.11 17-Jun-2019 claudio

Cleanup some spaces here as well. Again no binary change.


Revision tags: OPENBSD_6_5_BASE
# 1.10 25-Feb-2019 claudio

Use struct bgpd_addr instead of a union of sockaddrs to store addresses
in the mrt dump structs. This is more compatible with bgpctl since it uses
struct bgpd_addr in most cases anyway.
OK kn@


Revision tags: OPENBSD_6_4_BASE
# 1.9 20-Jul-2018 claudio

Print the timestamp embedded in mrt files for update and status messages.
Also implemented the extended precision format so microseconds are printed
as well when available. The output is relative to the previous message and
follows what kdump does.
OK benno@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.8 23-Dec-2015 mmcc

Remove NULL-checks before free(). I think I've almost scrubbed the
entire tree of these...


# 1.7 24-Oct-2015 claudio

Implement the missing bits to parse the other MRT message types.
Printing bgp messages is still missing lots but at least it is a start.
I onced abused tcpdump's bgp protocol handler for this but that is an ugly hack.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.6 09-Jan-2015 henning

move the ignore-microsec-timestamp bit from mrt_parse to mrt_parse_dump_mp
fixes a coredump reachable via show mrt file
From: Benjamin Baier <programmer at netzbasis dot de>, ok claudio


# 1.5 08-Oct-2014 deraadt

Use reallocarray() throughout to spot multiplicative int overflow.
ok henning benno


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.4 07-May-2013 jsg

fix some leaks in error paths
ok claudio@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.3 26-Mar-2012 claudio

Add a function to extract an address instead of copying the same code over
and over again. Also allow the dump attr of struct mrt_parser to be NULL.


# 1.2 06-Mar-2012 claudio

Implement a better way to detect the encoding of the MP_REACH_NLRI attr.
Check the addr length value of the RFC 6396 encoding to decide if it is
one or not. While there try to make the comment more clear.


Revision tags: OPENBSD_5_1_BASE
# 1.1 21-Sep-2011 claudio

Make it possible to parse MRT table dumps (all 3 formats) and display
them like the show rib / show rib detail output. It is also possible
to filter the output. e.g.
bgpctl show mrt file ./bview.20110914.1600 as 22512 204.209.0.0/16 all
OK sthen@, put it in henning@


# 1.17 06-Feb-2022 claudio

Switch from u_intX_t types to stdint.h uintX_t like it was done in bgpd.
OK florian@ tb@


Revision tags: OPENBSD_7_0_BASE
# 1.16 22-Sep-2021 claudio

Adjust handling of RIB_GENERIC_ADDPATH MRT messages. Parse it the way
OpenBGPD and GoBGP dump so that it works with all the MRT implementations
out there supporting this.
While there do some additional minor cleanup.
OK deraadt@


# 1.15 27-Jul-2021 claudio

Implemnt the RFC8050 in the MRT parser. With this MRT dumps containing
add-path information will be dumped properly.

There is one bit where this implementation is not in line with the RFC.
The encoding of DUMP_V2_RIB_GENERIC_ADDPATH for non IPv4 or IPv6 prefixes
is implemented the way gobgp did it (which seems to be the only other BGP
implementation that supports generic encoding). The RFC puts the path_id
in the NLRI for generic encoding instead of adding it to RIB entry struct
like in the IPv4 and IPv6 encoding. This is an open discussion point with
the RFC author.

OK benno@


Revision tags: OPENBSD_6_9_BASE
# 1.14 18-Jan-2021 claudio

Adjust code to the change of struct bgpd_addr in bgpd.
OK denis@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.13 03-Jul-2019 claudio

Add a default case to subtype switch in the table v2 parser.
If a unknown subtype is encountered it is better to fail.


# 1.12 28-Jun-2019 claudio

Implement the bits and pieces that are needed to dump MRT_DUMP_V2_RIB_GENERIC
messages and BGP MPLS VPNs.
OK benno@


# 1.11 17-Jun-2019 claudio

Cleanup some spaces here as well. Again no binary change.


Revision tags: OPENBSD_6_5_BASE
# 1.10 25-Feb-2019 claudio

Use struct bgpd_addr instead of a union of sockaddrs to store addresses
in the mrt dump structs. This is more compatible with bgpctl since it uses
struct bgpd_addr in most cases anyway.
OK kn@


Revision tags: OPENBSD_6_4_BASE
# 1.9 20-Jul-2018 claudio

Print the timestamp embedded in mrt files for update and status messages.
Also implemented the extended precision format so microseconds are printed
as well when available. The output is relative to the previous message and
follows what kdump does.
OK benno@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.8 23-Dec-2015 mmcc

Remove NULL-checks before free(). I think I've almost scrubbed the
entire tree of these...


# 1.7 24-Oct-2015 claudio

Implement the missing bits to parse the other MRT message types.
Printing bgp messages is still missing lots but at least it is a start.
I onced abused tcpdump's bgp protocol handler for this but that is an ugly hack.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.6 09-Jan-2015 henning

move the ignore-microsec-timestamp bit from mrt_parse to mrt_parse_dump_mp
fixes a coredump reachable via show mrt file
From: Benjamin Baier <programmer at netzbasis dot de>, ok claudio


# 1.5 08-Oct-2014 deraadt

Use reallocarray() throughout to spot multiplicative int overflow.
ok henning benno


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.4 07-May-2013 jsg

fix some leaks in error paths
ok claudio@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.3 26-Mar-2012 claudio

Add a function to extract an address instead of copying the same code over
and over again. Also allow the dump attr of struct mrt_parser to be NULL.


# 1.2 06-Mar-2012 claudio

Implement a better way to detect the encoding of the MP_REACH_NLRI attr.
Check the addr length value of the RFC 6396 encoding to decide if it is
one or not. While there try to make the comment more clear.


Revision tags: OPENBSD_5_1_BASE
# 1.1 21-Sep-2011 claudio

Make it possible to parse MRT table dumps (all 3 formats) and display
them like the show rib / show rib detail output. It is also possible
to filter the output. e.g.
bgpctl show mrt file ./bview.20110914.1600 as 22512 204.209.0.0/16 all
OK sthen@, put it in henning@


Revision tags: OPENBSD_7_0_BASE
# 1.16 22-Sep-2021 claudio

Adjust handling of RIB_GENERIC_ADDPATH MRT messages. Parse it the way
OpenBGPD and GoBGP dump so that it works with all the MRT implementations
out there supporting this.
While there do some additional minor cleanup.
OK deraadt@


# 1.15 27-Jul-2021 claudio

Implemnt the RFC8050 in the MRT parser. With this MRT dumps containing
add-path information will be dumped properly.

There is one bit where this implementation is not in line with the RFC.
The encoding of DUMP_V2_RIB_GENERIC_ADDPATH for non IPv4 or IPv6 prefixes
is implemented the way gobgp did it (which seems to be the only other BGP
implementation that supports generic encoding). The RFC puts the path_id
in the NLRI for generic encoding instead of adding it to RIB entry struct
like in the IPv4 and IPv6 encoding. This is an open discussion point with
the RFC author.

OK benno@


Revision tags: OPENBSD_6_9_BASE
# 1.14 18-Jan-2021 claudio

Adjust code to the change of struct bgpd_addr in bgpd.
OK denis@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.13 03-Jul-2019 claudio

Add a default case to subtype switch in the table v2 parser.
If a unknown subtype is encountered it is better to fail.


# 1.12 28-Jun-2019 claudio

Implement the bits and pieces that are needed to dump MRT_DUMP_V2_RIB_GENERIC
messages and BGP MPLS VPNs.
OK benno@


# 1.11 17-Jun-2019 claudio

Cleanup some spaces here as well. Again no binary change.


Revision tags: OPENBSD_6_5_BASE
# 1.10 25-Feb-2019 claudio

Use struct bgpd_addr instead of a union of sockaddrs to store addresses
in the mrt dump structs. This is more compatible with bgpctl since it uses
struct bgpd_addr in most cases anyway.
OK kn@


Revision tags: OPENBSD_6_4_BASE
# 1.9 20-Jul-2018 claudio

Print the timestamp embedded in mrt files for update and status messages.
Also implemented the extended precision format so microseconds are printed
as well when available. The output is relative to the previous message and
follows what kdump does.
OK benno@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.8 23-Dec-2015 mmcc

Remove NULL-checks before free(). I think I've almost scrubbed the
entire tree of these...


# 1.7 24-Oct-2015 claudio

Implement the missing bits to parse the other MRT message types.
Printing bgp messages is still missing lots but at least it is a start.
I onced abused tcpdump's bgp protocol handler for this but that is an ugly hack.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.6 09-Jan-2015 henning

move the ignore-microsec-timestamp bit from mrt_parse to mrt_parse_dump_mp
fixes a coredump reachable via show mrt file
From: Benjamin Baier <programmer at netzbasis dot de>, ok claudio


# 1.5 08-Oct-2014 deraadt

Use reallocarray() throughout to spot multiplicative int overflow.
ok henning benno


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.4 07-May-2013 jsg

fix some leaks in error paths
ok claudio@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.3 26-Mar-2012 claudio

Add a function to extract an address instead of copying the same code over
and over again. Also allow the dump attr of struct mrt_parser to be NULL.


# 1.2 06-Mar-2012 claudio

Implement a better way to detect the encoding of the MP_REACH_NLRI attr.
Check the addr length value of the RFC 6396 encoding to decide if it is
one or not. While there try to make the comment more clear.


Revision tags: OPENBSD_5_1_BASE
# 1.1 21-Sep-2011 claudio

Make it possible to parse MRT table dumps (all 3 formats) and display
them like the show rib / show rib detail output. It is also possible
to filter the output. e.g.
bgpctl show mrt file ./bview.20110914.1600 as 22512 204.209.0.0/16 all
OK sthen@, put it in henning@


# 1.15 27-Jul-2021 claudio

Implemnt the RFC8050 in the MRT parser. With this MRT dumps containing
add-path information will be dumped properly.

There is one bit where this implementation is not in line with the RFC.
The encoding of DUMP_V2_RIB_GENERIC_ADDPATH for non IPv4 or IPv6 prefixes
is implemented the way gobgp did it (which seems to be the only other BGP
implementation that supports generic encoding). The RFC puts the path_id
in the NLRI for generic encoding instead of adding it to RIB entry struct
like in the IPv4 and IPv6 encoding. This is an open discussion point with
the RFC author.

OK benno@


Revision tags: OPENBSD_6_9_BASE
# 1.14 18-Jan-2021 claudio

Adjust code to the change of struct bgpd_addr in bgpd.
OK denis@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.13 03-Jul-2019 claudio

Add a default case to subtype switch in the table v2 parser.
If a unknown subtype is encountered it is better to fail.


# 1.12 28-Jun-2019 claudio

Implement the bits and pieces that are needed to dump MRT_DUMP_V2_RIB_GENERIC
messages and BGP MPLS VPNs.
OK benno@


# 1.11 17-Jun-2019 claudio

Cleanup some spaces here as well. Again no binary change.


Revision tags: OPENBSD_6_5_BASE
# 1.10 25-Feb-2019 claudio

Use struct bgpd_addr instead of a union of sockaddrs to store addresses
in the mrt dump structs. This is more compatible with bgpctl since it uses
struct bgpd_addr in most cases anyway.
OK kn@


Revision tags: OPENBSD_6_4_BASE
# 1.9 20-Jul-2018 claudio

Print the timestamp embedded in mrt files for update and status messages.
Also implemented the extended precision format so microseconds are printed
as well when available. The output is relative to the previous message and
follows what kdump does.
OK benno@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.8 23-Dec-2015 mmcc

Remove NULL-checks before free(). I think I've almost scrubbed the
entire tree of these...


# 1.7 24-Oct-2015 claudio

Implement the missing bits to parse the other MRT message types.
Printing bgp messages is still missing lots but at least it is a start.
I onced abused tcpdump's bgp protocol handler for this but that is an ugly hack.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.6 09-Jan-2015 henning

move the ignore-microsec-timestamp bit from mrt_parse to mrt_parse_dump_mp
fixes a coredump reachable via show mrt file
From: Benjamin Baier <programmer at netzbasis dot de>, ok claudio


# 1.5 08-Oct-2014 deraadt

Use reallocarray() throughout to spot multiplicative int overflow.
ok henning benno


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.4 07-May-2013 jsg

fix some leaks in error paths
ok claudio@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.3 26-Mar-2012 claudio

Add a function to extract an address instead of copying the same code over
and over again. Also allow the dump attr of struct mrt_parser to be NULL.


# 1.2 06-Mar-2012 claudio

Implement a better way to detect the encoding of the MP_REACH_NLRI attr.
Check the addr length value of the RFC 6396 encoding to decide if it is
one or not. While there try to make the comment more clear.


Revision tags: OPENBSD_5_1_BASE
# 1.1 21-Sep-2011 claudio

Make it possible to parse MRT table dumps (all 3 formats) and display
them like the show rib / show rib detail output. It is also possible
to filter the output. e.g.
bgpctl show mrt file ./bview.20110914.1600 as 22512 204.209.0.0/16 all
OK sthen@, put it in henning@


# 1.14 18-Jan-2021 claudio

Adjust code to the change of struct bgpd_addr in bgpd.
OK denis@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.13 03-Jul-2019 claudio

Add a default case to subtype switch in the table v2 parser.
If a unknown subtype is encountered it is better to fail.


# 1.12 28-Jun-2019 claudio

Implement the bits and pieces that are needed to dump MRT_DUMP_V2_RIB_GENERIC
messages and BGP MPLS VPNs.
OK benno@


# 1.11 17-Jun-2019 claudio

Cleanup some spaces here as well. Again no binary change.


Revision tags: OPENBSD_6_5_BASE
# 1.10 25-Feb-2019 claudio

Use struct bgpd_addr instead of a union of sockaddrs to store addresses
in the mrt dump structs. This is more compatible with bgpctl since it uses
struct bgpd_addr in most cases anyway.
OK kn@


Revision tags: OPENBSD_6_4_BASE
# 1.9 20-Jul-2018 claudio

Print the timestamp embedded in mrt files for update and status messages.
Also implemented the extended precision format so microseconds are printed
as well when available. The output is relative to the previous message and
follows what kdump does.
OK benno@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.8 23-Dec-2015 mmcc

Remove NULL-checks before free(). I think I've almost scrubbed the
entire tree of these...


# 1.7 24-Oct-2015 claudio

Implement the missing bits to parse the other MRT message types.
Printing bgp messages is still missing lots but at least it is a start.
I onced abused tcpdump's bgp protocol handler for this but that is an ugly hack.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.6 09-Jan-2015 henning

move the ignore-microsec-timestamp bit from mrt_parse to mrt_parse_dump_mp
fixes a coredump reachable via show mrt file
From: Benjamin Baier <programmer at netzbasis dot de>, ok claudio


# 1.5 08-Oct-2014 deraadt

Use reallocarray() throughout to spot multiplicative int overflow.
ok henning benno


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.4 07-May-2013 jsg

fix some leaks in error paths
ok claudio@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.3 26-Mar-2012 claudio

Add a function to extract an address instead of copying the same code over
and over again. Also allow the dump attr of struct mrt_parser to be NULL.


# 1.2 06-Mar-2012 claudio

Implement a better way to detect the encoding of the MP_REACH_NLRI attr.
Check the addr length value of the RFC 6396 encoding to decide if it is
one or not. While there try to make the comment more clear.


Revision tags: OPENBSD_5_1_BASE
# 1.1 21-Sep-2011 claudio

Make it possible to parse MRT table dumps (all 3 formats) and display
them like the show rib / show rib detail output. It is also possible
to filter the output. e.g.
bgpctl show mrt file ./bview.20110914.1600 as 22512 204.209.0.0/16 all
OK sthen@, put it in henning@


# 1.13 03-Jul-2019 claudio

Add a default case to subtype switch in the table v2 parser.
If a unknown subtype is encountered it is better to fail.


# 1.12 28-Jun-2019 claudio

Implement the bits and pieces that are needed to dump MRT_DUMP_V2_RIB_GENERIC
messages and BGP MPLS VPNs.
OK benno@


# 1.11 17-Jun-2019 claudio

Cleanup some spaces here as well. Again no binary change.


Revision tags: OPENBSD_6_5_BASE
# 1.10 25-Feb-2019 claudio

Use struct bgpd_addr instead of a union of sockaddrs to store addresses
in the mrt dump structs. This is more compatible with bgpctl since it uses
struct bgpd_addr in most cases anyway.
OK kn@


Revision tags: OPENBSD_6_4_BASE
# 1.9 20-Jul-2018 claudio

Print the timestamp embedded in mrt files for update and status messages.
Also implemented the extended precision format so microseconds are printed
as well when available. The output is relative to the previous message and
follows what kdump does.
OK benno@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.8 23-Dec-2015 mmcc

Remove NULL-checks before free(). I think I've almost scrubbed the
entire tree of these...


# 1.7 24-Oct-2015 claudio

Implement the missing bits to parse the other MRT message types.
Printing bgp messages is still missing lots but at least it is a start.
I onced abused tcpdump's bgp protocol handler for this but that is an ugly hack.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.6 09-Jan-2015 henning

move the ignore-microsec-timestamp bit from mrt_parse to mrt_parse_dump_mp
fixes a coredump reachable via show mrt file
From: Benjamin Baier <programmer at netzbasis dot de>, ok claudio


# 1.5 08-Oct-2014 deraadt

Use reallocarray() throughout to spot multiplicative int overflow.
ok henning benno


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.4 07-May-2013 jsg

fix some leaks in error paths
ok claudio@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.3 26-Mar-2012 claudio

Add a function to extract an address instead of copying the same code over
and over again. Also allow the dump attr of struct mrt_parser to be NULL.


# 1.2 06-Mar-2012 claudio

Implement a better way to detect the encoding of the MP_REACH_NLRI attr.
Check the addr length value of the RFC 6396 encoding to decide if it is
one or not. While there try to make the comment more clear.


Revision tags: OPENBSD_5_1_BASE
# 1.1 21-Sep-2011 claudio

Make it possible to parse MRT table dumps (all 3 formats) and display
them like the show rib / show rib detail output. It is also possible
to filter the output. e.g.
bgpctl show mrt file ./bview.20110914.1600 as 22512 204.209.0.0/16 all
OK sthen@, put it in henning@


# 1.12 28-Jun-2019 claudio

Implement the bits and pieces that are needed to dump MRT_DUMP_V2_RIB_GENERIC
messages and BGP MPLS VPNs.
OK benno@


# 1.11 17-Jun-2019 claudio

Cleanup some spaces here as well. Again no binary change.


Revision tags: OPENBSD_6_5_BASE
# 1.10 25-Feb-2019 claudio

Use struct bgpd_addr instead of a union of sockaddrs to store addresses
in the mrt dump structs. This is more compatible with bgpctl since it uses
struct bgpd_addr in most cases anyway.
OK kn@


Revision tags: OPENBSD_6_4_BASE
# 1.9 20-Jul-2018 claudio

Print the timestamp embedded in mrt files for update and status messages.
Also implemented the extended precision format so microseconds are printed
as well when available. The output is relative to the previous message and
follows what kdump does.
OK benno@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.8 23-Dec-2015 mmcc

Remove NULL-checks before free(). I think I've almost scrubbed the
entire tree of these...


# 1.7 24-Oct-2015 claudio

Implement the missing bits to parse the other MRT message types.
Printing bgp messages is still missing lots but at least it is a start.
I onced abused tcpdump's bgp protocol handler for this but that is an ugly hack.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.6 09-Jan-2015 henning

move the ignore-microsec-timestamp bit from mrt_parse to mrt_parse_dump_mp
fixes a coredump reachable via show mrt file
From: Benjamin Baier <programmer at netzbasis dot de>, ok claudio


# 1.5 08-Oct-2014 deraadt

Use reallocarray() throughout to spot multiplicative int overflow.
ok henning benno


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.4 07-May-2013 jsg

fix some leaks in error paths
ok claudio@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.3 26-Mar-2012 claudio

Add a function to extract an address instead of copying the same code over
and over again. Also allow the dump attr of struct mrt_parser to be NULL.


# 1.2 06-Mar-2012 claudio

Implement a better way to detect the encoding of the MP_REACH_NLRI attr.
Check the addr length value of the RFC 6396 encoding to decide if it is
one or not. While there try to make the comment more clear.


Revision tags: OPENBSD_5_1_BASE
# 1.1 21-Sep-2011 claudio

Make it possible to parse MRT table dumps (all 3 formats) and display
them like the show rib / show rib detail output. It is also possible
to filter the output. e.g.
bgpctl show mrt file ./bview.20110914.1600 as 22512 204.209.0.0/16 all
OK sthen@, put it in henning@


# 1.11 17-Jun-2019 claudio

Cleanup some spaces here as well. Again no binary change.


Revision tags: OPENBSD_6_5_BASE
# 1.10 25-Feb-2019 claudio

Use struct bgpd_addr instead of a union of sockaddrs to store addresses
in the mrt dump structs. This is more compatible with bgpctl since it uses
struct bgpd_addr in most cases anyway.
OK kn@


Revision tags: OPENBSD_6_4_BASE
# 1.9 20-Jul-2018 claudio

Print the timestamp embedded in mrt files for update and status messages.
Also implemented the extended precision format so microseconds are printed
as well when available. The output is relative to the previous message and
follows what kdump does.
OK benno@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.8 23-Dec-2015 mmcc

Remove NULL-checks before free(). I think I've almost scrubbed the
entire tree of these...


# 1.7 24-Oct-2015 claudio

Implement the missing bits to parse the other MRT message types.
Printing bgp messages is still missing lots but at least it is a start.
I onced abused tcpdump's bgp protocol handler for this but that is an ugly hack.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.6 09-Jan-2015 henning

move the ignore-microsec-timestamp bit from mrt_parse to mrt_parse_dump_mp
fixes a coredump reachable via show mrt file
From: Benjamin Baier <programmer at netzbasis dot de>, ok claudio


# 1.5 08-Oct-2014 deraadt

Use reallocarray() throughout to spot multiplicative int overflow.
ok henning benno


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.4 07-May-2013 jsg

fix some leaks in error paths
ok claudio@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.3 26-Mar-2012 claudio

Add a function to extract an address instead of copying the same code over
and over again. Also allow the dump attr of struct mrt_parser to be NULL.


# 1.2 06-Mar-2012 claudio

Implement a better way to detect the encoding of the MP_REACH_NLRI attr.
Check the addr length value of the RFC 6396 encoding to decide if it is
one or not. While there try to make the comment more clear.


Revision tags: OPENBSD_5_1_BASE
# 1.1 21-Sep-2011 claudio

Make it possible to parse MRT table dumps (all 3 formats) and display
them like the show rib / show rib detail output. It is also possible
to filter the output. e.g.
bgpctl show mrt file ./bview.20110914.1600 as 22512 204.209.0.0/16 all
OK sthen@, put it in henning@


# 1.10 25-Feb-2019 claudio

Use struct bgpd_addr instead of a union of sockaddrs to store addresses
in the mrt dump structs. This is more compatible with bgpctl since it uses
struct bgpd_addr in most cases anyway.
OK kn@


Revision tags: OPENBSD_6_4_BASE
# 1.9 20-Jul-2018 claudio

Print the timestamp embedded in mrt files for update and status messages.
Also implemented the extended precision format so microseconds are printed
as well when available. The output is relative to the previous message and
follows what kdump does.
OK benno@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.8 23-Dec-2015 mmcc

Remove NULL-checks before free(). I think I've almost scrubbed the
entire tree of these...


# 1.7 24-Oct-2015 claudio

Implement the missing bits to parse the other MRT message types.
Printing bgp messages is still missing lots but at least it is a start.
I onced abused tcpdump's bgp protocol handler for this but that is an ugly hack.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.6 09-Jan-2015 henning

move the ignore-microsec-timestamp bit from mrt_parse to mrt_parse_dump_mp
fixes a coredump reachable via show mrt file
From: Benjamin Baier <programmer at netzbasis dot de>, ok claudio


# 1.5 08-Oct-2014 deraadt

Use reallocarray() throughout to spot multiplicative int overflow.
ok henning benno


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.4 07-May-2013 jsg

fix some leaks in error paths
ok claudio@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.3 26-Mar-2012 claudio

Add a function to extract an address instead of copying the same code over
and over again. Also allow the dump attr of struct mrt_parser to be NULL.


# 1.2 06-Mar-2012 claudio

Implement a better way to detect the encoding of the MP_REACH_NLRI attr.
Check the addr length value of the RFC 6396 encoding to decide if it is
one or not. While there try to make the comment more clear.


Revision tags: OPENBSD_5_1_BASE
# 1.1 21-Sep-2011 claudio

Make it possible to parse MRT table dumps (all 3 formats) and display
them like the show rib / show rib detail output. It is also possible
to filter the output. e.g.
bgpctl show mrt file ./bview.20110914.1600 as 22512 204.209.0.0/16 all
OK sthen@, put it in henning@


# 1.9 20-Jul-2018 claudio

Print the timestamp embedded in mrt files for update and status messages.
Also implemented the extended precision format so microseconds are printed
as well when available. The output is relative to the previous message and
follows what kdump does.
OK benno@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.8 23-Dec-2015 mmcc

Remove NULL-checks before free(). I think I've almost scrubbed the
entire tree of these...


# 1.7 24-Oct-2015 claudio

Implement the missing bits to parse the other MRT message types.
Printing bgp messages is still missing lots but at least it is a start.
I onced abused tcpdump's bgp protocol handler for this but that is an ugly hack.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.6 09-Jan-2015 henning

move the ignore-microsec-timestamp bit from mrt_parse to mrt_parse_dump_mp
fixes a coredump reachable via show mrt file
From: Benjamin Baier <programmer at netzbasis dot de>, ok claudio


# 1.5 08-Oct-2014 deraadt

Use reallocarray() throughout to spot multiplicative int overflow.
ok henning benno


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.4 07-May-2013 jsg

fix some leaks in error paths
ok claudio@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.3 26-Mar-2012 claudio

Add a function to extract an address instead of copying the same code over
and over again. Also allow the dump attr of struct mrt_parser to be NULL.


# 1.2 06-Mar-2012 claudio

Implement a better way to detect the encoding of the MP_REACH_NLRI attr.
Check the addr length value of the RFC 6396 encoding to decide if it is
one or not. While there try to make the comment more clear.


Revision tags: OPENBSD_5_1_BASE
# 1.1 21-Sep-2011 claudio

Make it possible to parse MRT table dumps (all 3 formats) and display
them like the show rib / show rib detail output. It is also possible
to filter the output. e.g.
bgpctl show mrt file ./bview.20110914.1600 as 22512 204.209.0.0/16 all
OK sthen@, put it in henning@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.8 23-Dec-2015 mmcc

Remove NULL-checks before free(). I think I've almost scrubbed the
entire tree of these...


# 1.7 24-Oct-2015 claudio

Implement the missing bits to parse the other MRT message types.
Printing bgp messages is still missing lots but at least it is a start.
I onced abused tcpdump's bgp protocol handler for this but that is an ugly hack.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.6 09-Jan-2015 henning

move the ignore-microsec-timestamp bit from mrt_parse to mrt_parse_dump_mp
fixes a coredump reachable via show mrt file
From: Benjamin Baier <programmer at netzbasis dot de>, ok claudio


# 1.5 08-Oct-2014 deraadt

Use reallocarray() throughout to spot multiplicative int overflow.
ok henning benno


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.4 07-May-2013 jsg

fix some leaks in error paths
ok claudio@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.3 26-Mar-2012 claudio

Add a function to extract an address instead of copying the same code over
and over again. Also allow the dump attr of struct mrt_parser to be NULL.


# 1.2 06-Mar-2012 claudio

Implement a better way to detect the encoding of the MP_REACH_NLRI attr.
Check the addr length value of the RFC 6396 encoding to decide if it is
one or not. While there try to make the comment more clear.


Revision tags: OPENBSD_5_1_BASE
# 1.1 21-Sep-2011 claudio

Make it possible to parse MRT table dumps (all 3 formats) and display
them like the show rib / show rib detail output. It is also possible
to filter the output. e.g.
bgpctl show mrt file ./bview.20110914.1600 as 22512 204.209.0.0/16 all
OK sthen@, put it in henning@