21 #include <linux/string.h>
22 #include <linux/types.h>
24 #include <linux/netdevice.h>
74 #if IS_ENABLED(CONFIG_IPV6)
141 #if IS_ENABLED(CONFIG_IPV6)
145 #define inet_daddr sk.__sk_common.skc_daddr
146 #define inet_rcv_saddr sk.__sk_common.skc_rcv_saddr
179 #define IPCORK_ALLFRAG 2
186 static inline void __inet_sk_copy_descendant(
struct sock *sk_to,
187 const struct sock *sk_from,
188 const int ancestor_size)
190 memcpy(inet_sk(sk_to) + 1, inet_sk(sk_from) + 1,
191 sk_from->sk_prot->obj_size - ancestor_size);
193 #if !(IS_ENABLED(CONFIG_IPV6))
194 static inline void inet_sk_copy_descendant(
struct sock *sk_to,
195 const struct sock *sk_from)
197 __inet_sk_copy_descendant(sk_to, sk_from,
sizeof(
struct inet_sock));
206 static inline unsigned int inet_ehashfn(
struct net *
net,
212 ((__u32) lport) << 16 | (
__force __u32)fport,
213 inet_ehash_secret + net_hash_mix(net));
216 static inline int inet_sk_ehashfn(
const struct sock *
sk)
218 const struct inet_sock *inet = inet_sk(sk);
219 const __be32 laddr = inet->inet_rcv_saddr;
221 const __be32 faddr = inet->inet_daddr;
223 struct net *net = sock_net(sk);
225 return inet_ehashfn(net, laddr, lport, faddr, fport);
241 static inline __u8 inet_sk_flowi_flags(
const struct sock *
sk)
245 if (inet_sk(sk)->transparent || inet_sk(sk)->hdrincl)