1. 13 Sep, 2020 5 commits
    • Abhishek Pandit-Subedi's avatar
      Bluetooth: Emit controller suspend and resume events · 2f20216c
      Abhishek Pandit-Subedi authored
      Emit controller suspend and resume events when we are ready for suspend
      and we've resumed from suspend.
      
      The controller suspend event will report whatever suspend state was
      successfully entered. The controller resume event will check the first
      HCI event that was received after we finished preparing for suspend and,
      if it was a connection event, store the address of the peer that caused
      the event. If it was not a connection event, we mark the wake reason as
      an unexpected event.
      
      Here is a sample btmon trace with these events:
      
      @ MGMT Event: Controller Suspended (0x002d) plen 1
              Suspend state: Page scanning and/or passive scanning (2)
      
      @ MGMT Event: Controller Resumed (0x002e) plen 8
              Wake reason: Remote wake due to peer device connection (2)
              LE Address: CD:F3:CD:13:C5:9A (OUI CD-F3-CD)
      Signed-off-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
      Reviewed-by: default avatarMiao-chen Chou <mcchou@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      2f20216c
    • Abhishek Pandit-Subedi's avatar
      Bluetooth: Add suspend reason for device disconnect · f0cfc486
      Abhishek Pandit-Subedi authored
      Update device disconnect event with reason 0x5 to indicate that device
      disconnected because the controller is suspending.
      Signed-off-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
      Reviewed-by: default avatarMiao-chen Chou <mcchou@chromium.org>
      Reviewed-by: default avatarSonny Sasaka <sonnysasaka@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      f0cfc486
    • Abhishek Pandit-Subedi's avatar
      Bluetooth: Add mgmt suspend and resume events · 346ce5b7
      Abhishek Pandit-Subedi authored
      Add the controller suspend and resume events, which will signal when
      Bluetooth has completed preparing for suspend and when it's ready for
      resume.
      Signed-off-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
      Reviewed-by: default avatarMiao-chen Chou <mcchou@chromium.org>
      Reviewed-by: default avatarSonny Sasaka <sonnysasaka@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      346ce5b7
    • Abhishek Pandit-Subedi's avatar
      Bluetooth: Set ext scan response only when it exists · 6baf8a6a
      Abhishek Pandit-Subedi authored
      Only set extended scan response only when it exists. Otherwise, clear
      the scan response data.
      
      Per the core spec v5.2, Vol 4, Part E, 7.8.55
      
      If the advertising set is non-scannable and the Host uses this command
      other than to discard existing data, the Controller shall return the
      error code Invalid HCI Command Parameters (0x12).
      
      On WCN3991, the controller correctly responds with Invalid Parameters
      when this is sent.  That error causes __hci_req_hci_power_on to fail
      with -EINVAL and LE devices can't connect because background scanning
      isn't configured.
      
      Here is an hci trace of where this issue occurs during power on:
      
      < HCI Command: LE Set Extended Advertising Parameters (0x08|0x0036) plen 25
              Handle: 0x00
              Properties: 0x0010
                Use legacy advertising PDUs: ADV_NONCONN_IND
              Min advertising interval: 181.250 msec (0x0122)
              Max advertising interval: 181.250 msec (0x0122)
              Channel map: 37, 38, 39 (0x07)
              Own address type: Random (0x01)
              Peer address type: Public (0x00)
              Peer address: 00:00:00:00:00:00 (OUI 00-00-00)
              Filter policy: Allow Scan Request from Any, Allow Connect...
              TX power: 127 dbm (0x7f)
              Primary PHY: LE 1M (0x01)
              Secondary max skip: 0x00
              Secondary PHY: LE 1M (0x01)
              SID: 0x00
              Scan request notifications: Disabled (0x00)
      > HCI Event: Command Complete (0x0e) plen 5
            LE Set Extended Advertising Parameters (0x08|0x0036) ncmd 1
              Status: Success (0x00)
              TX power (selected): 9 dbm (0x09)
      < HCI Command: LE Set Advertising Set Random Address (0x08|0x0035) plen 7
              Advertising handle: 0x00
              Advertising random address: 08:FD:55:ED:22:28 (OUI 08-FD-55)
      > HCI Event: Command Complete (0x0e) plen 4
            LE Set Advertising Set Random Address (0x08|0x0035) ncmd
              Status: Success (0x00)
      < HCI Command: LE Set Extended Scan Response Data (0x08|0x0038) plen 35
              Handle: 0x00
              Operation: Complete scan response data (0x03)
              Fragment preference: Minimize fragmentation (0x01)
              Data length: 0x0d
              Name (short): Chromebook
      > HCI Event: Command Complete (0x0e) plen 4
            LE Set Extended Scan Response Data (0x08|0x0038) ncmd 1
              Status: Invalid HCI Command Parameters (0x12)
      Signed-off-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
      Reviewed-by: default avatarDaniel Winkler <danielwinkler@google.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      6baf8a6a
    • Abhishek Pandit-Subedi's avatar
      Bluetooth: Only mark socket zapped after unlocking · 20ae4089
      Abhishek Pandit-Subedi authored
      Since l2cap_sock_teardown_cb doesn't acquire the channel lock before
      setting the socket as zapped, it could potentially race with
      l2cap_sock_release which frees the socket. Thus, wait until the cleanup
      is complete before marking the socket as zapped.
      
      This race was reproduced on a JBL GO speaker after the remote device
      rejected L2CAP connection due to resource unavailability.
      
      Here is a dmesg log with debug logs from a repro of this bug:
      [ 3465.424086] Bluetooth: hci_core.c:hci_acldata_packet() hci0 len 16 handle 0x0003 flags 0x0002
      [ 3465.424090] Bluetooth: hci_conn.c:hci_conn_enter_active_mode() hcon 00000000cfedd07d mode 0
      [ 3465.424094] Bluetooth: l2cap_core.c:l2cap_recv_acldata() conn 000000007eae8952 len 16 flags 0x2
      [ 3465.424098] Bluetooth: l2cap_core.c:l2cap_recv_frame() len 12, cid 0x0001
      [ 3465.424102] Bluetooth: l2cap_core.c:l2cap_raw_recv() conn 000000007eae8952
      [ 3465.424175] Bluetooth: l2cap_core.c:l2cap_sig_channel() code 0x03 len 8 id 0x0c
      [ 3465.424180] Bluetooth: l2cap_core.c:l2cap_connect_create_rsp() dcid 0x0045 scid 0x0000 result 0x02 status 0x00
      [ 3465.424189] Bluetooth: l2cap_core.c:l2cap_chan_put() chan 000000006acf9bff orig refcnt 4
      [ 3465.424196] Bluetooth: l2cap_core.c:l2cap_chan_del() chan 000000006acf9bff, conn 000000007eae8952, err 111, state BT_CONNECT
      [ 3465.424203] Bluetooth: l2cap_sock.c:l2cap_sock_teardown_cb() chan 000000006acf9bff state BT_CONNECT
      [ 3465.424221] Bluetooth: l2cap_core.c:l2cap_chan_put() chan 000000006acf9bff orig refcnt 3
      [ 3465.424226] Bluetooth: hci_core.h:hci_conn_drop() hcon 00000000cfedd07d orig refcnt 6
      [ 3465.424234] BUG: spinlock bad magic on CPU#2, kworker/u17:0/159
      [ 3465.425626] Bluetooth: hci_sock.c:hci_sock_sendmsg() sock 000000002bb0cb64 sk 00000000a7964053
      [ 3465.430330]  lock: 0xffffff804410aac0, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
      [ 3465.430332] Causing a watchdog bite!
      Signed-off-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
      Reported-by: default avatarBalakrishna Godavarthi <bgodavar@codeaurora.org>
      Reviewed-by: default avatarManish Mandlik <mmandlik@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      20ae4089
  2. 11 Sep, 2020 12 commits
  3. 01 Sep, 2020 1 commit
  4. 31 Aug, 2020 2 commits
  5. 02 Aug, 2020 3 commits
  6. 01 Aug, 2020 7 commits
    • Florian Westphal's avatar
      mptcp: fix syncookie build error on UP · 7126bd5c
      Florian Westphal authored
      kernel test robot says:
      net/mptcp/syncookies.c: In function 'mptcp_join_cookie_init':
      include/linux/kernel.h:47:38: warning: division by zero [-Wdiv-by-zero]
       #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
      
      I forgot that spinock_t size is 0 on UP, so ARRAY_SIZE cannot be used.
      
      Fixes: 9466a1cc ("mptcp: enable JOIN requests even if cookies are in use")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7126bd5c
    • Brian Vazquez's avatar
      fib: fix another fib_rules_ops indirect call wrapper problem · 8b66a6fd
      Brian Vazquez authored
      It turns out that on commit 41d707b7 ("fib: fix fib_rules_ops
      indirect calls wrappers") I forgot to include the case when
      CONFIG_IP_MULTIPLE_TABLES is not set.
      
      Fixes: 41d707b7 ("fib: fix fib_rules_ops indirect calls wrappers")
      Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarBrian Vazquez <brianvv@google.com>
      Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8b66a6fd
    • Eric Dumazet's avatar
      tcp: fix build fong CONFIG_MPTCP=n · 0e8642cf
      Eric Dumazet authored
      Fixes these errors:
      
      net/ipv4/syncookies.c: In function 'tcp_get_cookie_sock':
      net/ipv4/syncookies.c:216:19: error: 'struct tcp_request_sock' has no
      member named 'drop_req'
        216 |   if (tcp_rsk(req)->drop_req) {
            |                   ^~
      net/ipv4/syncookies.c: In function 'cookie_tcp_reqsk_alloc':
      net/ipv4/syncookies.c:289:27: warning: unused variable 'treq'
      [-Wunused-variable]
        289 |  struct tcp_request_sock *treq;
            |                           ^~~~
      make[3]: *** [scripts/Makefile.build:280: net/ipv4/syncookies.o] Error 1
      make[3]: *** Waiting for unfinished jobs....
      
      Fixes: 9466a1cc ("mptcp: enable JOIN requests even if cookies are in use")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Florian Westphal <fw@strlen.de>
      Acked-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0e8642cf
    • David S. Miller's avatar
      Merge tag 'mac80211-next-for-davem-2020-07-31' of... · 6f3de75c
      David S. Miller authored
      Merge tag 'mac80211-next-for-davem-2020-07-31' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next
      
      Johannes Berg says:
      
      ====================
      We have a number of changes
       * code cleanups and fixups as usual
       * AQL & internal TXQ improvements from Felix
       * some mesh 802.1X support bits
       * some injection improvements from Mathy of KRACK
         fame, so we'll see what this results in ;-)
       * some more initial S1G supports bits, this time
         (some of?) the userspace APIs
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6f3de75c
    • Roopa Prabhu's avatar
      rtnetlink: add support for protodown reason · 829eb208
      Roopa Prabhu authored
      netdev protodown is a mechanism that allows protocols to
      hold an interface down. It was initially introduced in
      the kernel to hold links down by a multihoming protocol.
      There was also an attempt to introduce protodown
      reason at the time but was rejected. protodown and protodown reason
      is supported by almost every switching and routing platform.
      It was ok for a while to live without a protodown reason.
      But, its become more critical now given more than
      one protocol may need to keep a link down on a system
      at the same time. eg: vrrp peer node, port security,
      multihoming protocol. Its common for Network operators and
      protocol developers to look for such a reason on a networking
      box (Its also known as errDisable by most networking operators)
      
      This patch adds support for link protodown reason
      attribute. There are two ways to maintain protodown
      reasons.
      (a) enumerate every possible reason code in kernel
          - A protocol developer has to make a request and
            have that appear in a certain kernel version
      (b) provide the bits in the kernel, and allow user-space
      (sysadmin or NOS distributions) to manage the bit-to-reasonname
      map.
      	- This makes extending reason codes easier (kind of like
            the iproute2 table to vrf-name map /etc/iproute2/rt_tables.d/)
      
      This patch takes approach (b).
      
      a few things about the patch:
      - It treats the protodown reason bits as counter to indicate
      active protodown users
      - Since protodown attribute is already an exposed UAPI,
      the reason is not enforced on a protodown set. Its a no-op
      if not used.
      the patch follows the below algorithm:
        - presence of reason bits set indicates protodown
          is in use
        - user can set protodown and protodown reason in a
          single or multiple setlink operations
        - setlink operation to clear protodown, will return -EBUSY
          if there are active protodown reason bits
        - reason is not included in link dumps if not used
      
      example with patched iproute2:
      $cat /etc/iproute2/protodown_reasons.d/r.conf
      0 mlag
      1 evpn
      2 vrrp
      3 psecurity
      
      $ip link set dev vxlan0 protodown on protodown_reason vrrp on
      $ip link set dev vxlan0 protodown_reason mlag on
      $ip link show
      14: vxlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode
      DEFAULT group default qlen 1000
          link/ether f6:06:be:17:91:e7 brd ff:ff:ff:ff:ff:ff protodown on <mlag,vrrp>
      
      $ip link set dev vxlan0 protodown_reason mlag off
      $ip link set dev vxlan0 protodown off protodown_reason vrrp off
      Signed-off-by: default avatarRoopa Prabhu <roopa@cumulusnetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      829eb208
    • Jason Wang's avatar
      tun: add missing rcu annotation in tun_set_ebpf() · 8f3f330d
      Jason Wang authored
      We expecte prog_p to be protected by rcu, so adding the rcu annotation
      to fix the following sparse warning:
      
      drivers/net/tun.c:3003:36: warning: incorrect type in argument 2 (different address spaces)
      drivers/net/tun.c:3003:36:    expected struct tun_prog [noderef] __rcu **prog_p
      drivers/net/tun.c:3003:36:    got struct tun_prog **prog_p
      drivers/net/tun.c:3292:42: warning: incorrect type in argument 2 (different address spaces)
      drivers/net/tun.c:3292:42:    expected struct tun_prog **prog_p
      drivers/net/tun.c:3292:42:    got struct tun_prog [noderef] __rcu **
      drivers/net/tun.c:3296:42: warning: incorrect type in argument 2 (different address spaces)
      drivers/net/tun.c:3296:42:    expected struct tun_prog **prog_p
      drivers/net/tun.c:3296:42:    got struct tun_prog [noderef] __rcu **
      Reported-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8f3f330d
    • Yousuk Seung's avatar
      tcp: add earliest departure time to SCM_TIMESTAMPING_OPT_STATS · 48040793
      Yousuk Seung authored
      This change adds TCP_NLA_EDT to SCM_TIMESTAMPING_OPT_STATS that reports
      the earliest departure time(EDT) of the timestamped skb. By tracking EDT
      values of the skb from different timestamps, we can observe when and how
      much the value changed. This allows to measure the precise delay
      injected on the sender host e.g. by a bpf-base throttler.
      Signed-off-by: default avatarYousuk Seung <ysseung@google.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-by: default avatarNeal Cardwell <ncardwell@google.com>
      Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
      Acked-by: default avatarYuchung Cheng <ycheng@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      48040793
  7. 31 Jul, 2020 10 commits
    • David S. Miller's avatar
      Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue · c6886957
      David S. Miller authored
      Tony Nguyen says:
      
      ====================
      1GbE Intel Wired LAN Driver Updates 2020-07-30
      
      This series contains updates to e100, e1000, e1000e, igb, igbvf, ixgbe,
      ixgbevf, iavf, and driver documentation.
      
      Vaibhav Gupta converts legacy .suspend() and .resume() to generic PM
      callbacks for e100, igbvf, ixgbe, ixgbevf, and iavf.
      
      Suraj Upadhyay replaces 1 byte memsets with assignments for e1000,
      e1000e, igb, and ixgbe.
      
      Alexander Klimov replaces http links with https.
      
      Miaohe Lin replaces uses of memset to clear MAC addresses with
      eth_zero_addr().
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c6886957
    • David S. Miller's avatar
      Merge branch 'mptcp-syncookies' · d9790bc2
      David S. Miller authored
      Florian Westphal says:
      
      ====================
      mptcp: add syncookie support
      
      Changes in v2:
      - first patch renames req->ts_cookie to req->syncookie instead of
        removing ts_cookie member.
      - patch to add 'want_cookie' arg to init_req() functions has been dropped.
        All users of that arg were changed to check 'req->syncookie' instead.
      
      v1 cover letter:
      
      When syn-cookies are used the SYN?ACK never contains a MPTCP option,
      because the code path that creates a request socket based on a valid
      cookie ACK lacks the needed changes to construct MPTCP request sockets.
      
      After this series, if SYN carries MP_CAPABLE option, the option is not
      cleared anymore and request socket will be reconstructed using the
      MP_CAPABLE option data that is re-sent with the ACK.
      
      This means that no additional state gets encoded into the syn cookie or
      the TCP timestamp.
      
      There are two caveats for SYN-Cookies with MPTCP:
      
      1. When syn-cookies are used, the server-generated key is not stored.
      The drawback is that the next connection request that comes in before
      the cookie-ACK has a small chance that it will generate the same local_key.
      
      If this happens, the cookie ACK that comes in second will (re)compute the
      token hash and then detects that this is already in use.
      Unlike normal case, where the server will pick a new key value and then
      re-tries, we can't do that because we already committed to the key value
      (it was sent to peer already).
      
      Im this case, MPTCP cannot be used and late TCP fallback happens.
      
      2). SYN packets with a MP_JOIN requests cannot be handled without storing
          state. This is because the SYN contains a nonce value that is needed to
          verify the HMAC of the MP_JOIN ACK that completes the three-way
          handshake.  Also, a local nonce is generated and used in the cookie
          SYN/ACK.
      
      There are only 2 ways to solve this:
       a) Do not support JOINs when cookies are in effect.
       b) Store the nonces somewhere.
      
      The approach chosen here is b).
      Patch 8 adds a fixed-size (1024 entries) state table to store the
      information required to validate the MP_JOIN ACK and re-build the
      request socket.
      
      State gets stored when syn-cookies are active and the token in the JOIN
      request referred to an established MPTCP connection that can also accept
      a new subflow.
      
      State is restored if the ACK cookie is valid, an MP_JOIN option is present
      and the state slot contains valid data from a previous SYN.
      
      After the request socket has been re-build, normal HMAC check is done just
      as without syn cookies.
      
      Largely identical to last RFC, except patch #8 which follows Paolos
      suggestion to use a private table storage area rather than keeping
      request sockets around.  This also means I dropped the patch to remove
      const qualifier from sk_listener pointers.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d9790bc2
    • Florian Westphal's avatar
      selftests: mptcp: add test cases for mptcp join tests with syn cookies · 00587187
      Florian Westphal authored
      Also add test cases with MP_JOIN when tcp_syncookies sysctl is 2 (i.e.,
      syncookies are always-on).
      
      While at it, also print the test number and add the test number
      to the pcap files that can be generated optionally.
      
      This makes it easier to match the pcap to the test case.
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Reviewed-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      00587187
    • Florian Westphal's avatar
      selftests: mptcp: make 2nd net namespace use tcp syn cookies unconditionally · fed61c4b
      Florian Westphal authored
      check we can establish connections also when syn cookies are in use.
      
      Check that
      MPTcpExtMPCapableSYNRX and MPTcpExtMPCapableACKRX increase for each
      MPTCP test.
      
      Check TcpExtSyncookiesSent and TcpExtSyncookiesRecv increase in netns2.
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Reviewed-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fed61c4b
    • Florian Westphal's avatar
      mptcp: enable JOIN requests even if cookies are in use · 9466a1cc
      Florian Westphal authored
      JOIN requests do not work in syncookie mode -- for HMAC validation, the
      peers nonce and the mptcp token (to obtain the desired connection socket
      the join is for) are required, but this information is only present in the
      initial syn.
      
      So either we need to drop all JOIN requests once a listening socket enters
      syncookie mode, or we need to store enough state to reconstruct the request
      socket later.
      
      This adds a state table (1024 entries) to store the data present in the
      MP_JOIN syn request and the random nonce used for the cookie syn/ack.
      
      When a MP_JOIN ACK passed cookie validation, the table is consulted
      to rebuild the request socket from it.
      
      An alternate approach would be to "cancel" syn-cookie mode and force
      MP_JOIN to always use a syn queue entry.
      
      However, doing so brings the backlog over the configured queue limit.
      
      v2: use req->syncookie, not (removed) want_cookie arg
      Suggested-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Reviewed-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9466a1cc
    • Florian Westphal's avatar
      tcp: syncookies: create mptcp request socket for ACK cookies with MPTCP option · 6fc8c827
      Florian Westphal authored
      If SYN packet contains MP_CAPABLE option, keep it enabled.
      Syncokie validation and cookie-based socket creation is changed to
      instantiate an mptcp request sockets if the ACK contains an MPTCP
      connection request.
      
      Rather than extend both cookie_v4/6_check, add a common helper to create
      the (mp)tcp request socket.
      Suggested-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6fc8c827
    • Florian Westphal's avatar
      mptcp: subflow: add mptcp_subflow_init_cookie_req helper · c83a47e5
      Florian Westphal authored
      Will be used to initialize the mptcp request socket when a MP_CAPABLE
      request was handled in syncookie mode, i.e. when a TCP ACK containing a
      MP_CAPABLE option is a valid syncookie value.
      
      Normally (non-cookie case), MPTCP will generate a unique 32 bit connection
      ID and stores it in the MPTCP token storage to be able to retrieve the
      mptcp socket for subflow joining.
      
      In syncookie case, we do not want to store any state, so just generate the
      unique ID and use it in the reply.
      
      This means there is a small window where another connection could generate
      the same token.
      
      When Cookie ACK comes back, we check that the token has not been registered
      in the mean time.  If it was, the connection needs to fall back to TCP.
      
      Changes in v2:
       - use req->syncookie instead of passing 'want_cookie' arg to ->init_req()
         (Eric Dumazet)
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Reviewed-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c83a47e5
    • Florian Westphal's avatar
      mptcp: rename and export mptcp_subflow_request_sock_ops · 08b8d080
      Florian Westphal authored
      syncookie code path needs to create an mptcp request sock.
      
      Prepare for this and add mptcp prefix plus needed export of ops struct.
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Reviewed-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      08b8d080
    • Florian Westphal's avatar
      mptcp: subflow: split subflow_init_req · 78d8b7bc
      Florian Westphal authored
      When syncookie support is added, we will need to add a variant of
      subflow_init_req() helper.  It will do almost same thing except
      that it will not compute/add a token to the mptcp token tree.
      
      To avoid excess copy&paste, this commit splits away part of the
      code into a new helper, __subflow_init_req, that can then be re-used
      from the 'no insert' function added in a followup change.
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Reviewed-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      78d8b7bc
    • Florian Westphal's avatar
      mptcp: token: move retry to caller · 535fb815
      Florian Westphal authored
      Once syncookie support is added, no state will be stored anymore when the
      syn/ack is generated in syncookie mode.
      
      When the ACK comes back, the generated key will be taken from the TCP ACK,
      the token is re-generated and inserted into the token tree.
      
      This means we can't retry with a new key when the token is already taken
      in the syncookie case.
      
      Therefore, move the retry logic to the caller to prepare for syncookie
      support in mptcp.
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Reviewed-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      535fb815