Skip to content

Allow null-EID requests & responses with extended addressing #10

@fxxJuses

Description

@fxxJuses

Description:

When the BMC is configured as an MCTP Endpoint and receives an Endpoint Discovery request (with a target EID of 0xFF) from the Bus Owner, the mctpd userspace daemon attempts to send a response using physical addressing.

Our analysis of the Linux kernel's MCTP protocol stack (net/mctp/) reveals a conflict that prevents this response from being routed:

  1. EID Registration Restriction: The kernel's mctp_address_unicast() function (used by mctp_rtm_newaddr for EID registration via Netlink) does not permit 0x00 (MCTP_ADDR_NULL) or 0xFF (MCTP_ADDR_ANY) EIDs to be registered as local addresses to an mctp_dev. This means that if the mctp_dev corresponding to the BMC's interface has not yet been assigned a unicast EID (0x01-0xFE), its addrs list will be empty, and num_addrs will be 0.

  2. Blocking Outbound Traffic: The mctp_local_output() function (in route.c), which is responsible for processing all outbound MCTP packets, includes a critical check:

    if (rt->dev->num_addrs == 0) {
        rc = -EHOSTUNREACH;
    } else {
        saddr = rt->dev->addrs[0];
        rc = 0;
    }
    if (rc)
        goto out_release;

    If rt->dev->num_addrs is 0 (as described in point 1), rc is set to -EHOSTUNREACH, and the function immediately exits, preventing the packet from being sent.

  3. mctpd's Intent: The mctpd daemon (specifically handle_control_endpoint_discovery and endpoint_query_phys) intends to send a response. endpoint_query_phys even contains a comment: "The kernel mctp stack has special handling for eid=0 to make sure we can recv a response on the socket, so it's important to set eid=0 here in the request." This suggests an expectation of kernel support for 0x00 EID handling, possibly for source EIDs in discovery responses. However, our analysis indicates this handling is not present for outbound traffic when no valid EIDs are registered.

Consequence:
As a result, if a BMC (acting as an Endpoint) has no assigned EID, it cannot send an Endpoint Discovery response with a 0x00 source EID (or any source EID) back to the Bus Owner, because the kernel stack blocks the transmission. This hinders the successful completion of the Endpoint Discovery process from the Endpoint's perspective.

Proposed Question for CodeConstruct:
What is the recommended solution or workflow for a BMC in an Endpoint role to successfully respond to Endpoint Discovery requests when its mctp_dev has no assigned EID, given the current Linux kernel MCTP stack's behavior? Are there specific configurations, a sequence of Netlink commands, or a userspace workaround to enable this scenario?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions