mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-09 11:18:52 +00:00
*: eliminate redundant info from srv6 locator zapi
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
This commit is contained in:
parent
04d43dbd02
commit
0548592691
@ -3009,17 +3009,6 @@ static void bgp_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS)
|
|||||||
s = zclient->ibuf;
|
s = zclient->ibuf;
|
||||||
zapi_srv6_locator_chunk_decode(s, &s6c);
|
zapi_srv6_locator_chunk_decode(s, &s6c);
|
||||||
|
|
||||||
if (zclient->redist_default != s6c.proto) {
|
|
||||||
zlog_err("%s: Got SRv6 Manager msg with wrong proto %u",
|
|
||||||
__func__, s6c.proto);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (zclient->instance != s6c.instance) {
|
|
||||||
zlog_err("%s: Got SRv6 Manager msg with wrong instance %u",
|
|
||||||
__func__, s6c.instance);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strcmp(bgp->srv6_locator_name, s6c.locator_name) != 0) {
|
if (strcmp(bgp->srv6_locator_name, s6c.locator_name) != 0) {
|
||||||
zlog_err("%s: Locator name unmatch %s:%s", __func__,
|
zlog_err("%s: Locator name unmatch %s:%s", __func__,
|
||||||
bgp->srv6_locator_name, s6c.locator_name);
|
bgp->srv6_locator_name, s6c.locator_name);
|
||||||
|
@ -1070,8 +1070,6 @@ done:
|
|||||||
int zapi_srv6_locator_chunk_encode(struct stream *s,
|
int zapi_srv6_locator_chunk_encode(struct stream *s,
|
||||||
const struct srv6_locator_chunk *c)
|
const struct srv6_locator_chunk *c)
|
||||||
{
|
{
|
||||||
stream_putc(s, c->proto);
|
|
||||||
stream_putw(s, c->instance);
|
|
||||||
stream_putw(s, strlen(c->locator_name));
|
stream_putw(s, strlen(c->locator_name));
|
||||||
stream_put(s, c->locator_name, strlen(c->locator_name));
|
stream_put(s, c->locator_name, strlen(c->locator_name));
|
||||||
stream_putw(s, c->prefix.prefixlen);
|
stream_putw(s, c->prefix.prefixlen);
|
||||||
@ -1088,8 +1086,8 @@ int zapi_srv6_locator_chunk_decode(struct stream *s,
|
|||||||
{
|
{
|
||||||
uint16_t len = 0;
|
uint16_t len = 0;
|
||||||
|
|
||||||
STREAM_GETC(s, c->proto);
|
c->prefix.family = AF_INET6;
|
||||||
STREAM_GETW(s, c->instance);
|
|
||||||
STREAM_GETW(s, len);
|
STREAM_GETW(s, len);
|
||||||
if (len > SRV6_LOCNAME_SIZE)
|
if (len > SRV6_LOCNAME_SIZE)
|
||||||
goto stream_failure;
|
goto stream_failure;
|
||||||
|
@ -938,52 +938,33 @@ int sharp_zebra_srv6_manager_release_locator_chunk(const char *locator_name)
|
|||||||
static void sharp_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS)
|
static void sharp_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS)
|
||||||
{
|
{
|
||||||
struct stream *s = NULL;
|
struct stream *s = NULL;
|
||||||
uint8_t proto;
|
struct srv6_locator_chunk s6c = {};
|
||||||
uint16_t instance;
|
struct listnode *node, *nnode;
|
||||||
uint16_t len;
|
|
||||||
char name[256] = {0};
|
|
||||||
struct prefix_ipv6 *chunk = NULL;
|
|
||||||
|
|
||||||
chunk = prefix_ipv6_new();
|
|
||||||
|
|
||||||
s = zclient->ibuf;
|
|
||||||
STREAM_GETC(s, proto);
|
|
||||||
STREAM_GETW(s, instance);
|
|
||||||
|
|
||||||
STREAM_GETW(s, len);
|
|
||||||
STREAM_GET(name, s, len);
|
|
||||||
|
|
||||||
STREAM_GETW(s, chunk->prefixlen);
|
|
||||||
STREAM_GET(&chunk->prefix, s, 16);
|
|
||||||
|
|
||||||
if (zclient->redist_default != proto) {
|
|
||||||
zlog_err("Got SRv6 Manager msg with wrong proto %u", proto);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (zclient->instance != instance) {
|
|
||||||
zlog_err("Got SRv6 Manager msg with wrong instance %u", proto);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct listnode *loc_node;
|
|
||||||
struct sharp_srv6_locator *loc;
|
struct sharp_srv6_locator *loc;
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS_RO(sg.srv6_locators, loc_node, loc)) {
|
s = zclient->ibuf;
|
||||||
|
zapi_srv6_locator_chunk_decode(s, &s6c);
|
||||||
|
|
||||||
|
for (ALL_LIST_ELEMENTS(sg.srv6_locators, node, nnode, loc)) {
|
||||||
|
struct prefix_ipv6 *chunk = NULL;
|
||||||
struct listnode *chunk_node;
|
struct listnode *chunk_node;
|
||||||
struct prefix_ipv6 *c;
|
struct prefix_ipv6 *c;
|
||||||
|
|
||||||
if (strcmp(loc->name, name))
|
if (strcmp(loc->name, s6c.locator_name) != 0) {
|
||||||
|
zlog_err("%s: Locator name unmatch %s:%s", __func__,
|
||||||
|
loc->name, s6c.locator_name);
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS_RO(loc->chunks, chunk_node, c))
|
for (ALL_LIST_ELEMENTS_RO(loc->chunks, chunk_node, c))
|
||||||
if (!prefix_cmp(c, chunk))
|
if (!prefix_cmp(c, &s6c.prefix))
|
||||||
return;
|
|
||||||
listnode_add(loc->chunks, chunk);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
stream_failure:
|
chunk = prefix_ipv6_new();
|
||||||
free(chunk);
|
*chunk = s6c.prefix;
|
||||||
|
listnode_add(loc->chunks, chunk);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
zlog_err("%s: can't get locator_chunk!!", __func__);
|
zlog_err("%s: can't get locator_chunk!!", __func__);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user