Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

1. `mctp-client` binary now handles the `cxl-cci` MCTP message type

### Fixes

1. In v2.6. we lost the peer initial MTU sematics, which gave us a safe minimum
MTU on peer routes when peers were added. This is now fixed - peer routes
will have an MTU set to the link-reported minimum, as introduced in v2.1.

## [2.6] - 2026-07-21

### Added
Expand Down
7 changes: 4 additions & 3 deletions src/mctpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2048,6 +2048,10 @@ static int add_peer(struct ctx *ctx, const dest_phys *dest, mctp_eid_t eid,
peer->state = REMOTE;
peer->ctx = ctx;

// Set minimum MTU by default for compatibility. Clients can increase
// this with .SetMTU as needed
peer->mtu = mctp_nl_min_mtu_byindex(ctx->nl, peer->phys.ifindex);

// Update network eid map
n->peers[eid] = peer;

Expand Down Expand Up @@ -3531,9 +3535,6 @@ static int setup_added_peer(struct peer *peer)
bug_warn("%s Bad net %u", __func__, peer->net);
return -EPROTO;
}
// Set minimum MTU by default for compatibility. Clients can increase
// this with .SetMTU as needed
peer->mtu = mctp_nl_min_mtu_byindex(peer->ctx->nl, peer->phys.ifindex);

rc = query_peer_properties(peer);
if (rc < 0)
Expand Down
7 changes: 5 additions & 2 deletions tests/mctpenv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,10 @@ def _parse_route(self, msg):
gw = msg.get_attr('RTA_GATEWAY')
start_eid = msg.get_attr('RTA_DST')
extent_eid = msg['dst_len']
# todo: RTAX metrics: MTU
mtu = 0
metrics = msg.get_attr('RTA_METRICS')
if metrics:
mtu = metrics.get_attr('RTAX_MTU', default=0)

if ifindex:
iface = self.system.find_interface_by_ifindex(ifindex)
Expand All @@ -1236,7 +1239,7 @@ def _parse_route(self, msg):
gw = (gw['net'], gw['eid'])
iface = None

return System.Route(start_eid, extent_eid, iface=iface, gw=gw)
return System.Route(start_eid, extent_eid, iface=iface, gw=gw, mtu=mtu)

async def _handle_getroute(self, msg):
dump = bool(msg['header']['flags'] & netlink.NLM_F_DUMP)
Expand Down
16 changes: 16 additions & 0 deletions tests/test_mctpd.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,22 @@ async def test_setup_endpoint_no_get_uuid(dbus, mctpd):
assert eid == ep.eid


async def test_setup_endpoint_mtu(dbus, mctpd):
"""Newly-added endpoints should start with a minimum MTU"""
iface = mctpd.system.interfaces[0]
ep = mctpd.network.endpoints[0]

# ensure we can distinguish a correct min mtu from a no-mtu case
assert iface.min_mtu != 0

mctp = await mctpd_mctp_iface_obj(dbus, iface)
(eid, net, path, new) = await mctp.call_setup_endpoint(ep.lladdr)

assert len(mctpd.system.routes) == 1
route = mctpd.system.routes[0]
assert route.mtu == iface.min_mtu


async def test_remove_endpoint(dbus, mctpd):
"""Test neighbour removal"""
iface = mctpd.system.interfaces[0]
Expand Down
Loading