summaryrefslogtreecommitdiff
path: root/bgpd/bgp_open.c
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2025-02-07 14:00:59 -0500
committerGitHub <noreply@github.com>2025-02-07 14:00:59 -0500
commit2ef76a33506f39d98038d5239f0620e2bbf33d8c (patch)
tree429bc11a3ad346a64c85082a36e9ce2c91655ae5 /bgpd/bgp_open.c
parenteebe460168fe15869ca0eb948072fcd691de0953 (diff)
parentdb853cc97eafee8742cd391aaa2b5bc58a6751ae (diff)
Merge pull request #17871 from opensourcerouting/feature/bgp_link_local_capability
bgpd: Implement Link-Local Next Hop capability
Diffstat (limited to 'bgpd/bgp_open.c')
-rw-r--r--bgpd/bgp_open.c16
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()) {