summaryrefslogtreecommitdiff
path: root/bgpd/bgp_snmp_bgp4v2.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2024-12-17 15:56:19 -0500
committerDonald Sharp <sharpd@nvidia.com>2025-01-10 10:07:11 -0500
commit78fa9b6feb0fc0fb0e9c3ff2db571c813e4b88ea (patch)
tree05542ed9d58e9304efbd10846f15930561dc069d /bgpd/bgp_snmp_bgp4v2.c
parent0e416ff157341b69276e122a404837a22c890105 (diff)
bgpd: su_remote and su_local are properties of the connection
su_local and su_remote in the peer can change based upon if we are initiating the remote connection or receiving it. As such we need to treat it as a property of the connection. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'bgpd/bgp_snmp_bgp4v2.c')
-rw-r--r--bgpd/bgp_snmp_bgp4v2.c47
1 files changed, 20 insertions, 27 deletions
diff --git a/bgpd/bgp_snmp_bgp4v2.c b/bgpd/bgp_snmp_bgp4v2.c
index 5f36e29876..724eefe601 100644
--- a/bgpd/bgp_snmp_bgp4v2.c
+++ b/bgpd/bgp_snmp_bgp4v2.c
@@ -208,49 +208,42 @@ static uint8_t *bgpv2PeerTable(struct variable *v, oid name[], size_t *length,
case BGP4V2_PEER_INSTANCE:
return SNMP_INTEGER(peer->bgp->vrf_id);
case BGP4V2_PEER_LOCAL_ADDR_TYPE:
- if (peer->su_local)
- return SNMP_INTEGER(peer->su_local->sa.sa_family ==
- AF_INET
+ if (peer->connection->su_local)
+ return SNMP_INTEGER(peer->connection->su_local->sa.sa_family == AF_INET
? AFI_IP
: AFI_IP6);
else
return SNMP_INTEGER(0);
case BGP4V2_PEER_LOCAL_ADDR:
- if (peer->su_local)
- if (peer->su_local->sa.sa_family == AF_INET)
- return SNMP_IPADDRESS(
- peer->su_local->sin.sin_addr);
+ if (peer->connection->su_local)
+ if (peer->connection->su_local->sa.sa_family == AF_INET)
+ return SNMP_IPADDRESS(peer->connection->su_local->sin.sin_addr);
else
- return SNMP_IP6ADDRESS(
- peer->su_local->sin6.sin6_addr);
+ return SNMP_IP6ADDRESS(peer->connection->su_local->sin6.sin6_addr);
else
return SNMP_IPADDRESS(bgp_empty_addr);
case BGP4V2_PEER_REMOTE_ADDR_TYPE:
- if (peer->su_remote)
- return SNMP_INTEGER(peer->su_remote->sa.sa_family ==
- AF_INET
+ if (peer->connection->su_remote)
+ return SNMP_INTEGER(peer->connection->su_remote->sa.sa_family == AF_INET
? AFI_IP
: AFI_IP6);
else
return SNMP_INTEGER(0);
case BGP4V2_PEER_REMOTE_ADDR:
- if (peer->su_remote)
- if (peer->su_remote->sa.sa_family == AF_INET)
- return SNMP_IPADDRESS(
- peer->su_remote->sin.sin_addr);
+ if (peer->connection->su_remote)
+ if (peer->connection->su_remote->sa.sa_family == AF_INET)
+ return SNMP_IPADDRESS(peer->connection->su_remote->sin.sin_addr);
else
- return SNMP_IP6ADDRESS(
- peer->su_remote->sin6.sin6_addr);
+ return SNMP_IP6ADDRESS(peer->connection->su_remote->sin6.sin6_addr);
else
return SNMP_IPADDRESS(bgp_empty_addr);
case BGP4V2_PEER_LOCAL_PORT:
- if (peer->su_local)
- if (peer->su_local->sa.sa_family == AF_INET)
- return SNMP_INTEGER(
- ntohs(peer->su_local->sin.sin_port));
+ if (peer->connection->su_local)
+ if (peer->connection->su_local->sa.sa_family == AF_INET)
+ return SNMP_INTEGER(ntohs(peer->connection->su_local->sin.sin_port));
else
return SNMP_INTEGER(
- ntohs(peer->su_local->sin6.sin6_port));
+ ntohs(peer->connection->su_local->sin6.sin6_port));
else
return SNMP_INTEGER(0);
case BGP4V2_PEER_LOCAL_AS:
@@ -258,13 +251,13 @@ static uint8_t *bgpv2PeerTable(struct variable *v, oid name[], size_t *length,
case BGP4V2_PEER_LOCAL_IDENTIFIER:
return SNMP_IPADDRESS(peer->local_id);
case BGP4V2_PEER_REMOTE_PORT:
- if (peer->su_remote)
- if (peer->su_remote->sa.sa_family == AF_INET)
+ if (peer->connection->su_remote)
+ if (peer->connection->su_remote->sa.sa_family == AF_INET)
return SNMP_INTEGER(
- ntohs(peer->su_remote->sin.sin_port));
+ ntohs(peer->connection->su_remote->sin.sin_port));
else
return SNMP_INTEGER(
- ntohs(peer->su_remote->sin6.sin6_port));
+ ntohs(peer->connection->su_remote->sin6.sin6_port));
else
return SNMP_INTEGER(0);
case BGP4V2_PEER_REMOTE_AS: