diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2025-01-08 22:51:14 +0200 |
|---|---|---|
| committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2025-01-17 16:48:32 +0200 |
| commit | db853cc97eafee8742cd391aaa2b5bc58a6751ae (patch) | |
| tree | 8423a0503d3e7c9c0e682f3f6cdcc25a9293190d /bgpd/bgp_open.c | |
| parent | d3c46bce3b0db5bb4dd7fb460fce0f7aa1e908a5 (diff) | |
bgpd: Implement Link-Local Next Hop capability
Related: https://datatracker.ietf.org/doc/html/draft-white-linklocal-capability
TL;DR; use 16 bytes long next-hops for point-to-point (unnumbered) links instead
of sending 32 bytes (::/LL, GUA/LL, LL/LL combinations).
For backward compatiblity we should handle even 32 bytes existing next hops.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_open.c')
| -rw-r--r-- | bgpd/bgp_open.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index 6451c7cf38..be04d87b74 100644 --- a/bgpd/bgp_open.c +++ b/bgpd/bgp_open.c @@ -43,6 +43,7 @@ const struct message capcode_str[] = { { CAPABILITY_CODE_ROLE, "Role" }, { CAPABILITY_CODE_SOFT_VERSION, "Software Version" }, { CAPABILITY_CODE_PATHS_LIMIT, "Paths-Limit" }, + { CAPABILITY_CODE_LINK_LOCAL, "Link-Local Next Hop" }, { 0 } }; @@ -63,6 +64,7 @@ const size_t cap_minsizes[] = { [CAPABILITY_CODE_ROLE] = CAPABILITY_CODE_ROLE_LEN, [CAPABILITY_CODE_SOFT_VERSION] = CAPABILITY_CODE_SOFT_VERSION_LEN, [CAPABILITY_CODE_PATHS_LIMIT] = CAPABILITY_CODE_PATHS_LIMIT_LEN, + [CAPABILITY_CODE_LINK_LOCAL] = CAPABILITY_CODE_LINK_LOCAL_LEN, }; /* value the capability must be a multiple of. @@ -1067,6 +1069,7 @@ static int bgp_capability_parse(struct peer *peer, size_t length, case CAPABILITY_CODE_ROLE: case CAPABILITY_CODE_SOFT_VERSION: case CAPABILITY_CODE_PATHS_LIMIT: + case CAPABILITY_CODE_LINK_LOCAL: /* Check length. */ if (caphdr.length < cap_minsizes[caphdr.code]) { zlog_info( @@ -1168,6 +1171,9 @@ static int bgp_capability_parse(struct peer *peer, size_t length, case CAPABILITY_CODE_SOFT_VERSION: ret = bgp_capability_software_version(peer, &caphdr); break; + case CAPABILITY_CODE_LINK_LOCAL: + SET_FLAG(peer->cap, PEER_CAP_LINK_LOCAL_RCV); + break; case CAPABILITY_CODE_PATHS_LIMIT: ret = bgp_capability_paths_limit(peer, &caphdr); break; @@ -1968,6 +1974,16 @@ uint16_t bgp_open_capability(struct stream *s, struct peer *peer, stream_putc(s, CAPABILITY_CODE_DYNAMIC_LEN); } + /* Link-Local Next Hop capability. */ + if (peergroup_flag_check(peer, PEER_FLAG_CAPABILITY_LINK_LOCAL)) { + SET_FLAG(peer->cap, PEER_CAP_LINK_LOCAL_ADV); + stream_putc(s, BGP_OPEN_OPT_CAP); + ext_opt_params ? stream_putw(s, CAPABILITY_CODE_LINK_LOCAL_LEN + 2) + : stream_putc(s, CAPABILITY_CODE_LINK_LOCAL_LEN + 2); + stream_putc(s, CAPABILITY_CODE_LINK_LOCAL); + stream_putc(s, CAPABILITY_CODE_LINK_LOCAL_LEN); + } + /* FQDN capability */ if (CHECK_FLAG(peer->flags, PEER_FLAG_CAPABILITY_FQDN) && cmd_hostname_get()) { |
