1. 30 1月, 2020 1 次提交
    • F
      mptcp: handle tcp fallback when using syn cookies · ae2dd716
      Florian Westphal 提交于
      We can't deal with syncookie mode yet, the syncookie rx path will create
      tcp reqsk, i.e. we get OOB access because we treat tcp reqsk as mptcp reqsk one:
      
      TCP: SYN flooding on port 20002. Sending cookies.
      BUG: KASAN: slab-out-of-bounds in subflow_syn_recv_sock+0x451/0x4d0 net/mptcp/subflow.c:191
      Read of size 1 at addr ffff8881167bc148 by task syz-executor099/2120
       subflow_syn_recv_sock+0x451/0x4d0 net/mptcp/subflow.c:191
       tcp_get_cookie_sock+0xcf/0x520 net/ipv4/syncookies.c:209
       cookie_v6_check+0x15a5/0x1e90 net/ipv6/syncookies.c:252
       tcp_v6_cookie_check net/ipv6/tcp_ipv6.c:1123 [inline]
       [..]
      
      Bug can be reproduced via "sysctl net.ipv4.tcp_syncookies=2".
      
      Note that MPTCP should work with syncookies (4th ack would carry needed
      state), but it appears better to sort that out in -next so do tcp
      fallback for now.
      
      I removed the MPTCP ifdef for tcp_rsk "is_mptcp" member because
      if (IS_ENABLED()) is easier to read than "#ifdef IS_ENABLED()/#endif" pair.
      
      Cc: Eric Dumazet <edumazet@google.com>
      Fixes: cec37a6e ("mptcp: Handle MP_CAPABLE options for outgoing connections")
      Reported-by: NChristoph Paasch <cpaasch@apple.com>
      Tested-by: NChristoph Paasch <cpaasch@apple.com>
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ae2dd716
  2. 27 1月, 2020 1 次提交
  3. 24 1月, 2020 3 次提交
  4. 23 1月, 2020 1 次提交
  5. 21 1月, 2020 1 次提交
    • Y
      ipv6: sr: remove SKB_GSO_IPXIP6 on End.D* actions · 62ebaeae
      Yuki Taguchi 提交于
      After LRO/GRO is applied, SRv6 encapsulated packets have
      SKB_GSO_IPXIP6 feature flag, and this flag must be removed right after
      decapulation procedure.
      
      Currently, SKB_GSO_IPXIP6 flag is not removed on End.D* actions, which
      creates inconsistent packet state, that is, a normal TCP/IP packets
      have the SKB_GSO_IPXIP6 flag. This behavior can cause unexpected
      fallback to GSO on routing to netdevices that do not support
      SKB_GSO_IPXIP6. For example, on inter-VRF forwarding, decapsulated
      packets separated into small packets by GSO because VRF devices do not
      support TSO for packets with SKB_GSO_IPXIP6 flag, and this degrades
      forwarding performance.
      
      This patch removes encapsulation related GSO flags from the skb right
      after the End.D* action is applied.
      
      Fixes: d7a669dd ("ipv6: sr: add helper functions for seg6local")
      Signed-off-by: NYuki Taguchi <tagyounit@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      62ebaeae
  6. 20 1月, 2020 1 次提交
  7. 15 1月, 2020 3 次提交
  8. 14 1月, 2020 1 次提交
    • N
      vti[6]: fix packet tx through bpf_redirect() · 95224166
      Nicolas Dichtel 提交于
      With an ebpf program that redirects packets through a vti[6] interface,
      the packets are dropped because no dst is attached.
      
      This could also be reproduced with an AF_PACKET socket, with the following
      python script (vti1 is an ip_vti interface):
      
       import socket
       send_s = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, 0)
       # scapy
       # p = IP(src='10.100.0.2', dst='10.200.0.1')/ICMP(type='echo-request')
       # raw(p)
       req = b'E\x00\x00\x1c\x00\x01\x00\x00@\x01e\xb2\nd\x00\x02\n\xc8\x00\x01\x08\x00\xf7\xff\x00\x00\x00\x00'
       send_s.sendto(req, ('vti1', 0x800, 0, 0))
      Signed-off-by: NNicolas Dichtel <nicolas.dichtel@6wind.com>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      95224166
  9. 10 1月, 2020 1 次提交
  10. 04 1月, 2020 1 次提交
  11. 03 1月, 2020 3 次提交
    • D
      net: Add device index to tcp_md5sig · 6b102db5
      David Ahern 提交于
      Add support for userspace to specify a device index to limit the scope
      of an entry via the TCP_MD5SIG_EXT setsockopt. The existing __tcpm_pad
      is renamed to tcpm_ifindex and the new field is only checked if the new
      TCP_MD5SIG_FLAG_IFINDEX is set in tcpm_flags. For now, the device index
      must point to an L3 master device (e.g., VRF). The API and error
      handling are setup to allow the constraint to be relaxed in the future
      to any device index.
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6b102db5
    • D
      tcp: Add l3index to tcp_md5sig_key and md5 functions · dea53bb8
      David Ahern 提交于
      Add l3index to tcp_md5sig_key to represent the L3 domain of a key, and
      add l3index to tcp_md5_do_add and tcp_md5_do_del to fill in the key.
      
      With the key now based on an l3index, add the new parameter to the
      lookup functions and consider the l3index when looking for a match.
      
      The l3index comes from the skb when processing ingress packets leveraging
      the helpers created for socket lookups, tcp_v4_sdif and inet_iif (and the
      v6 variants). When the sdif index is set it means the packet ingressed a
      device that is part of an L3 domain and inet_iif points to the VRF device.
      For egress, the L3 domain is determined from the socket binding and
      sk_bound_dev_if.
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dea53bb8
    • D
      ipv6/tcp: Pass dif and sdif to tcp_v6_inbound_md5_hash · d14c77e0
      David Ahern 提交于
      The original ingress device index is saved to the cb space of the skb
      and the cb is moved during tcp processing. Since tcp_v6_inbound_md5_hash
      can be called before and after the cb move, pass dif and sdif to it so
      the caller can save both prior to the cb move. Both are used by a later
      patch.
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d14c77e0
  12. 25 12月, 2019 12 次提交
  13. 14 12月, 2019 1 次提交
  14. 10 12月, 2019 1 次提交
  15. 05 12月, 2019 2 次提交
  16. 27 11月, 2019 1 次提交
    • M
      net: port < inet_prot_sock(net) --> inet_port_requires_bind_service(net, port) · 82f31ebf
      Maciej Żenczykowski 提交于
      Note that the sysctl write accessor functions guarantee that:
        net->ipv4.sysctl_ip_prot_sock <= net->ipv4.ip_local_ports.range[0]
      invariant is maintained, and as such the max() in selinux hooks is actually spurious.
      
      ie. even though
        if (snum < max(inet_prot_sock(sock_net(sk)), low) || snum > high) {
      per logic is the same as
        if ((snum < inet_prot_sock(sock_net(sk)) && snum < low) || snum > high) {
      it is actually functionally equivalent to:
        if (snum < low || snum > high) {
      which is equivalent to:
        if (snum < inet_prot_sock(sock_net(sk)) || snum < low || snum > high) {
      even though the first clause is spurious.
      
      But we want to hold on to it in case we ever want to change what what
      inet_port_requires_bind_service() means (for example by changing
      it from a, by default, [0..1024) range to some sort of set).
      
      Test: builds, git 'grep inet_prot_sock' finds no other references
      Cc: Eric Dumazet <edumazet@google.com>
      Signed-off-by: NMaciej Żenczykowski <maze@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      82f31ebf
  17. 23 11月, 2019 1 次提交
    • A
      seg6: allow local packet processing for SRv6 End.DT6 behavior · fd1fef0c
      Andrea Mayer 提交于
      End.DT6 behavior makes use of seg6_lookup_nexthop() function which drops
      all packets that are destined to be locally processed. However, DT* should
      be able to deliver decapsulated packets that are destined to local
      addresses. Function seg6_lookup_nexthop() is also used by DX6, so in order
      to maintain compatibility I created another routing helper function which
      is called seg6_lookup_any_nexthop(). This function is able to take into
      account both packets that have to be processed locally and the ones that
      are destined to be forwarded directly to another machine. Hence,
      seg6_lookup_any_nexthop() is used in DT6 rather than seg6_lookup_nexthop()
      to allow local delivery.
      Signed-off-by: NAndrea Mayer <andrea.mayer@uniroma2.it>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fd1fef0c
  18. 22 11月, 2019 4 次提交
  19. 21 11月, 2019 1 次提交