14 Apr, 2022

1 commit

  • [ Upstream commit 60be976ac45137657b7b505d7e0d44d0e51accb7 ]

    dev_hard_header() returns the length of the header, so
    we need to test for negative errors rather than non-zero.

    Fixes: 889b7da23abf ("mctp: Add initial routing framework")
    Signed-off-by: Matt Johnston
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Matt Johnston
     

08 Dec, 2021

1 commit

  • [ Upstream commit 76d001603c509562181f3787a7065b8e163bc7b9 ]

    We need to test against the existing route type, not
    the rtm_type in the netlink request.

    Fixes: 83f0a0b7285b ("mctp: Specify route types, require rtm_type in RTM_*ROUTE messages")
    Signed-off-by: Matt Johnston
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Matt Johnston
     

19 Nov, 2021

1 commit

  • commit 1e4b50f06d970d8da3474d2a0354450416710bda upstream.

    In order to have the padding fields actually usable in the future,
    there have to be checks that user space doesn't supply non-zero garbage
    there. It is also worth setting these padding fields to zero, unless
    it is known that they have been already zeroed.

    Cc: stable@vger.kernel.org # v5.15
    Fixes: 5a20dd46b8b84593 ("mctp: Be explicit about struct sockaddr_mctp padding")
    Signed-off-by: Eugene Syromiatnikov
    Acked-by: Jeremy Kerr
    Signed-off-by: Jakub Kicinski
    Signed-off-by: Greg Kroah-Hartman

    Eugene Syromiatnikov
     

08 Sep, 2021

1 commit

  • The kernel test robot reports:

    [ 843.509974][ T345] =============================
    [ 843.524220][ T345] WARNING: suspicious RCU usage
    [ 843.538791][ T345] 5.14.0-rc2-00606-g889b7da23abf #1 Not tainted
    [ 843.553617][ T345] -----------------------------
    [ 843.567412][ T345] net/mctp/route.c:310 RCU-list traversed in non-reader section!!

    - we're missing the rcu read lock acquire around the destruction path.

    This change adds the acquire/release - the path is already atomic, and
    we're using the _rcu list iterators.

    Reported-by: kernel test robot
    Signed-off-by: Jeremy Kerr
    Signed-off-by: David S. Miller

    Jeremy Kerr
     

12 Aug, 2021

1 commit

  • This change adds a 'type' attribute to routes, which can be parsed from
    a RTM_NEWROUTE message. This will help to distinguish local vs. peer
    routes in a future change.

    This means userspace will need to set a correct rtm_type in RTM_NEWROUTE
    and RTM_DELROUTE messages; we currently only accept RTN_UNICAST.

    Signed-off-by: Jeremy Kerr
    Link: https://lore.kernel.org/r/20210810023834.2231088-1-jk@codeconstruct.com.au
    Signed-off-by: Jakub Kicinski

    Jeremy Kerr
     

05 Aug, 2021

1 commit

  • The pointer hdr is being initialized and also re-assigned with the
    same value from the call to function mctp_hdr. Static analysis reports
    that the initializated value is unused. The second assignment is
    duplicated and can be removed.

    Addresses-Coverity: ("Unused value").
    Signed-off-by: Colin Ian King
    Signed-off-by: David S. Miller

    Colin Ian King
     

29 Jul, 2021

11 commits

  • Currently we have a compile-time default network
    (MCTP_INITIAL_DEFAULT_NET). This change introduces a default_net field
    on the net namespace, allowing future configuration for new interfaces.

    Signed-off-by: Matt Johnston
    Signed-off-by: David S. Miller

    Matt Johnston
     
  • Now that we have a neighbour implementation, hook it up to the output
    path to set the dest hardware address for outgoing packets.

    Signed-off-by: Matt Johnston
    Signed-off-by: David S. Miller

    Matt Johnston
     
  • This change implements MCTP fragmentation (based on route & device MTU),
    and corresponding reassembly.

    The MCTP specification only allows for fragmentation on the originating
    message endpoint, and reassembly on the destination endpoint -
    intermediate nodes do not need to reassemble/refragment. Consequently,
    we only fragment in the local transmit path, and reassemble
    locally-bound packets. Messages are required to be in-order, so we
    simply cancel reassembly on out-of-order or missing packets.

    In the fragmentation path, we just break up the message into MTU-sized
    fragments; the skb structure is a simple copy for now, which we can later
    improve with a shared data implementation.

    For reassembly, we keep track of incoming message fragments using the
    existing tag infrastructure, allocating a key on the (src,dest,tag)
    tuple, and reassembles matching fragments into a skb->frag_list.

    Signed-off-by: Jeremy Kerr
    Signed-off-by: David S. Miller

    Jeremy Kerr
     
  • Start filling-out the socket syscalls: bind, sendmsg & recvmsg.

    This requires an input route implementation, so we add to
    mctp_route_input, allowing lookups on binds & message tags. This just
    handles single-packet messages at present, we will add fragmentation in
    a future change.

    Signed-off-by: Jeremy Kerr
    Signed-off-by: David S. Miller

    Jeremy Kerr
     
  • This change adds the netlink interfaces for manipulating the MCTP
    neighbour table.

    Signed-off-by: Matt Johnston
    Signed-off-by: David S. Miller

    Matt Johnston
     
  • Add an initial neighbour table implementation, to be used in the route
    output path.

    Signed-off-by: Matt Johnston
    Signed-off-by: David S. Miller

    Matt Johnston
     
  • This change adds RTM_GETROUTE, RTM_NEWROUTE & RTM_DELROUTE handlers,
    allowing management of the MCTP route table.

    Includes changes from Jeremy Kerr .

    Signed-off-by: Matt Johnston
    Signed-off-by: David S. Miller

    Matt Johnston
     
  • Add a simple routing table, and a couple of route output handlers, and
    the mctp packet_type & handler.

    Includes changes from Matt Johnston .

    Signed-off-by: Jeremy Kerr
    Signed-off-by: David S. Miller

    Jeremy Kerr
     
  • This change adds the infrastructure for managing MCTP netdevices; we add
    a pointer to the AF_MCTP-specific data to struct netdevice, and hook up
    the rtnetlink operations for adding and removing addresses.

    Includes changes from Matt Johnston .

    Signed-off-by: Jeremy Kerr
    Signed-off-by: David S. Miller

    Jeremy Kerr
     
  • Add an empty socket implementation, plus initialisation/destruction
    handlers.

    Signed-off-by: Jeremy Kerr
    Signed-off-by: David S. Miller

    Jeremy Kerr
     
  • Add basic Kconfig, an initial (empty) af_mctp source object, and
    {AF,PF}_MCTP definitions, and the required definitions for a new
    protocol type.

    Signed-off-by: Jeremy Kerr
    Signed-off-by: David S. Miller

    Jeremy Kerr