mbox series

[PATCHv2,net-next,0/2] net: sock: add tracers for inet socket errors

Message ID 20210627224822.4689-1-aahringo@redhat.com (mailing list archive)
Headers show
Series net: sock: add tracers for inet socket errors | expand

Message

Alexander Aring June 27, 2021, 10:48 p.m. UTC
Hi,

this patch series introduce tracers for sk_error_report socket callback
calls. The use-case is that a user space application can monitor them
and making an own heuristic about bad peer connections even over a
socket lifetime. To make a specific example it could be use in the Linux
cluster world to fence a "bad" behaving node. For now it's okay to only
trace inet sockets. Other socket families can introduce their own tracers
easily.

Example output with trace-cmd:

<idle>-0     [003]   201.799437: inet_sk_error_report: family=AF_INET protocol=IPPROTO_TCP sport=21064 dport=38941 saddr=192.168.122.57 daddr=192.168.122.251 saddrv6=::ffff:192.168.122.57 daddrv6=::ffff:192.168.122.251 error=104

- Alex

changes since v2:

- change "sk.sk_error_report(&ipc->sk);" to "sk_error_report(&ipc->sk);"
  in net/qrtr/qrtr.c

Alexander Aring (2):
  net: sock: introduce sk_error_report
  net: sock: add trace for socket errors

 .../chelsio/inline_crypto/chtls/chtls_cm.c    |  2 +-
 drivers/vhost/vsock.c                         |  2 +-
 include/linux/skmsg.h                         |  2 +-
 include/net/sock.h                            |  2 +
 include/net/tls.h                             |  2 +-
 include/trace/events/sock.h                   | 60 +++++++++++++++++++
 net/caif/caif_socket.c                        |  2 +-
 net/can/bcm.c                                 |  4 +-
 net/can/isotp.c                               | 20 +++----
 net/can/j1939/socket.c                        |  4 +-
 net/can/raw.c                                 |  6 +-
 net/core/skbuff.c                             |  6 +-
 net/core/sock.c                               | 16 +++++
 net/dccp/ipv4.c                               |  4 +-
 net/dccp/ipv6.c                               |  4 +-
 net/dccp/proto.c                              |  2 +-
 net/dccp/timer.c                              |  2 +-
 net/ipv4/ping.c                               |  2 +-
 net/ipv4/raw.c                                |  4 +-
 net/ipv4/tcp.c                                |  4 +-
 net/ipv4/tcp_input.c                          |  2 +-
 net/ipv4/tcp_ipv4.c                           |  4 +-
 net/ipv4/tcp_timer.c                          |  2 +-
 net/ipv4/udp.c                                |  4 +-
 net/ipv6/raw.c                                |  2 +-
 net/ipv6/tcp_ipv6.c                           |  4 +-
 net/ipv6/udp.c                                |  2 +-
 net/kcm/kcmsock.c                             |  2 +-
 net/mptcp/subflow.c                           |  2 +-
 net/netlink/af_netlink.c                      |  8 +--
 net/nfc/rawsock.c                             |  2 +-
 net/packet/af_packet.c                        |  4 +-
 net/qrtr/qrtr.c                               |  2 +-
 net/sctp/input.c                              |  2 +-
 net/sctp/ipv6.c                               |  2 +-
 net/smc/af_smc.c                              |  2 +-
 net/strparser/strparser.c                     |  2 +-
 net/unix/af_unix.c                            |  2 +-
 net/vmw_vsock/af_vsock.c                      |  2 +-
 net/vmw_vsock/virtio_transport.c              |  2 +-
 net/vmw_vsock/virtio_transport_common.c       |  2 +-
 net/vmw_vsock/vmci_transport.c                |  4 +-
 net/xdp/xsk.c                                 |  2 +-
 43 files changed, 145 insertions(+), 67 deletions(-)