diff options
author | Nobuhiro MIKI <nmiki@yahoo-corp.jp> | 2022-04-06 06:40:14 +0200 |
---|---|---|
committer | Nobuhiro MIKI <nmiki@yahoo-corp.jp> | 2022-04-06 06:40:14 +0200 |
commit | 1c21a23453a707cedbc0097336c0be34d125b739 (patch) | |
tree | 7d56002d0a724b5bf21f6c50be398f2ff6683eee /bgpd | |
parent | Merge pull request #10965 from opensourcerouting/fix/pim_igmp_group_delete (diff) | |
download | frr-1c21a23453a707cedbc0097336c0be34d125b739.tar.xz frr-1c21a23453a707cedbc0097336c0be34d125b739.zip |
bgpd: refactor type of srv6_locator_chunks list
Since additional information such as block_bits_length is needed to
generate SIDs properly, the type of elements in srv6_locator_chunks
list is extended from "struct prefix_ipv6 *" to
"struct srv6_locator_chunk *". Even in terms of variable name,
"struct srv6_locator_chunk *" is appropriate.
Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
Diffstat (limited to 'bgpd')
-rw-r--r-- | bgpd/bgp_mplsvpn.c | 6 | ||||
-rw-r--r-- | bgpd/bgp_vty.c | 6 | ||||
-rw-r--r-- | bgpd/bgp_zebra.c | 22 |
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 |