Skip to content

Commit 9328fbb

Browse files
mctpd: update setup peer logic for bridged endpoints
For bridged endpoints, route setup is already done once pool space is allocated successfully. These are destined to be routed from the bridge itself. Add appropiate check to avoid extra route creation while setting up bridged endpoints. Signed-off-by: Faizan Ali <faizana@nvidia.com>
1 parent 5211a29 commit 9328fbb

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/mctpd.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2855,14 +2855,21 @@ static int peer_route_update(struct peer *peer, uint16_t type)
28552855
* The peer's route has already been set up */
28562856
static int setup_added_peer(struct peer *peer)
28572857
{
2858+
struct net *n = lookup_net(peer->ctx, peer->net);
28582859
int rc;
28592860

2861+
if (!n) {
2862+
bug_warn("%s Bad net %u", __func__, peer->net);
2863+
return -EPROTO;
2864+
}
28602865
// Set minimum MTU by default for compatibility. Clients can increase
28612866
// this with .SetMTU as needed
28622867
peer->mtu = mctp_nl_min_mtu_byindex(peer->ctx->nl, peer->phys.ifindex);
28632868

2864-
// add route before querying
2865-
add_peer_route(peer);
2869+
// add route before querying for non-bridged endpoints.
2870+
// bridged endpoints will use the bridge's pool range route.
2871+
if (!is_eid_in_bridge_pool(n, peer->ctx, peer->eid))
2872+
add_peer_route(peer);
28662873

28672874
rc = query_peer_properties(peer);
28682875
if (rc < 0)

0 commit comments

Comments
 (0)