]> git.proxmox.com Git - mirror_frr.git/commit - bgpd/bgp_nexthop.c
bgpd: support for as notation format for route distinguisher
authorPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 22 Nov 2022 08:57:10 +0000 (09:57 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 10 Feb 2023 09:27:23 +0000 (10:27 +0100)
commit4a8cd6ad7f3a9b1eabfbc1dd42b8f1b8ba9d3b97
tree775477ae6c4d6742dca32415dbb01b1c3e72dbf5
parent44a4d55ed803c92a92c53491b57e26b354e8cbfc
bgpd: support for as notation format for route distinguisher

RD may be built based on an AS number. Like for the AS, the RD
may use the AS notation. The two below examples can illustrate:

RD 1.1:20 stands for an AS4B:NN RD with AS4B=65536 in dot format.
RD 0.1:20 stands for an AS2B:NNNN RD with AS2B=0.1 in dot+ format.

This commit adds the asnotation mode to prefix_rd2str() API so as
to pick up the relevant display.

Two new printfrr extensions are available to display the RD with
the two above display methods.
- The pRDD extension stands for dot asnotation format
- The pRDE extension stands for dot+ asnotation format.
- The pRD extension has been renamed to pRDP extension

The code is changed each time '%pRD' printf extension is called.
Possibly, the asnotation may change the output, then a macro defines
the asnotation mode to use. A side effect of forging the mode to
use is that the string could not be concatenated with other strings
in vty_out and snprintfrr. Those functions have been called multiple
times. When zlog_debug needs to display the RD with some other string,
the prefix_rd2str() old API is used instead of the printf extension.

Some code has been kept untouched:
- code related to running-config. Actually, wherever an RD is displayed,
its configured name should be dumped.
- bgp rfapi code
- bgp evpn multihoming code (partially done), since the logic is
missing to get the asnotation of 'struct bgp_evpn_es'.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
19 files changed:
bgpd/bgp_debug.c
bgpd/bgp_evpn_mh.c
bgpd/bgp_evpn_vty.c
bgpd/bgp_mplsvpn.c
bgpd/bgp_mplsvpn_snmp.c
bgpd/bgp_nexthop.c
bgpd/bgp_nht.c
bgpd/bgp_rd.c
bgpd/bgp_rd.h
bgpd/bgp_route.c
bgpd/bgp_vty.c
bgpd/rfapi/bgp_rfapi_cfg.c
bgpd/rfapi/rfapi.c
bgpd/rfapi/rfapi_import.c
bgpd/rfapi/rfapi_rib.c
bgpd/rfapi/rfapi_vty.c
lib/asn.c
lib/asn.h
lib/prefix.h