26 Jun, 2018

1 commit

  • [ Upstream commit 6c206b20092a3623184cff9470dba75d21507874 ]

    After commit 6b229cf77d68 ("udp: add batching to udp_rmem_release()")
    the sk_rmem_alloc field does not measure exactly anymore the
    receive queue length, because we batch the rmem release. The issue
    is really apparent only after commit 0d4a6608f68c ("udp: do rmem bulk
    free even if the rx sk queue is empty"): the user space can easily
    check for an empty socket with not-0 queue length reported by the 'ss'
    tool or the procfs interface.

    We need to use a custom UDP helper to report the correct queue length,
    taking into account the forward allocation deficit.

    Reported-by: trevor.francis@46labs.com
    Fixes: 6b229cf77d68 ("UDP: add batching to udp_rmem_release()")
    Signed-off-by: Paolo Abeni
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Paolo Abeni
     

08 Aug, 2017

2 commits

  • Add a second device index, sdif, to udp socket lookups. sdif is the
    index for ingress devices enslaved to an l3mdev. It allows the lookups
    to consider the enslaved device as well as the L3 domain when searching
    for a socket.

    Early demux lookups are handled in the next patch as part of INET_MATCH
    changes.

    Signed-off-by: David Ahern
    Signed-off-by: David S. Miller

    David Ahern
     
  • Add a second device index, sdif, to udp socket lookups. sdif is the
    index for ingress devices enslaved to an l3mdev. It allows the lookups
    to consider the enslaved device as well as the L3 domain when searching
    for a socket.

    Early demux lookups are handled in the next patch as part of INET_MATCH
    changes.

    Signed-off-by: David Ahern
    Signed-off-by: David S. Miller

    David Ahern
     

01 Jul, 2017

1 commit

  • refcount_t type and corresponding API should be
    used instead of atomic_t when the variable is used as
    a reference counter. This allows to avoid accidental
    refcounter overflows that might lead to use-after-free
    situations.

    This patch uses refcount_inc_not_zero() instead of
    atomic_inc_not_zero_hint() due to absense of a _hint()
    version of refcount API. If the hint() version must
    be used, we might need to revisit API.

    Signed-off-by: Elena Reshetova
    Signed-off-by: Hans Liljestrand
    Signed-off-by: Kees Cook
    Signed-off-by: David Windsor
    Signed-off-by: David S. Miller

    Reshetova, Elena
     

09 Sep, 2016

1 commit

  • This adds the capability for a process that has CAP_NET_ADMIN on
    a socket to see the socket mark in socket dumps.

    Commit a52e95abf772 ("net: diag: allow socket bytecode filters to
    match socket marks") recently gave privileged processes the
    ability to filter socket dumps based on mark. This patch is
    complementary: it ensures that the mark is also passed to
    userspace in the socket's netlink attributes. It is useful for
    tools like ss which display information about sockets.

    Tested: https://android-review.googlesource.com/270210
    Signed-off-by: Lorenzo Colitti
    Signed-off-by: David S. Miller

    Lorenzo Colitti
     

08 Sep, 2016

1 commit

  • udp_diag_destroy does look up the IPv4 UDP hashtable for mapped
    addresses, but it gets the IPv4 address to look up from the
    beginning of the IPv6 address instead of the end.

    Tested: https://android-review.googlesource.com/269874
    Fixes: 5d77dca82839 ("net: diag: support SOCK_DESTROY for UDP sockets")
    Signed-off-by: Lorenzo Colitti
    Acked-by: Eric Dumazet
    Acked-by: David Ahern
    Signed-off-by: David S. Miller

    Lorenzo Colitti
     

24 Aug, 2016

1 commit

  • This implements SOCK_DESTROY for UDP sockets similar to what was done
    for TCP with commit c1e64e298b8ca ("net: diag: Support destroying TCP
    sockets.") A process with a UDP socket targeted for destroy is awakened
    and recvmsg fails with ECONNABORTED.

    Signed-off-by: David Ahern
    Signed-off-by: David S. Miller

    David Ahern
     

05 Apr, 2016

1 commit

  • Tom Herbert would like not touching UDP socket refcnt for encapsulated
    traffic. For this to happen, we need to use normal RCU rules, with a grace
    period before freeing a socket. UDP sockets are not short lived in the
    high usage case, so the added cost of call_rcu() should not be a concern.

    This actually removes a lot of complexity in UDP stack.

    Multicast receives no longer need to hold a bucket spinlock.

    Note that ip early demux still needs to take a reference on the socket.

    Same remark for functions used by xt_socket and xt_PROXY netfilter modules,
    but this might be changed later.

    Performance for a single UDP socket receiving flood traffic from
    many RX queues/cpus.

    Simple udp_rx using simple recvfrom() loop :
    438 kpps instead of 374 kpps : 17 % increase of the peak rate.

    v2: Addressed Willem de Bruijn feedback in multicast handling
    - keep early demux break in __udp4_lib_demux_lookup()

    Signed-off-by: Eric Dumazet
    Cc: Tom Herbert
    Cc: Willem de Bruijn
    Tested-by: Tom Herbert
    Signed-off-by: David S. Miller

    Eric Dumazet
     

05 Jan, 2016

1 commit

  • Expose socket options for setting a classic or extended BPF program
    for use when selecting sockets in an SO_REUSEPORT group. These options
    can be used on the first socket to belong to a group before bind or
    on any socket in the group after bind.

    This change includes refactoring of the existing sk_filter code to
    allow reuse of the existing BPF filter validation checks.

    Signed-off-by: Craig Gallek
    Acked-by: Alexei Starovoitov
    Signed-off-by: David S. Miller

    Craig Gallek
     

16 Jun, 2015

1 commit

  • 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 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


27 Jan, 2015

1 commit

  • While working on rhashtable walking I noticed that the UDP diag
    dumping code is buggy. In particular, the socket skipping within
    a chain never happens, even though we record the number of sockets
    that should be skipped.

    As this code was supposedly copied from TCP, this patch does what
    TCP does and resets num before we walk a chain.

    Signed-off-by: Herbert Xu
    Acked-by: Pavel Emelyanov
    Signed-off-by: David S. Miller

    Herbert Xu
     

20 Apr, 2013

1 commit


29 Mar, 2013

1 commit


11 Sep, 2012

1 commit

  • It is a frequent mistake to confuse the netlink port identifier with a
    process identifier. Try to reduce this confusion by renaming fields
    that hold port identifiers portid instead of pid.

    I have carefully avoided changing the structures exported to
    userspace to avoid changing the userspace API.

    I have successfully built an allyesconfig kernel with this change.

    Signed-off-by: "Eric W. Biederman"
    Acked-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Eric W. Biederman
     

15 Aug, 2012

1 commit


17 Jul, 2012

1 commit

  • Before this patch sock_diag works for init_net only and dumps
    information about sockets from all namespaces.

    This patch expands sock_diag for all name-spaces.
    It creates a netlink kernel socket for each netns and filters
    data during dumping.

    v2: filter accoding with netns in all places
    remove an unused variable.

    Cc: "David S. Miller"
    Cc: Alexey Kuznetsov
    Cc: James Morris
    Cc: Hideaki YOSHIFUJI
    Cc: Patrick McHardy
    Cc: Pavel Emelyanov
    CC: Eric Dumazet
    Cc: linux-kernel@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Signed-off-by: Andrew Vagin
    Acked-by: Pavel Emelyanov
    Signed-off-by: David S. Miller

    Andrey Vagin
     

26 Apr, 2012

1 commit


17 Jan, 2012

1 commit


12 Jan, 2012

1 commit


17 Dec, 2011

2 commits


11 Dec, 2011

1 commit


10 Dec, 2011

3 commits