]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/ipv6/inet6_connection_sock.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm...
[linux.git] / net / ipv6 / inet6_connection_sock.c
index 75c308239243305a508e62d01814d88da7248018..9a31d13bf180d1e58a4a4b0a65750f377f963c52 100644 (file)
 #include <net/inet6_connection_sock.h>
 #include <net/sock_reuseport.h>
 
-int inet6_csk_bind_conflict(const struct sock *sk,
-                           const struct inet_bind_bucket *tb, bool relax,
-                           bool reuseport_ok)
-{
-       const struct sock *sk2;
-       bool reuse = !!sk->sk_reuse;
-       bool reuseport = !!sk->sk_reuseport && reuseport_ok;
-       kuid_t uid = sock_i_uid((struct sock *)sk);
-
-       /* We must walk the whole port owner list in this case. -DaveM */
-       /*
-        * See comment in inet_csk_bind_conflict about sock lookup
-        * vs net namespaces issues.
-        */
-       sk_for_each_bound(sk2, &tb->owners) {
-               if (sk != sk2 &&
-                   (!sk->sk_bound_dev_if ||
-                    !sk2->sk_bound_dev_if ||
-                    sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) {
-                       if ((!reuse || !sk2->sk_reuse ||
-                            sk2->sk_state == TCP_LISTEN) &&
-                           (!reuseport || !sk2->sk_reuseport ||
-                            rcu_access_pointer(sk->sk_reuseport_cb) ||
-                            (sk2->sk_state != TCP_TIME_WAIT &&
-                             !uid_eq(uid,
-                                     sock_i_uid((struct sock *)sk2))))) {
-                               if (ipv6_rcv_saddr_equal(sk, sk2, true))
-                                       break;
-                       }
-                       if (!relax && reuse && sk2->sk_reuse &&
-                           sk2->sk_state != TCP_LISTEN &&
-                           ipv6_rcv_saddr_equal(sk, sk2, true))
-                               break;
-               }
-       }
-
-       return sk2 != NULL;
-}
-EXPORT_SYMBOL_GPL(inet6_csk_bind_conflict);
-
 struct dst_entry *inet6_csk_route_req(const struct sock *sk,
                                      struct flowi6 *fl6,
                                      const struct request_sock *req,