1. 01 Sep, 2019 4 commits
    • David S. Miller's avatar
      Merge branch 'net-tls-add-socket-diag' · 1b6ca07b
      David S. Miller authored
      Davide Caratti says:
      
      ====================
      net: tls: add socket diag
      
      The current kernel does not provide any diagnostic tool, except
      getsockopt(TCP_ULP), to know more about TCP sockets that have an upper
      layer protocol (ULP) on top of them. This series extends the set of
      information exported by INET_DIAG_INFO, to include data that are
      specific to the ULP (and that might be meaningful for debug/testing
      purposes).
      
      patch 1/3 ensures that the control plane reads/updates ULP specific data
      using RCU.
      
      patch 2/3 extends INET_DIAG_INFO and allows knowing the ULP name for
      each TCP socket that has done setsockopt(TCP_ULP) successfully.
      
      patch 3/3 extends kTLS to let programs like 'ss' know the protocol
      version and the cipher in use.
      
      Changes since v2:
      - remove unneeded #ifdef and fix reverse christmas tree in
        tls_get_info(), thanks to Jakub Kicinski
      
      Changes since v1:
      - don't worry about grace period when accessing ulp_ops, thanks to
        Jakub Kicinski and Eric Dumazet
      - use rcu_dereference() to access ULP data in tls get_info(), and
        test against NULL value, thanks to Jakub Kicinski
      - move RCU protected section inside tls get_info(), thanks to Jakub
        Kicinski
      
      Changes since RFC:
      - some coding style fixes, thanks to Jakub Kicinski
      - add X_UNSPEC as lowest value of uAPI enums, thanks to Jakub Kicinski
      - fix assignment of struct nlattr *start, thanks to Jakub Kicinski
      - let tls dump RXCONF and TXCONF, suggested by Jakub Kicinski
      - don't dump anything if TLS version or cipher are 0 (but still return a
        constant size in get_aux_size()), thanks to Boris Pismenny
      - constify first argument of get_info() and get_size()
      - use RCU to access access ulp_ops, like it's done for ca_ops
      - add patch 1/3, from Jakub Kicinski
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1b6ca07b
    • Davide Caratti's avatar
      net: tls: export protocol version, cipher, tx_conf/rx_conf to socket diag · 26811cc9
      Davide Caratti authored
      When an application configures kernel TLS on top of a TCP socket, it's
      now possible for inet_diag_handler() to collect information regarding the
      protocol version, the cipher type and TX / RX configuration, in case
      INET_DIAG_INFO is requested.
      Signed-off-by: default avatarDavide Caratti <dcaratti@redhat.com>
      Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      26811cc9
    • Davide Caratti's avatar
      tcp: ulp: add functions to dump ulp-specific information · 61723b39
      Davide Caratti authored
      currently, only getsockopt(TCP_ULP) can be invoked to know if a ULP is on
      top of a TCP socket. Extend idiag_get_aux() and idiag_get_aux_size(),
      introduced by commit b37e8840 ("inet_diag: allow protocols to provide
      additional data"), to report the ULP name and other information that can
      be made available by the ULP through optional functions.
      
      Users having CAP_NET_ADMIN privileges will then be able to retrieve this
      information through inet_diag_handler, if they specify INET_DIAG_INFO in
      the request.
      Signed-off-by: default avatarDavide Caratti <dcaratti@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      61723b39
    • Jakub Kicinski's avatar
      net/tls: use RCU protection on icsk->icsk_ulp_data · 15a7dea7
      Jakub Kicinski authored
      We need to make sure context does not get freed while diag
      code is interrogating it. Free struct tls_context with
      kfree_rcu().
      
      We add the __rcu annotation directly in icsk, and cast it
      away in the datapath accessor. Presumably all ULPs will
      do a similar thing.
      Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      15a7dea7
  2. 31 Aug, 2019 12 commits
  3. 30 Aug, 2019 24 commits