Lines Matching refs:sk

59 	struct sock *sk;  in __inet6_lookup_established()  local
72 sk_nulls_for_each_rcu(sk, node, &head->chain) { in __inet6_lookup_established()
73 if (sk->sk_hash != hash) in __inet6_lookup_established()
75 if (!INET6_MATCH(sk, net, saddr, daddr, ports, dif)) in __inet6_lookup_established()
77 if (unlikely(!atomic_inc_not_zero(&sk->sk_refcnt))) in __inet6_lookup_established()
80 if (unlikely(!INET6_MATCH(sk, net, saddr, daddr, ports, dif))) { in __inet6_lookup_established()
81 sock_gen_put(sk); in __inet6_lookup_established()
89 sk = NULL; in __inet6_lookup_established()
92 return sk; in __inet6_lookup_established()
96 static inline int compute_score(struct sock *sk, struct net *net, in compute_score() argument
103 if (net_eq(sock_net(sk), net) && inet_sk(sk)->inet_num == hnum && in compute_score()
104 sk->sk_family == PF_INET6) { in compute_score()
107 if (!ipv6_addr_any(&sk->sk_v6_rcv_saddr)) { in compute_score()
108 if (!ipv6_addr_equal(&sk->sk_v6_rcv_saddr, daddr)) in compute_score()
112 if (sk->sk_bound_dev_if) { in compute_score()
113 if (sk->sk_bound_dev_if != dif) in compute_score()
117 if (sk->sk_incoming_cpu == raw_smp_processor_id()) in compute_score()
128 struct sock *sk; in inet6_lookup_listener() local
140 sk_nulls_for_each(sk, node, &ilb->head) { in inet6_lookup_listener()
141 score = compute_score(sk, net, hnum, daddr, dif); in inet6_lookup_listener()
144 result = sk; in inet6_lookup_listener()
145 reuseport = sk->sk_reuseport; in inet6_lookup_listener()
154 result = sk; in inet6_lookup_listener()
184 struct sock *sk; in inet6_lookup() local
187 sk = __inet6_lookup(net, hashinfo, saddr, sport, daddr, ntohs(dport), dif); in inet6_lookup()
190 return sk; in inet6_lookup()
195 struct sock *sk, const __u16 lport, in __inet6_check_established() argument
199 struct inet_sock *inet = inet_sk(sk); in __inet6_check_established()
200 const struct in6_addr *daddr = &sk->sk_v6_rcv_saddr; in __inet6_check_established()
201 const struct in6_addr *saddr = &sk->sk_v6_daddr; in __inet6_check_established()
202 const int dif = sk->sk_bound_dev_if; in __inet6_check_established()
204 struct net *net = sock_net(sk); in __inet6_check_established()
222 if (twsk_unique(sk, sk2, twp)) in __inet6_check_established()
234 sk->sk_hash = hash; in __inet6_check_established()
235 WARN_ON(!sk_unhashed(sk)); in __inet6_check_established()
236 __sk_nulls_add_node_rcu(sk, &head->chain); in __inet6_check_established()
242 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); in __inet6_check_established()
257 static u32 inet6_sk_port_offset(const struct sock *sk) in inet6_sk_port_offset() argument
259 const struct inet_sock *inet = inet_sk(sk); in inet6_sk_port_offset()
261 return secure_ipv6_port_ephemeral(sk->sk_v6_rcv_saddr.s6_addr32, in inet6_sk_port_offset()
262 sk->sk_v6_daddr.s6_addr32, in inet6_sk_port_offset()
267 struct sock *sk) in inet6_hash_connect() argument
271 if (!inet_sk(sk)->inet_num) in inet6_hash_connect()
272 port_offset = inet6_sk_port_offset(sk); in inet6_hash_connect()
273 return __inet_hash_connect(death_row, sk, port_offset, in inet6_hash_connect()