mptcp: Only send extra TCP acks in eligible socket states
[linux-2.6-microblaze.git] / net / core / sock_map.c
index 60decd6..e252b8e 100644 (file)
@@ -211,8 +211,6 @@ out:
        return psock;
 }
 
-static bool sock_map_redirect_allowed(const struct sock *sk);
-
 static int sock_map_link(struct bpf_map *map, struct sock *sk)
 {
        struct sk_psock_progs *progs = sock_map_progs(map);
@@ -223,13 +221,6 @@ static int sock_map_link(struct bpf_map *map, struct sock *sk)
        struct sk_psock *psock;
        int ret;
 
-       /* Only sockets we can redirect into/from in BPF need to hold
-        * refs to parser/verdict progs and have their sk_data_ready
-        * and sk_write_space callbacks overridden.
-        */
-       if (!sock_map_redirect_allowed(sk))
-               goto no_progs;
-
        stream_verdict = READ_ONCE(progs->stream_verdict);
        if (stream_verdict) {
                stream_verdict = bpf_prog_inc_not_zero(stream_verdict);
@@ -264,7 +255,6 @@ static int sock_map_link(struct bpf_map *map, struct sock *sk)
                }
        }
 
-no_progs:
        psock = sock_map_psock_get_checked(sk);
        if (IS_ERR(psock)) {
                ret = PTR_ERR(psock);
@@ -527,12 +517,6 @@ static bool sk_is_tcp(const struct sock *sk)
               sk->sk_protocol == IPPROTO_TCP;
 }
 
-static bool sk_is_udp(const struct sock *sk)
-{
-       return sk->sk_type == SOCK_DGRAM &&
-              sk->sk_protocol == IPPROTO_UDP;
-}
-
 static bool sock_map_redirect_allowed(const struct sock *sk)
 {
        if (sk_is_tcp(sk))
@@ -550,10 +534,7 @@ static bool sock_map_sk_state_allowed(const struct sock *sk)
 {
        if (sk_is_tcp(sk))
                return (1 << sk->sk_state) & (TCPF_ESTABLISHED | TCPF_LISTEN);
-       else if (sk_is_udp(sk))
-               return sk_hashed(sk);
-
-       return false;
+       return true;
 }
 
 static int sock_hash_update_common(struct bpf_map *map, void *key,
@@ -1513,6 +1494,7 @@ void sock_map_unhash(struct sock *sk)
        rcu_read_unlock();
        saved_unhash(sk);
 }
+EXPORT_SYMBOL_GPL(sock_map_unhash);
 
 void sock_map_close(struct sock *sk, long timeout)
 {
@@ -1536,6 +1518,7 @@ void sock_map_close(struct sock *sk, long timeout)
        release_sock(sk);
        saved_close(sk, timeout);
 }
+EXPORT_SYMBOL_GPL(sock_map_close);
 
 static int sock_map_iter_attach_target(struct bpf_prog *prog,
                                       union bpf_iter_link_info *linfo,