17 Aug, 2020

1 commit

  • Xiumei reported a bug with espintcp over IPv6 in transport mode,
    because xfrm6_transport_finish expects to find IP6CB data (struct
    inet6_skb_cb). Currently, espintcp zeroes the CB, but the relevant
    part is actually preserved by previous layers (first set up by tcp,
    then strparser only zeroes a small part of tcp_skb_tb), so we can just
    relocate it to the start of skb->cb.

    Fixes: e27cca96cd68 ("xfrm: add espintcp (RFC 8229)")
    Reported-by: Xiumei Mu
    Signed-off-by: Sabrina Dubroca
    Signed-off-by: Steffen Klassert

    Sabrina Dubroca
     

30 Jul, 2020

2 commits

  • Currently, espintcp_rcv drops packets silently, which makes debugging
    issues difficult. Count packets as either XfrmInHdrError (when the
    packet was too short or contained invalid data) or XfrmInError (for
    other issues).

    Signed-off-by: Sabrina Dubroca
    Signed-off-by: Steffen Klassert

    Sabrina Dubroca
     
  • Currently, short messages (less than 4 bytes after the length header)
    will break the stream of messages. This is unnecessary, since we can
    still parse messages even if they're too short to contain any usable
    data. This is also bogus, as keepalive messages (a single 0xff byte),
    though not needed with TCP encapsulation, should be allowed.

    This patch changes the stream parser so that short messages are
    accepted and dropped in the kernel. Messages that contain a valid SPI
    or non-ESP header are processed as before.

    Fixes: e27cca96cd68 ("xfrm: add espintcp (RFC 8229)")
    Reported-by: Andrew Cagney
    Signed-off-by: Sabrina Dubroca
    Signed-off-by: Steffen Klassert

    Sabrina Dubroca
     

17 Jul, 2020

2 commits

  • man 2 recv says:

    RETURN VALUE

    When a stream socket peer has performed an orderly shutdown, the
    return value will be 0 (the traditional "end-of-file" return).

    Currently, this works for blocking reads, but non-blocking reads will
    return -EAGAIN. This patch overwrites that return value when the peer
    won't send us any more data.

    Fixes: e27cca96cd68 ("xfrm: add espintcp (RFC 8229)")
    Reported-by: Andrew Cagney
    Tested-by: Andrew Cagney
    Signed-off-by: Sabrina Dubroca
    Signed-off-by: Steffen Klassert

    Sabrina Dubroca
     
  • Currently, non-blocking sends from userspace result in EOPNOTSUPP.

    To support this, we need to tell espintcp_sendskb_locked() and
    espintcp_sendskmsg_locked() that non-blocking operation was requested
    from espintcp_sendmsg().

    Fixes: e27cca96cd68 ("xfrm: add espintcp (RFC 8229)")
    Reported-by: Andrew Cagney
    Tested-by: Andrew Cagney
    Signed-off-by: Sabrina Dubroca
    Signed-off-by: Steffen Klassert

    Sabrina Dubroca
     

01 Jun, 2020

1 commit

  • xdp_umem.c had overlapping changes between the 64-bit math fix
    for the calculation of npgs and the removal of the zerocopy
    memory type which got rid of the chunk_size_nohdr member.

    The mlx5 Kconfig conflict is a case where we just take the
    net-next copy of the Kconfig entry dependency as it takes on
    the ESWITCH dependency by one level of indirection which is
    what the 'net' conflicting change is trying to ensure.

    Signed-off-by: David S. Miller

    David S. Miller
     

28 Apr, 2020

1 commit

  • This extends espintcp to support IPv6, building on the existing code
    and the new UDPv6 encapsulation support. Most of the code is either
    reused directly (stream parser, ULP) or very similar to the IPv4
    variant (net/ipv6/esp6.c changes).

    The separation of config options for IPv4 and IPv6 espintcp requires a
    bit of Kconfig gymnastics to enable the core code.

    Signed-off-by: Sabrina Dubroca
    Signed-off-by: Steffen Klassert

    Sabrina Dubroca
     

20 Apr, 2020

1 commit

  • When ESP encapsulation is enabled on a TCP socket, I'm replacing the
    existing ->sk_destruct callback with espintcp_destruct. We still need to
    call the old callback to perform the other cleanups when the socket is
    destroyed. Save the old callback, and call it from espintcp_destruct.

    Fixes: e27cca96cd68 ("xfrm: add espintcp (RFC 8229)")
    Signed-off-by: Sabrina Dubroca
    Signed-off-by: Steffen Klassert

    Sabrina Dubroca
     

29 Feb, 2020

1 commit

  • The only users for such argument are the UDP protocol and the UNIX
    socket family. We can safely reclaim the accounted memory directly
    from the UDP code and, after the previous patch, we can do scm
    stats accounting outside the datagram helpers.

    Overall this cleans up a bit some datagram-related helpers, and
    avoids an indirect call per packet in the UDP receive path.

    v1 -> v2:
    - call scm_stat_del() only when not peeking - Kirill
    - fix build issue with CONFIG_INET_ESPINTCP

    Signed-off-by: Paolo Abeni
    Reviewed-by: Kirill Tkhai
    Reviewed-by: Willem de Bruijn
    Signed-off-by: David S. Miller

    Paolo Abeni
     

09 Dec, 2019

1 commit

  • TCP encapsulation of IKE and IPsec messages (RFC 8229) is implemented
    as a TCP ULP, overriding in particular the sendmsg and recvmsg
    operations. A Stream Parser is used to extract messages out of the TCP
    stream using the first 2 bytes as length marker. Received IKE messages
    are put on "ike_queue", waiting to be dequeued by the custom recvmsg
    implementation. Received ESP messages are sent to XFRM, like with UDP
    encapsulation.

    Some of this code is taken from the original submission by Herbert
    Xu. Currently, only IPv4 is supported, like for UDP encapsulation.

    Co-developed-by: Herbert Xu
    Signed-off-by: Herbert Xu
    Signed-off-by: Sabrina Dubroca
    Acked-by: David S. Miller
    Signed-off-by: Steffen Klassert

    Sabrina Dubroca