summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2022-04-06 20:36:39 +0200
committerGitHub <noreply@github.com>2022-04-06 20:36:39 +0200
commit5451fbc1922a5164125ac4680ff44b15171123ae (patch)
treea78da34960ed866322dd504bfdfd7b4627fb30a1 /bgpd
parentMerge pull request #10971 from opensourcerouting/fix/rpki_nits (diff)
parentbgpd: refactor type of srv6_locator_chunks list (diff)
downloadfrr-5451fbc1922a5164125ac4680ff44b15171123ae.tar.xz
frr-5451fbc1922a5164125ac4680ff44b15171123ae.zip
Merge pull request #10927 from bobuhiro11/refactor_srv6_locator_chunks
bgpd: refactor type of srv6_locator_chunks list
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_mplsvpn.c6
-rw-r--r--bgpd/bgp_vty.c6
-rw-r--r--bgpd/bgp_zebra.c22
3 files changed, 17 insertions, 17 deletions
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index 32a1d9a15..08a68d0c1 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -523,7 +523,7 @@ static uint32_t alloc_new_sid(struct bgp *bgp, uint32_t index,
struct in6_addr *sid_locator)
{
struct listnode *node;
- struct prefix_ipv6 *chunk;
+ struct srv6_locator_chunk *chunk;
struct in6_addr sid_buf;
bool alloced = false;
int label = 0;
@@ -532,8 +532,8 @@ static uint32_t alloc_new_sid(struct bgp *bgp, uint32_t index,
return false;
for (ALL_LIST_ELEMENTS_RO(bgp->srv6_locator_chunks, node, chunk)) {
- *sid_locator = chunk->prefix;
- sid_buf = chunk->prefix;
+ *sid_locator = chunk->prefix.prefix;
+ sid_buf = chunk->prefix.prefix;
if (index != 0) {
label = index << 12;
transpose_sid(&sid_buf, label, 64, 16);
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 54237604b..941696ab7 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -286,7 +286,7 @@ static int bgp_srv6_locator_unset(struct bgp *bgp)
{
int ret;
struct listnode *node, *nnode;
- struct prefix_ipv6 *chunk;
+ struct srv6_locator_chunk *chunk;
struct bgp_srv6_function *func;
struct bgp *bgp_vrf;
struct in6_addr *tovpn_sid;
@@ -9316,7 +9316,7 @@ DEFPY (show_bgp_srv6,
{
struct bgp *bgp;
struct listnode *node;
- struct prefix_ipv6 *chunk;
+ struct srv6_locator_chunk *chunk;
struct bgp_srv6_function *func;
struct in6_addr *tovpn4_sid;
struct in6_addr *tovpn6_sid;
@@ -9331,7 +9331,7 @@ DEFPY (show_bgp_srv6,
vty_out(vty, "locator_name: %s\n", bgp->srv6_locator_name);
vty_out(vty, "locator_chunks:\n");
for (ALL_LIST_ELEMENTS_RO(bgp->srv6_locator_chunks, node, chunk)) {
- prefix2str(chunk, buf, sizeof(buf));
+ prefix2str(&chunk->prefix, buf, sizeof(buf));
vty_out(vty, "- %s\n", buf);
}
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 78eaac780..77b8a8ab9 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -3155,26 +3155,26 @@ static int bgp_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS)
struct stream *s = NULL;
struct bgp *bgp = bgp_get_default();
struct listnode *node;
- struct prefix_ipv6 *c;
- struct srv6_locator_chunk s6c = {};
- struct prefix_ipv6 *chunk = NULL;
+ struct srv6_locator_chunk *c;
+ struct srv6_locator_chunk *chunk = srv6_locator_chunk_alloc();
s = zclient->ibuf;
- zapi_srv6_locator_chunk_decode(s, &s6c);
+ zapi_srv6_locator_chunk_decode(s, chunk);
- if (strcmp(bgp->srv6_locator_name, s6c.locator_name) != 0) {
+ if (strcmp(bgp->srv6_locator_name, chunk->locator_name) != 0) {
zlog_err("%s: Locator name unmatch %s:%s", __func__,
- bgp->srv6_locator_name, s6c.locator_name);
+ bgp->srv6_locator_name, chunk->locator_name);
+ srv6_locator_chunk_free(chunk);
return 0;
}
for (ALL_LIST_ELEMENTS_RO(bgp->srv6_locator_chunks, node, c)) {
- if (!prefix_cmp(c, &s6c.prefix))
+ if (!prefix_cmp(&c->prefix, &chunk->prefix)) {
+ srv6_locator_chunk_free(chunk);
return 0;
+ }
}
- chunk = prefix_ipv6_new();
- *chunk = s6c.prefix;
listnode_add(bgp->srv6_locator_chunks, chunk);
vpn_leak_postchange_all();
return 0;
@@ -3203,7 +3203,7 @@ static int bgp_zebra_process_srv6_locator_delete(ZAPI_CALLBACK_ARGS)
struct srv6_locator loc = {};
struct bgp *bgp = bgp_get_default();
struct listnode *node, *nnode;
- struct prefix_ipv6 *chunk;
+ struct srv6_locator_chunk *chunk;
struct bgp_srv6_function *func;
struct bgp *bgp_vrf;
struct in6_addr *tovpn_sid;
@@ -3215,7 +3215,7 @@ static int bgp_zebra_process_srv6_locator_delete(ZAPI_CALLBACK_ARGS)
// refresh chunks
for (ALL_LIST_ELEMENTS(bgp->srv6_locator_chunks, node, nnode, chunk))
if (prefix_match((struct prefix *)&loc.prefix,
- (struct prefix *)chunk))
+ (struct prefix *)&chunk->prefix))
listnode_delete(bgp->srv6_locator_chunks, chunk);
// refresh functions