From: Donald Sharp Date: Wed, 25 Sep 2024 16:09:40 +0000 (-0400) Subject: zebra: Correctly report metrics X-Git-Tag: docker/9.0.5~24^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=addf6c53028f43ccbbea007b52a7824449cc8b3e;p=matthieu%2Ffrr.git zebra: Correctly report metrics Report the routes metric in IPFORWARDMETRIC1 and return -1 for the other metrics as required by the IP-FORWARD-MIB. inetCidrRouteMetric2 OBJECT-TYPE SYNTAX Integer32 MAX-ACCESS read-create STATUS current DESCRIPTION "An alternate routing metric for this route. The semantics of this metric are determined by the routing- protocol specified in the route's inetCidrRouteProto value. If this metric is not used, its value should be set to -1." DEFVAL { -1 } ::= { inetCidrRouteEntry 13 } I've included metric2 but it's the same for all of them. Signed-off-by: Donald Sharp (cherry picked from commit e41ae0acc1940b568def5018efad3df019023f85) --- diff --git a/zebra/zebra_snmp.c b/zebra/zebra_snmp.c index b6ef6fc519..ee21724e8c 100644 --- a/zebra/zebra_snmp.c +++ b/zebra/zebra_snmp.c @@ -490,23 +490,23 @@ static uint8_t *ipFwTable(struct variable *v, oid objid[], size_t *objid_len, *val_len = sizeof(int); return (uint8_t *)&result; case IPFORWARDMETRIC1: - result = 0; + result = re->metric; *val_len = sizeof(int); return (uint8_t *)&result; case IPFORWARDMETRIC2: - result = 0; + result = -1; *val_len = sizeof(int); return (uint8_t *)&result; case IPFORWARDMETRIC3: - result = 0; + result = -1; *val_len = sizeof(int); return (uint8_t *)&result; case IPFORWARDMETRIC4: - result = 0; + result = -1; *val_len = sizeof(int); return (uint8_t *)&result; case IPFORWARDMETRIC5: - result = 0; + result = -1; *val_len = sizeof(int); return (uint8_t *)&result; default: