mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-29 17:13:46 +00:00
zebra: multipath number checks with NHG proto
Get the multipath number checks working with proto-based NHG message decoding in zapi_msg.c Modify the function that checks this for routes to work without being passed a prefix as is the case with NHG creates. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
This commit is contained in:
parent
8155e8c592
commit
e270f004ae
@ -1445,11 +1445,14 @@ bool zserv_nexthop_num_warn(const char *caller, const struct prefix *p,
|
|||||||
if (nexthop_num > zrouter.multipath_num) {
|
if (nexthop_num > zrouter.multipath_num) {
|
||||||
char buff[PREFIX2STR_BUFFER];
|
char buff[PREFIX2STR_BUFFER];
|
||||||
|
|
||||||
prefix2str(p, buff, sizeof(buff));
|
if (p)
|
||||||
|
prefix2str(p, buff, sizeof(buff));
|
||||||
|
|
||||||
flog_warn(
|
flog_warn(
|
||||||
EC_ZEBRA_MORE_NH_THAN_MULTIPATH,
|
EC_ZEBRA_MORE_NH_THAN_MULTIPATH,
|
||||||
"%s: Prefix %s has %d nexthops, but we can only use the first %d",
|
"%s: Prefix %s has %d nexthops, but we can only use the first %d",
|
||||||
caller, buff, nexthop_num, zrouter.multipath_num);
|
caller, (p ? buff : "(NULL)"), nexthop_num,
|
||||||
|
zrouter.multipath_num);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1767,21 +1770,17 @@ static void zread_nhg_reader(ZAPI_HANDLER_ARGS)
|
|||||||
size_t nhops, i;
|
size_t nhops, i;
|
||||||
struct zapi_nexthop zapi_nexthops[MULTIPATH_NUM];
|
struct zapi_nexthop zapi_nexthops[MULTIPATH_NUM];
|
||||||
struct nexthop_group *nhg = NULL;
|
struct nexthop_group *nhg = NULL;
|
||||||
struct prefix p;
|
|
||||||
uint16_t proto;
|
uint16_t proto;
|
||||||
struct nhg_hash_entry *nhe;
|
struct nhg_hash_entry *nhe;
|
||||||
|
|
||||||
memset(&p, 0, sizeof(p));
|
|
||||||
|
|
||||||
s = msg;
|
s = msg;
|
||||||
|
|
||||||
STREAM_GETW(s, proto);
|
STREAM_GETW(s, proto);
|
||||||
STREAM_GETL(s, id);
|
STREAM_GETL(s, id);
|
||||||
STREAM_GETW(s, nhops);
|
STREAM_GETW(s, nhops);
|
||||||
|
|
||||||
// TODO: Can't use this without a prefix.
|
if (zserv_nexthop_num_warn(__func__, NULL, nhops))
|
||||||
// if (zserv_nexthop_num_warn(__func__, &p, nhops))
|
return;
|
||||||
// return;
|
|
||||||
|
|
||||||
if (nhops <= 0) {
|
if (nhops <= 0) {
|
||||||
flog_warn(EC_ZEBRA_NEXTHOP_CREATION_FAILED,
|
flog_warn(EC_ZEBRA_NEXTHOP_CREATION_FAILED,
|
||||||
@ -1800,8 +1799,8 @@ static void zread_nhg_reader(ZAPI_HANDLER_ARGS)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zapi_read_nexthops(client, &p, zapi_nexthops, 0, 0, nhops, 0, &nhg,
|
if (!zapi_read_nexthops(client, NULL, zapi_nexthops, 0, 0, nhops, 0,
|
||||||
NULL)) {
|
&nhg, NULL)) {
|
||||||
flog_warn(EC_ZEBRA_NEXTHOP_CREATION_FAILED,
|
flog_warn(EC_ZEBRA_NEXTHOP_CREATION_FAILED,
|
||||||
"%s: Nexthop Group Creation failed",
|
"%s: Nexthop Group Creation failed",
|
||||||
__func__);
|
__func__);
|
||||||
|
Loading…
Reference in New Issue
Block a user