#define pr_fmt(fmt) …
#include <asm/unaligned.h>
#include <linux/capability.h>
#include <linux/errno.h>
#include <linux/errqueue.h>
#include <linux/types.h>
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/sched.h>
#include <linux/sched/mm.h>
#include <linux/timer.h>
#include <linux/string.h>
#include <linux/sockios.h>
#include <linux/net.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/poll.h>
#include <linux/tcp.h>
#include <linux/udp.h>
#include <linux/init.h>
#include <linux/highmem.h>
#include <linux/user_namespace.h>
#include <linux/static_key.h>
#include <linux/memcontrol.h>
#include <linux/prefetch.h>
#include <linux/compat.h>
#include <linux/mroute.h>
#include <linux/mroute6.h>
#include <linux/icmpv6.h>
#include <linux/uaccess.h>
#include <linux/netdevice.h>
#include <net/protocol.h>
#include <linux/skbuff.h>
#include <net/net_namespace.h>
#include <net/request_sock.h>
#include <net/sock.h>
#include <net/proto_memory.h>
#include <linux/net_tstamp.h>
#include <net/xfrm.h>
#include <linux/ipsec.h>
#include <net/cls_cgroup.h>
#include <net/netprio_cgroup.h>
#include <linux/sock_diag.h>
#include <linux/filter.h>
#include <net/sock_reuseport.h>
#include <net/bpf_sk_storage.h>
#include <trace/events/sock.h>
#include <net/tcp.h>
#include <net/busy_poll.h>
#include <net/phonet/phonet.h>
#include <linux/ethtool.h>
#include "dev.h"
static DEFINE_MUTEX(proto_list_mutex);
static LIST_HEAD(proto_list);
static void sock_def_write_space_wfree(struct sock *sk);
static void sock_def_write_space(struct sock *sk);
bool sk_ns_capable(const struct sock *sk,
struct user_namespace *user_ns, int cap)
{ … }
EXPORT_SYMBOL(…);
bool sk_capable(const struct sock *sk, int cap)
{ … }
EXPORT_SYMBOL(…);
bool sk_net_capable(const struct sock *sk, int cap)
{ … }
EXPORT_SYMBOL(…);
static struct lock_class_key af_family_keys[AF_MAX];
static struct lock_class_key af_family_kern_keys[AF_MAX];
static struct lock_class_key af_family_slock_keys[AF_MAX];
static struct lock_class_key af_family_kern_slock_keys[AF_MAX];
#define _sock_locks(x) …
static const char *const af_family_key_strings[AF_MAX+1] = …;
static const char *const af_family_slock_key_strings[AF_MAX+1] = …;
static const char *const af_family_clock_key_strings[AF_MAX+1] = …;
static const char *const af_family_kern_key_strings[AF_MAX+1] = …;
static const char *const af_family_kern_slock_key_strings[AF_MAX+1] = …;
static const char *const af_family_kern_clock_key_strings[AF_MAX+1] = …;
static const char *const af_family_rlock_key_strings[AF_MAX+1] = …;
static const char *const af_family_wlock_key_strings[AF_MAX+1] = …;
static const char *const af_family_elock_key_strings[AF_MAX+1] = …;
static struct lock_class_key af_callback_keys[AF_MAX];
static struct lock_class_key af_rlock_keys[AF_MAX];
static struct lock_class_key af_wlock_keys[AF_MAX];
static struct lock_class_key af_elock_keys[AF_MAX];
static struct lock_class_key af_kern_callback_keys[AF_MAX];
__u32 sysctl_wmem_max __read_mostly = …;
EXPORT_SYMBOL(…);
__u32 sysctl_rmem_max __read_mostly = …;
EXPORT_SYMBOL(…);
__u32 sysctl_wmem_default __read_mostly = …;
__u32 sysctl_rmem_default __read_mostly = …;
int sysctl_tstamp_allow_data __read_mostly = …;
DEFINE_STATIC_KEY_FALSE(memalloc_socks_key);
EXPORT_SYMBOL_GPL(…);
void sk_set_memalloc(struct sock *sk)
{ … }
EXPORT_SYMBOL_GPL(…);
void sk_clear_memalloc(struct sock *sk)
{ … }
EXPORT_SYMBOL_GPL(…);
int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)
{ … }
EXPORT_SYMBOL(…);
void sk_error_report(struct sock *sk)
{ … }
EXPORT_SYMBOL(…);
int sock_get_timeout(long timeo, void *optval, bool old_timeval)
{ … }
EXPORT_SYMBOL(…);
int sock_copy_user_timeval(struct __kernel_sock_timeval *tv,
sockptr_t optval, int optlen, bool old_timeval)
{ … }
EXPORT_SYMBOL(…);
static int sock_set_timeout(long *timeo_p, sockptr_t optval, int optlen,
bool old_timeval)
{ … }
static bool sock_needs_netstamp(const struct sock *sk)
{ … }
static void sock_disable_timestamp(struct sock *sk, unsigned long flags)
{ … }
int __sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
{ … }
EXPORT_SYMBOL(…);
int sock_queue_rcv_skb_reason(struct sock *sk, struct sk_buff *skb,
enum skb_drop_reason *reason)
{ … }
EXPORT_SYMBOL(…);
int __sk_receive_skb(struct sock *sk, struct sk_buff *skb,
const int nested, unsigned int trim_cap, bool refcounted)
{ … }
EXPORT_SYMBOL(…);
INDIRECT_CALLABLE_DECLARE(…);
INDIRECT_CALLABLE_DECLARE(…);
struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie)
{ … }
EXPORT_SYMBOL(…);
struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie)
{ … }
EXPORT_SYMBOL(…);
static int sock_bindtoindex_locked(struct sock *sk, int ifindex)
{ … }
int sock_bindtoindex(struct sock *sk, int ifindex, bool lock_sk)
{ … }
EXPORT_SYMBOL(…);
static int sock_setbindtodevice(struct sock *sk, sockptr_t optval, int optlen)
{ … }
static int sock_getbindtodevice(struct sock *sk, sockptr_t optval,
sockptr_t optlen, int len)
{ … }
bool sk_mc_loop(const struct sock *sk)
{ … }
EXPORT_SYMBOL(…);
void sock_set_reuseaddr(struct sock *sk)
{ … }
EXPORT_SYMBOL(…);
void sock_set_reuseport(struct sock *sk)
{ … }
EXPORT_SYMBOL(…);
void sock_no_linger(struct sock *sk)
{ … }
EXPORT_SYMBOL(…);
void sock_set_priority(struct sock *sk, u32 priority)
{ … }
EXPORT_SYMBOL(…);
void sock_set_sndtimeo(struct sock *sk, s64 secs)
{ … }
EXPORT_SYMBOL(…);
static void __sock_set_timestamps(struct sock *sk, bool val, bool new, bool ns)
{ … }
void sock_enable_timestamps(struct sock *sk)
{ … }
EXPORT_SYMBOL(…);
void sock_set_timestamp(struct sock *sk, int optname, bool valbool)
{ … }
static int sock_timestamping_bind_phc(struct sock *sk, int phc_index)
{ … }
int sock_set_timestamping(struct sock *sk, int optname,
struct so_timestamping timestamping)
{ … }
void sock_set_keepalive(struct sock *sk)
{ … }
EXPORT_SYMBOL(…);
static void __sock_set_rcvbuf(struct sock *sk, int val)
{ … }
void sock_set_rcvbuf(struct sock *sk, int val)
{ … }
EXPORT_SYMBOL(…);
static void __sock_set_mark(struct sock *sk, u32 val)
{ … }
void sock_set_mark(struct sock *sk, u32 val)
{ … }
EXPORT_SYMBOL(…);
static void sock_release_reserved_memory(struct sock *sk, int bytes)
{ … }
static int sock_reserve_memory(struct sock *sk, int bytes)
{ … }
void sockopt_lock_sock(struct sock *sk)
{ … }
EXPORT_SYMBOL(…);
void sockopt_release_sock(struct sock *sk)
{ … }
EXPORT_SYMBOL(…);
bool sockopt_ns_capable(struct user_namespace *ns, int cap)
{ … }
EXPORT_SYMBOL(…);
bool sockopt_capable(int cap)
{ … }
EXPORT_SYMBOL(…);
static int sockopt_validate_clockid(__kernel_clockid_t value)
{ … }
int sk_setsockopt(struct sock *sk, int level, int optname,
sockptr_t optval, unsigned int optlen)
{ … }
int sock_setsockopt(struct socket *sock, int level, int optname,
sockptr_t optval, unsigned int optlen)
{ … }
EXPORT_SYMBOL(…);
static const struct cred *sk_get_peer_cred(struct sock *sk)
{ … }
static void cred_to_ucred(struct pid *pid, const struct cred *cred,
struct ucred *ucred)
{ … }
static int groups_to_user(sockptr_t dst, const struct group_info *src)
{ … }
int sk_getsockopt(struct sock *sk, int level, int optname,
sockptr_t optval, sockptr_t optlen)
{ … }
static inline void sock_lock_init(struct sock *sk)
{ … }
static void sock_copy(struct sock *nsk, const struct sock *osk)
{ … }
static struct sock *sk_prot_alloc(struct proto *prot, gfp_t priority,
int family)
{ … }
static void sk_prot_free(struct proto *prot, struct sock *sk)
{ … }
struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
struct proto *prot, int kern)
{ … }
EXPORT_SYMBOL(…);
static void __sk_destruct(struct rcu_head *head)
{ … }
void sk_destruct(struct sock *sk)
{ … }
static void __sk_free(struct sock *sk)
{ … }
void sk_free(struct sock *sk)
{ … }
EXPORT_SYMBOL(…);
static void sk_init_common(struct sock *sk)
{ … }
struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
{ … }
EXPORT_SYMBOL_GPL(…);
void sk_free_unlock_clone(struct sock *sk)
{ … }
EXPORT_SYMBOL_GPL(…);
static u32 sk_dst_gso_max_size(struct sock *sk, struct dst_entry *dst)
{ … }
void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
{ … }
EXPORT_SYMBOL_GPL(…);
void sock_wfree(struct sk_buff *skb)
{ … }
EXPORT_SYMBOL(…);
void __sock_wfree(struct sk_buff *skb)
{ … }
void skb_set_owner_w(struct sk_buff *skb, struct sock *sk)
{ … }
EXPORT_SYMBOL(…);
static bool can_skb_orphan_partial(const struct sk_buff *skb)
{ … }
void skb_orphan_partial(struct sk_buff *skb)
{ … }
EXPORT_SYMBOL(…);
void sock_rfree(struct sk_buff *skb)
{ … }
EXPORT_SYMBOL(…);
void sock_efree(struct sk_buff *skb)
{ … }
EXPORT_SYMBOL(…);
#ifdef CONFIG_INET
void sock_pfree(struct sk_buff *skb)
{ … }
EXPORT_SYMBOL(…);
#endif
kuid_t sock_i_uid(struct sock *sk)
{ … }
EXPORT_SYMBOL(…);
unsigned long __sock_i_ino(struct sock *sk)
{ … }
EXPORT_SYMBOL(…);
unsigned long sock_i_ino(struct sock *sk)
{ … }
EXPORT_SYMBOL(…);
struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
gfp_t priority)
{ … }
EXPORT_SYMBOL(…);
static void sock_ofree(struct sk_buff *skb)
{ … }
struct sk_buff *sock_omalloc(struct sock *sk, unsigned long size,
gfp_t priority)
{ … }
void *sock_kmalloc(struct sock *sk, int size, gfp_t priority)
{ … }
EXPORT_SYMBOL(…);
static inline void __sock_kfree_s(struct sock *sk, void *mem, int size,
const bool nullify)
{ … }
void sock_kfree_s(struct sock *sk, void *mem, int size)
{ … }
EXPORT_SYMBOL(…);
void sock_kzfree_s(struct sock *sk, void *mem, int size)
{ … }
EXPORT_SYMBOL(…);
static long sock_wait_for_wmem(struct sock *sk, long timeo)
{ … }
struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,
unsigned long data_len, int noblock,
int *errcode, int max_page_order)
{ … }
EXPORT_SYMBOL(…);
int __sock_cmsg_send(struct sock *sk, struct cmsghdr *cmsg,
struct sockcm_cookie *sockc)
{ … }
EXPORT_SYMBOL(…);
int sock_cmsg_send(struct sock *sk, struct msghdr *msg,
struct sockcm_cookie *sockc)
{ … }
EXPORT_SYMBOL(…);
static void sk_enter_memory_pressure(struct sock *sk)
{ … }
static void sk_leave_memory_pressure(struct sock *sk)
{ … }
DEFINE_STATIC_KEY_FALSE(net_high_order_alloc_disable_key);
bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t gfp)
{ … }
EXPORT_SYMBOL(…);
bool sk_page_frag_refill(struct sock *sk, struct page_frag *pfrag)
{ … }
EXPORT_SYMBOL(…);
void __lock_sock(struct sock *sk)
__releases(&sk->sk_lock.slock)
__acquires(&sk->sk_lock.slock)
{ … }
void __release_sock(struct sock *sk)
__releases(&sk->sk_lock.slock)
__acquires(&sk->sk_lock.slock)
{ … }
void __sk_flush_backlog(struct sock *sk)
{ … }
EXPORT_SYMBOL_GPL(…);
int sk_wait_data(struct sock *sk, long *timeo, const struct sk_buff *skb)
{ … }
EXPORT_SYMBOL(…);
int __sk_mem_raise_allocated(struct sock *sk, int size, int amt, int kind)
{ … }
int __sk_mem_schedule(struct sock *sk, int size, int kind)
{ … }
EXPORT_SYMBOL(…);
void __sk_mem_reduce_allocated(struct sock *sk, int amount)
{ … }
void __sk_mem_reclaim(struct sock *sk, int amount)
{ … }
EXPORT_SYMBOL(…);
int sk_set_peek_off(struct sock *sk, int val)
{ … }
EXPORT_SYMBOL_GPL(…);
int sock_no_bind(struct socket *sock, struct sockaddr *saddr, int len)
{ … }
EXPORT_SYMBOL(…);
int sock_no_connect(struct socket *sock, struct sockaddr *saddr,
int len, int flags)
{ … }
EXPORT_SYMBOL(…);
int sock_no_socketpair(struct socket *sock1, struct socket *sock2)
{ … }
EXPORT_SYMBOL(…);
int sock_no_accept(struct socket *sock, struct socket *newsock,
struct proto_accept_arg *arg)
{ … }
EXPORT_SYMBOL(…);
int sock_no_getname(struct socket *sock, struct sockaddr *saddr,
int peer)
{ … }
EXPORT_SYMBOL(…);
int sock_no_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{ … }
EXPORT_SYMBOL(…);
int sock_no_listen(struct socket *sock, int backlog)
{ … }
EXPORT_SYMBOL(…);
int sock_no_shutdown(struct socket *sock, int how)
{ … }
EXPORT_SYMBOL(…);
int sock_no_sendmsg(struct socket *sock, struct msghdr *m, size_t len)
{ … }
EXPORT_SYMBOL(…);
int sock_no_sendmsg_locked(struct sock *sk, struct msghdr *m, size_t len)
{ … }
EXPORT_SYMBOL(…);
int sock_no_recvmsg(struct socket *sock, struct msghdr *m, size_t len,
int flags)
{ … }
EXPORT_SYMBOL(…);
int sock_no_mmap(struct file *file, struct socket *sock, struct vm_area_struct *vma)
{ … }
EXPORT_SYMBOL(…);
void __receive_sock(struct file *file)
{ … }
static void sock_def_wakeup(struct sock *sk)
{ … }
static void sock_def_error_report(struct sock *sk)
{ … }
void sock_def_readable(struct sock *sk)
{ … }
static void sock_def_write_space(struct sock *sk)
{ … }
static void sock_def_write_space_wfree(struct sock *sk)
{ … }
static void sock_def_destruct(struct sock *sk)
{ … }
void sk_send_sigurg(struct sock *sk)
{ … }
EXPORT_SYMBOL(…);
void sk_reset_timer(struct sock *sk, struct timer_list* timer,
unsigned long expires)
{ … }
EXPORT_SYMBOL(…);
void sk_stop_timer(struct sock *sk, struct timer_list* timer)
{ … }
EXPORT_SYMBOL(…);
void sk_stop_timer_sync(struct sock *sk, struct timer_list *timer)
{ … }
EXPORT_SYMBOL(…);
void sock_init_data_uid(struct socket *sock, struct sock *sk, kuid_t uid)
{ … }
EXPORT_SYMBOL(…);
void sock_init_data(struct socket *sock, struct sock *sk)
{ … }
EXPORT_SYMBOL(…);
void lock_sock_nested(struct sock *sk, int subclass)
{ … }
EXPORT_SYMBOL(…);
void release_sock(struct sock *sk)
{ … }
EXPORT_SYMBOL(…);
bool __lock_sock_fast(struct sock *sk) __acquires(&sk->sk_lock.slock)
{ … }
EXPORT_SYMBOL(…);
int sock_gettstamp(struct socket *sock, void __user *userstamp,
bool timeval, bool time32)
{ … }
EXPORT_SYMBOL(…);
void sock_enable_timestamp(struct sock *sk, enum sock_flags flag)
{ … }
int sock_recv_errqueue(struct sock *sk, struct msghdr *msg, int len,
int level, int type)
{ … }
EXPORT_SYMBOL(…);
int sock_common_getsockopt(struct socket *sock, int level, int optname,
char __user *optval, int __user *optlen)
{ … }
EXPORT_SYMBOL(…);
int sock_common_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
int flags)
{ … }
EXPORT_SYMBOL(…);
int sock_common_setsockopt(struct socket *sock, int level, int optname,
sockptr_t optval, unsigned int optlen)
{ … }
EXPORT_SYMBOL(…);
void sk_common_release(struct sock *sk)
{ … }
EXPORT_SYMBOL(…);
void sk_get_meminfo(const struct sock *sk, u32 *mem)
{ … }
#ifdef CONFIG_PROC_FS
static DECLARE_BITMAP(proto_inuse_idx, PROTO_INUSE_NR);
int sock_prot_inuse_get(struct net *net, struct proto *prot)
{ … }
EXPORT_SYMBOL_GPL(…);
int sock_inuse_get(struct net *net)
{ … }
EXPORT_SYMBOL_GPL(…);
static int __net_init sock_inuse_init_net(struct net *net)
{ … }
static void __net_exit sock_inuse_exit_net(struct net *net)
{ … }
static struct pernet_operations net_inuse_ops = …;
static __init int net_inuse_init(void)
{ … }
core_initcall(net_inuse_init);
static int assign_proto_idx(struct proto *prot)
{ … }
static void release_proto_idx(struct proto *prot)
{ … }
#else
static inline int assign_proto_idx(struct proto *prot)
{
return 0;
}
static inline void release_proto_idx(struct proto *prot)
{
}
#endif
static void tw_prot_cleanup(struct timewait_sock_ops *twsk_prot)
{ … }
static int tw_prot_init(const struct proto *prot)
{ … }
static void req_prot_cleanup(struct request_sock_ops *rsk_prot)
{ … }
static int req_prot_init(const struct proto *prot)
{ … }
int proto_register(struct proto *prot, int alloc_slab)
{ … }
EXPORT_SYMBOL(…);
void proto_unregister(struct proto *prot)
{ … }
EXPORT_SYMBOL(…);
int sock_load_diag_module(int family, int protocol)
{ … }
EXPORT_SYMBOL(…);
#ifdef CONFIG_PROC_FS
static void *proto_seq_start(struct seq_file *seq, loff_t *pos)
__acquires(proto_list_mutex)
{ … }
static void *proto_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{ … }
static void proto_seq_stop(struct seq_file *seq, void *v)
__releases(proto_list_mutex)
{ … }
static char proto_method_implemented(const void *method)
{ … }
static long sock_prot_memory_allocated(struct proto *proto)
{ … }
static const char *sock_prot_memory_pressure(struct proto *proto)
{ … }
static void proto_seq_printf(struct seq_file *seq, struct proto *proto)
{ … }
static int proto_seq_show(struct seq_file *seq, void *v)
{ … }
static const struct seq_operations proto_seq_ops = …;
static __net_init int proto_init_net(struct net *net)
{ … }
static __net_exit void proto_exit_net(struct net *net)
{ … }
static __net_initdata struct pernet_operations proto_net_ops = …;
static int __init proto_init(void)
{ … }
subsys_initcall(proto_init);
#endif
#ifdef CONFIG_NET_RX_BUSY_POLL
bool sk_busy_loop_end(void *p, unsigned long start_time)
{ … }
EXPORT_SYMBOL(…);
#endif
int sock_bind_add(struct sock *sk, struct sockaddr *addr, int addr_len)
{ … }
EXPORT_SYMBOL(…);
int sock_ioctl_inout(struct sock *sk, unsigned int cmd,
void __user *arg, void *karg, size_t size)
{ … }
EXPORT_SYMBOL(…);
static int sock_ioctl_out(struct sock *sk, unsigned int cmd, void __user *arg)
{ … }
int sk_ioctl(struct sock *sk, unsigned int cmd, void __user *arg)
{ … }
EXPORT_SYMBOL(…);
static int __init sock_struct_check(void)
{ … }
core_initcall(sock_struct_check);