diff options
| author | Philippe Guibert <philippe.guibert@6wind.com> | 2022-11-03 21:17:57 +0100 |
|---|---|---|
| committer | Philippe Guibert <philippe.guibert@6wind.com> | 2023-02-10 10:27:23 +0100 |
| commit | e55b08839914a3b94f361ee909ee63d265d07845 (patch) | |
| tree | 258aa3c96dfaefebaca81283ed35a2c2b7456684 /lib/asn.h | |
| parent | 8079a4138d61500117ebbffb250ceba0a894f9c0 (diff) | |
bgpd: add as-notation keyword to 'router bgp' vty command
A new keyword permits changing the BGP as-notation output:
- [no] router bgp <> [vrf BLABLA] [as-notation [<dot|plain|dot+>]]
At the BGP instance creation, the output will inherit the way the
BGP instance is declared. For instance, the 'router bgp 1.1'
command will configure the output in the dot format. However, if
the client wants to choose an alternate output, he will have to
add the extra command: 'router bgp 1.1 as-notation dot+'.
Also, if the user wants to have plain format, even if the BGP
instance is declared in dot format, the keyword can also be used
for that.
The as-notation output is only taken into account at the BGP
instance creation. In the case where VPN instances are used,
a separate instance may be dynamically created. In that case,
the real as-notation format will be taken into acccount at the
first configuration.
Linking the as-notation format with the BGP instance makes sense,
as the operators want to keep consistency of what they configure.
One technical reason why to link the as-notation output with the
BGP instance creation is that the as-path segment lists stored
in the BGP updates use a string representation to handle aspath
operations (by using regexp for instance). Changing on the fly
the output needs to regenerate this string representation to the
correct format. Linking the configuration to the BGP instance
creation avoids refreshing the BGP updates. A similar mechanism
is put in place in junos too.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'lib/asn.h')
| -rw-r--r-- | lib/asn.h | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -31,6 +31,13 @@ extern "C" { #define ASN_STRING_MAX_SIZE 12 +enum asnotation_mode { + ASNOTATION_PLAIN = 0, + ASNOTATION_DOT, + ASNOTATION_DOTPLUS, + ASNOTATION_UNDEFINED, +}; + typedef uint32_t as_t; extern bool asn_str2asn(const char *asstring, as_t *asn); @@ -38,6 +45,9 @@ extern const char *asn_asn2asplain(as_t asn); extern const char *asn_str2asn_parse(const char *asstring, as_t *asn, bool *found_ptr); extern enum match_type asn_str2asn_match(const char *str); +extern bool asn_str2asn_notation(const char *asstring, as_t *asn, + enum asnotation_mode *asnotation); +extern const char *asn_mode2str(enum asnotation_mode asnotation); /* for test */ extern void asn_relax_as_zero(bool relax); |
