Lines Matching refs:sk
178 static inline struct inet_hashinfo *tcp_get_hashinfo(const struct sock *sk) in tcp_get_hashinfo() argument
180 return sock_net(sk)->ipv4.tcp_death_row.hashinfo; in tcp_get_hashinfo()
229 const struct sock *sk);
238 const struct sock *sk);
242 int l3mdev, const struct sock *sk);
251 inet_bhashfn_portaddr(const struct inet_hashinfo *hinfo, const struct sock *sk, in inet_bhashfn_portaddr() argument
257 if (sk->sk_family == AF_INET6) in inet_bhashfn_portaddr()
258 hash = ipv6_portaddr_hash(net, &sk->sk_v6_rcv_saddr, port); in inet_bhashfn_portaddr()
261 hash = ipv4_portaddr_hash(net, sk->sk_rcv_saddr, port); in inet_bhashfn_portaddr()
266 inet_bhash2_addr_any_hashbucket(const struct sock *sk, const struct net *net, int port);
272 int inet_bhash2_update_saddr(struct sock *sk, void *saddr, int family);
273 void inet_bhash2_reset_saddr(struct sock *sk);
275 void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb,
279 int __inet_inherit_port(const struct sock *sk, struct sock *child);
281 void inet_put_port(struct sock *sk);
289 bool inet_ehash_insert(struct sock *sk, struct sock *osk, bool *found_dup_sk);
290 bool inet_ehash_nolisten(struct sock *sk, struct sock *osk,
292 int __inet_hash(struct sock *sk, struct sock *osk);
293 int inet_hash(struct sock *sk);
294 void inet_unhash(struct sock *sk);
343 static inline bool inet_match(const struct net *net, const struct sock *sk, in inet_match() argument
347 if (!net_eq(sock_net(sk), net) || in inet_match()
348 sk->sk_portpair != ports || in inet_match()
349 sk->sk_addrpair != cookie) in inet_match()
353 return inet_sk_bound_dev_eq(net, READ_ONCE(sk->sk_bound_dev_if), dif, in inet_match()
374 struct sock *inet_lookup_reuseport(const struct net *net, struct sock *sk,
406 struct sock *sk; in __inet_lookup() local
408 sk = __inet_lookup_established(net, hashinfo, saddr, sport, in __inet_lookup()
411 if (sk) in __inet_lookup()
412 return sk; in __inet_lookup()
425 struct sock *sk; in inet_lookup() local
428 sk = __inet_lookup(net, hashinfo, skb, doff, saddr, sport, daddr, in inet_lookup()
431 if (sk && !refcounted && !refcount_inc_not_zero(&sk->sk_refcnt)) in inet_lookup()
432 sk = NULL; in inet_lookup()
433 return sk; in inet_lookup()
442 struct sock *sk, *reuse_sk; in inet_steal_sock() local
445 sk = skb_steal_sock(skb, refcounted, &prefetched); in inet_steal_sock()
446 if (!sk) in inet_steal_sock()
449 if (!prefetched || !sk_fullsock(sk)) in inet_steal_sock()
450 return sk; in inet_steal_sock()
452 if (sk->sk_protocol == IPPROTO_TCP) { in inet_steal_sock()
453 if (sk->sk_state != TCP_LISTEN) in inet_steal_sock()
454 return sk; in inet_steal_sock()
455 } else if (sk->sk_protocol == IPPROTO_UDP) { in inet_steal_sock()
456 if (sk->sk_state != TCP_CLOSE) in inet_steal_sock()
457 return sk; in inet_steal_sock()
459 return sk; in inet_steal_sock()
462 reuse_sk = inet_lookup_reuseport(net, sk, skb, doff, in inet_steal_sock()
466 return sk; in inet_steal_sock()
486 struct sock *sk; in __inet_lookup_skb() local
488 sk = inet_steal_sock(net, skb, doff, iph->saddr, sport, iph->daddr, dport, in __inet_lookup_skb()
490 if (IS_ERR(sk)) in __inet_lookup_skb()
492 if (sk) in __inet_lookup_skb()
493 return sk; in __inet_lookup_skb()
501 static inline void sk_daddr_set(struct sock *sk, __be32 addr) in sk_daddr_set() argument
503 sk->sk_daddr = addr; /* alias of inet_daddr */ in sk_daddr_set()
505 ipv6_addr_set_v4mapped(addr, &sk->sk_v6_daddr); in sk_daddr_set()
509 static inline void sk_rcv_saddr_set(struct sock *sk, __be32 addr) in sk_rcv_saddr_set() argument
511 sk->sk_rcv_saddr = addr; /* alias of inet_rcv_saddr */ in sk_rcv_saddr_set()
513 ipv6_addr_set_v4mapped(addr, &sk->sk_v6_rcv_saddr); in sk_rcv_saddr_set()
518 struct sock *sk, u64 port_offset,
527 struct sock *sk);