02 Sep, 2017

1 commit

  • Report TCP MD5 (RFC2385) signing keys, addresses and address prefixes to
    processes with CAP_NET_ADMIN requesting INET_DIAG_INFO. Currently it is
    not possible to retrieve these from the kernel once they have been
    configured on sockets.

    Signed-off-by: Ivan Delalande
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Ivan Delalande
     

24 Aug, 2016

1 commit

  • inet_diag_find_one_icsk takes a reference to a socket that is not
    released if sock_diag_destroy returns an error. Fix by changing
    tcp_diag_destroy to manage the refcnt for all cases and remove
    the sock_put calls from tcp_abort.

    Fixes: c1e64e298b8ca ("net: diag: Support destroying TCP sockets")
    Reported-by: Lorenzo Colitti
    Signed-off-by: David Ahern
    Signed-off-by: David S. Miller

    David Ahern
     

16 Dec, 2015

1 commit

  • This implements SOCK_DESTROY for TCP sockets. It causes all
    blocking calls on the socket to fail fast with ECONNABORTED and
    causes a protocol close of the socket. It informs the other end
    of the connection by sending a RST, i.e., initiating a TCP ABORT
    as per RFC 793. ECONNABORTED was chosen for consistency with
    FreeBSD.

    Signed-off-by: Lorenzo Colitti
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Lorenzo Colitti
     

16 Nov, 2015

1 commit

  • Some functions access TCP sockets without holding a lock and
    might output non consistent data, depending on compiler and or
    architecture.

    tcp_diag_get_info(), tcp_get_info(), tcp_poll(), get_tcp4_sock() ...

    Introduce sk_state_load() and sk_state_store() to fix the issues,
    and more clearly document where this lack of locking is happening.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

16 Jun, 2015

2 commits

  • This get_info handler will simply dispatch to the appropriate
    existing inet protocol handler.

    This patch also includes a new netlink attribute
    (INET_DIAG_PROTOCOL). This attribute is currently only used
    for multicast messages. Without this attribute, there is no
    way of knowing the IP protocol used by the socket information
    being broadcast. This attribute is not necessary in the 'dump'
    variant of this protocol (though it could easily be added)
    because dump requests are issued for specific family/protocol
    pairs.

    Tested: ss -E (note, the -E option has not yet been merged into
    the upstream version of ss).

    Signed-off-by: Craig Gallek
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Craig Gallek
     
  • Previously, there was no clear distinction between the inet protocols
    that used struct tcp_info to report information and those that didn't.
    This change adds a specific size attribute to the inet_diag_handler
    struct which defines these interfaces. This will make dispatching
    sock_diag get_info requests identical for all inet protocols in a
    following patch.

    Tested: ss -au
    Tested: ss -at
    Signed-off-by: Craig Gallek
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Craig Gallek
     

04 Apr, 2015

1 commit

  • The ipv4 code uses a mixture of coding styles. In some instances check
    for non-NULL pointer is done as x != NULL and sometimes as x. x is
    preferred according to checkpatch and this patch makes the code
    consistent by adopting the latter form.

    No changes detected by objdiff.

    Signed-off-by: Ian Morris
    Signed-off-by: David S. Miller

    Ian Morris
     

11 Mar, 2015

1 commit


02 Sep, 2014

1 commit

  • Fix places where there is space before tab, long lines, and
    awkward if(){, double spacing etc. Add blank line after declaration/initialization.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    stephen hemminger
     

12 Jan, 2012

1 commit


17 Dec, 2011

1 commit

  • I've made a mistake when fixing the sock_/inet_diag aliases :(

    1. The sock_diag layer should request the family-based alias,
    not just the IPPROTO_IP one;
    2. The inet_diag layer should request for AF_INET+protocol alias,
    not just the protocol one.

    Thus fix this.

    Signed-off-by: Pavel Emelyanov
    Signed-off-by: David S. Miller

    Pavel Emelyanov
     

10 Dec, 2011

2 commits


07 Dec, 2011

2 commits

  • Sorry, but the vger didn't let this message go to the list. Re-sending it with
    less spam-filter-prone subject.

    When dumping the AF_INET/AF_INET6 sockets user will also specify the protocol,
    so prepare the protocol diag handlers to work with IPPROTO_ constants.

    Signed-off-by: Pavel Emelyanov
    Signed-off-by: David S. Miller

    Pavel Emelyanov
     
  • The ultimate goal is to get the sock_diag module, that works in
    family+protocol terms. Currently this is suitable to do on the
    inet_diag basis, so rename parts of the code. It will be moved
    to sock_diag.c later.

    Signed-off-by: Pavel Emelyanov
    Signed-off-by: David S. Miller

    Pavel Emelyanov
     

04 Dec, 2009

1 commit

  • Both netlink and /proc/net/tcp interfaces can report transient
    negative values for rx queue.

    ss ->
    State Recv-Q Send-Q Local Address:Port Peer Address:Port
    ESTAB -6 6 127.0.0.1:45956 127.0.0.1:3333

    netstat ->
    tcp 4294967290 6 127.0.0.1:37784 127.0.0.1:3333 ESTABLISHED

    This is because we dont lock socket while computing
    tp->rcv_nxt - tp->copied_seq,
    and another CPU can update copied_seq before rcv_next in RX path.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

20 Nov, 2008

1 commit


12 Jun, 2008

1 commit


22 Oct, 2007

1 commit


11 Oct, 2007

1 commit


01 Jul, 2006

1 commit


30 Jun, 2006

1 commit

  • While debugging a TCP server hang issue, we noticed that currently there is
    no way for a user to get the acceptq backlog value for a TCP listen socket.

    All the standard networking utilities that display socket info like netstat,
    ss and /proc/net/tcp have 2 fields called rx_queue and tx_queue. These
    fields do not mean much for listening sockets. This patch uses one of these
    unused fields(rx_queue) to export the accept queue len for listening sockets.

    Signed-off-by: Sridhar Samudrala
    Signed-off-by: David S. Miller

    Sridhar Samudrala
     

30 Aug, 2005

15 commits

  • With this the previous setup is back, i.e. tcp_diag can be built as a module,
    as dccp_diag and both share the infrastructure available in inet_diag.

    If one selects CONFIG_INET_DIAG as module CONFIG_INET_TCP_DIAG will also be
    built as a module, as will CONFIG_INET_DCCP_DIAG, if CONFIG_IP_DCCP was
    selected static or as a module, if CONFIG_INET_DIAG is y, being statically
    linked CONFIG_INET_TCP_DIAG will follow suit and CONFIG_INET_DCCP_DIAG will be
    built in the same manner as CONFIG_IP_DCCP.

    Now to aim at UDP, converting it to use inet_hashinfo, so that we can use
    iproute2 for UDP sockets as well.

    Ah, just to show an example of this new infrastructure working for DCCP :-)

    [root@qemu ~]# ./ss -dane
    State Recv-Q Send-Q Local Address:Port Peer Address:Port
    LISTEN 0 0 *:5001 *:* ino:942 sk:cfd503a0
    ESTAB 0 0 127.0.0.1:5001 127.0.0.1:32770 ino:943 sk:cfd50a60
    ESTAB 0 0 127.0.0.1:32770 127.0.0.1:5001 ino:947 sk:cfd50700
    TIME-WAIT 0 0 127.0.0.1:32769 127.0.0.1:5001 timer:(timewait,3.430ms,0) ino:0 sk:cf209620

    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Arnaldo Carvalho de Melo
     
  • Next changeset will introduce net/ipv4/tcp_diag.c, moving the code that was put
    transitioanlly in inet_diag.c.

    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Arnaldo Carvalho de Melo
     
  • Next changeset will rename tcp_diag.[ch] to inet_diag.[ch].

    I'm taking this longer route so as to easy review, making clear the changes
    made all along the way.

    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Arnaldo Carvalho de Melo
     
  • Next changeset will rename tcp_diag to inet_diag and move the tcp_diag code out
    of it and into a new tcp_diag.c, similar to the net/dccp/diag.c introduced in
    this changeset, completing the transition to a generic inet_diag
    infrastructure.

    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Arnaldo Carvalho de Melo
     
  • In the same way as was done with the v4 counterparts, this will be moved
    to inet6_hashtables.c.

    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Arnaldo Carvalho de Melo
     
  • Similar to CONFIG_IP_TCPDIAG_IPV6

    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Arnaldo Carvalho de Melo
     
  • With ugly ifdefs, etc, but this actually:

    1. keeps the existing ABI, i.e. no need to recompile the iproute2
    utilities if not interested in DCCP.

    2. Provides all the tcp_diag functionality in DCCP, with just a
    small patch that makes iproute2 support DCCP.

    Of course I'll get this cleaned-up in time, but for now I think its
    OK to be this way to quickly get this functionality.

    iproute2-ss050808 patch at:

    http://vger.kernel.org/~acme/iproute2-ss050808.dccp.patch

    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Arnaldo Carvalho de Melo
     
  • This changeset basically moves tcp_sk()->{ca_ops,ca_state,etc} to inet_csk(),
    minimal renaming/moving done in this changeset to ease review.

    Most of it is just changes of struct tcp_sock * to struct sock * parameters.

    With this we move to a state closer to two interesting goals:

    1. Generalisation of net/ipv4/tcp_diag.c, becoming inet_diag.c, being used
    for any INET transport protocol that has struct inet_hashinfo and are
    derived from struct inet_connection_sock. Keeps the userspace API, that will
    just not display DCCP sockets, while newer versions of tools can support
    DCCP.

    2. INET generic transport pluggable Congestion Avoidance infrastructure, using
    the current TCP CA infrastructure with DCCP.

    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Arnaldo Carvalho de Melo
     
  • This creates struct inet_connection_sock, moving members out of struct
    tcp_sock that are shareable with other INET connection oriented
    protocols, such as DCCP, that in my private tree already uses most of
    these members.

    The functions that operate on these members were renamed, using a
    inet_csk_ prefix while not being moved yet to a new file, so as to
    ease the review of these changes.

    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Arnaldo Carvalho de Melo
     
  • And also some TIME_WAIT functions.

    [acme@toy net-2.6.14]$ grep built-in /tmp/before.size /tmp/after.size
    /tmp/before.size: 282955 13122 9312 305389 4a8ed net/ipv4/built-in.o
    /tmp/after.size: 281566 13122 9312 304000 4a380 net/ipv4/built-in.o
    [acme@toy net-2.6.14]$

    I kept them still inlined, will uninline at some point to see what
    would be the performance difference.

    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Arnaldo Carvalho de Melo
     
  • This paves the way to generalise the rest of the sock ID lookup
    routines and saves some bytes in TCPv4 TIME_WAIT sockets on distro
    kernels (where IPv6 is always built as a module):

    [root@qemu ~]# grep tw_sock /proc/slabinfo
    tw_sock_TCPv6 0 0 128 31 1
    tw_sock_TCP 0 0 96 41 1
    [root@qemu ~]#

    Now if a protocol wants to use the TIME_WAIT generic infrastructure it
    only has to set the sk_prot->twsk_obj_size field with the size of its
    inet_timewait_sock derived sock and proto_register will create
    sk_prot->twsk_slab, for now its only for INET sockets, but we can
    introduce timewait_sock later if some non INET transport protocolo
    wants to use this stuff.

    Next changesets will take advantage of this new infrastructure to
    generalise even more TCP code.

    [acme@toy net-2.6.14]$ grep built-in /tmp/before.size /tmp/after.size
    /tmp/before.size: 188646 11764 5068 205478 322a6 net/ipv4/built-in.o
    /tmp/after.size: 188144 11764 5068 204976 320b0 net/ipv4/built-in.o
    [acme@toy net-2.6.14]$

    Tested with both IPv4 & IPv6 (::1 (localhost) & ::ffff:172.20.0.1
    (qemu host)).

    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Arnaldo Carvalho de Melo
     
  • Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Arnaldo Carvalho de Melo
     
  • Also expose all of the tcp_hashinfo members, i.e. killing those
    tcp_ehash, etc macros, this will more clearly expose already generic
    functions and some that need just a bit of work to become generic, as
    we'll see in the upcoming changesets.

    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Arnaldo Carvalho de Melo
     
  • This is to break down the complexity of the series of patches,
    making it very clear that this one just does:

    1. renames tcp_ prefixed hashtable functions and data structures that
    were already mostly generic to inet_ to share it with DCCP and
    other INET transport protocols.

    2. Removes not used functions (__tb_head & tb_head)

    3. Removes some leftover prototypes in the headers (tcp_bucket_unlock &
    tcp_v4_build_header)

    Next changesets will move tcp_sk(sk)->bind_hash to inet_sock so that we can
    make functions such as tcp_inherit_port, __tcp_inherit_port, tcp_v4_get_port,
    __tcp_put_port, generic and get others like tcp_destroy_sock closer to generic
    (tcp_orphan_count will go to sk->sk_prot to allow this).

    Eventually most of these functions will be used passing the transport protocol
    inet_hashinfo structure.

    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Arnaldo Carvalho de Melo
     
  • - Remove bogus code for compiling netlink as module
    - Add module refcounting support for modules implementing a netlink
    protocol
    - Add support for autoloading modules that implement a netlink protocol
    as soon as someone opens a socket for that protocol

    Signed-off-by: Harald Welte
    Signed-off-by: David S. Miller

    Harald Welte
     

24 Jun, 2005

3 commits