1. 16 Dec, 2018 15 commits
  2. 15 Dec, 2018 22 commits
  3. 14 Dec, 2018 3 commits
    • David S. Miller's avatar
      Merge branch 'net-prefer-listeners-bound-to-an-address' · b9948e11
      David S. Miller authored
      Peter Oskolkov says:
      
      ====================
      net: prefer listeners bound to an address
      
      A relatively common use case is to have several IPs configured
      on a host, and have different listeners for each of them. We would
      like to add a "catch all" listener on addr_any, to match incoming
      connections not served by any of the listeners bound to a specific
      address.
      
      However, port-only lookups can match addr_any sockets when sockets
      listening on specific addresses are present if so_reuseport flag
      is set. This patchset eliminates lookups into port-only hashtable,
      as lookups by (addr,port) tuple are easily available.
      
      In a future patchset I plan to explore whether it is possible
      to remove port-only hashtables completely: additional refactoring
      will be required, as some non-lookup code uses the hashtables.
      ====================
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b9948e11
    • Peter Oskolkov's avatar
      selftests: net: test that listening sockets match on address properly · 6254e5c6
      Peter Oskolkov authored
      This patch adds a selftest that verifies that a socket listening
      on a specific address is chosen in preference over sockets
      that listen on any address. The test covers UDP/UDP6/TCP/TCP6.
      
      It is based on, and similar to, reuseport_dualstack.c selftest.
      Signed-off-by: default avatarPeter Oskolkov <posk@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6254e5c6
    • Peter Oskolkov's avatar
      net: tcp6: prefer listeners bound to an address · 0ee58dad
      Peter Oskolkov authored
      A relatively common use case is to have several IPs configured
      on a host, and have different listeners for each of them. We would
      like to add a "catch all" listener on addr_any, to match incoming
      connections not served by any of the listeners bound to a specific
      address.
      
      However, port-only lookups can match addr_any sockets when sockets
      listening on specific addresses are present if so_reuseport flag
      is set. This patch eliminates lookups into port-only hashtable,
      as lookups by (addr,port) tuple are easily available.
      
      In addition, compute_score() is tweaked to _not_ match
      addr_any sockets to specific addresses, as hash collisions
      could result in the unwanted behavior described above.
      
      Tested: the patch compiles; full test in the last patch in this
      patchset. Existing reuseport_* selftests also pass.
      Suggested-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarPeter Oskolkov <posk@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0ee58dad