Lines Matching refs:sock
89 static inline int netlink_is_kernel(struct sock *sk) in netlink_is_kernel()
99 static int netlink_dump(struct sock *sk);
199 struct sock *sk = skb->sk; in netlink_filter_tap()
223 struct sock *sk = skb->sk; in __netlink_deliver_tap_skb()
272 static void netlink_deliver_tap_kernel(struct sock *dst, struct sock *src, in netlink_deliver_tap_kernel()
279 static void netlink_overrun(struct sock *sk) in netlink_overrun()
293 static void netlink_rcv_wake(struct sock *sk) in netlink_rcv_wake()
304 static bool netlink_rx_is_mmaped(struct sock *sk) in netlink_rx_is_mmaped()
309 static bool netlink_tx_is_mmaped(struct sock *sk) in netlink_tx_is_mmaped()
380 __netlink_set_ring(struct sock *sk, struct nl_mmap_req *req, bool tx_ring, void **pg_vec, in __netlink_set_ring()
410 static int netlink_set_ring(struct sock *sk, struct nl_mmap_req *req, in netlink_set_ring()
473 struct socket *sock = file->private_data; in netlink_mm_open() local
474 struct sock *sk = sock->sk; in netlink_mm_open()
483 struct socket *sock = file->private_data; in netlink_mm_close() local
484 struct sock *sk = sock->sk; in netlink_mm_close()
495 static int netlink_mmap(struct file *file, struct socket *sock, in netlink_mmap() argument
498 struct sock *sk = sock->sk; in netlink_mmap()
668 static unsigned int netlink_poll(struct file *file, struct socket *sock, in netlink_poll() argument
671 struct sock *sk = sock->sk; in netlink_poll()
692 mask = datagram_poll(file, sock, wait); in netlink_poll()
723 static void netlink_ring_setup_skb(struct sk_buff *skb, struct sock *sk, in netlink_ring_setup_skb()
744 static int netlink_mmap_sendmsg(struct sock *sk, struct msghdr *msg, in netlink_mmap_sendmsg()
822 static void netlink_queue_mmaped_skb(struct sock *sk, struct sk_buff *skb) in netlink_queue_mmaped_skb()
839 static void netlink_ring_set_copied(struct sock *sk, struct sk_buff *skb) in netlink_ring_set_copied()
878 struct sock *sk; in netlink_skb_destructor()
918 static void netlink_skb_set_owner_r(struct sk_buff *skb, struct sock *sk) in netlink_skb_set_owner_r()
927 static void netlink_sock_destruct(struct sock *sk) in netlink_sock_destruct()
1046 static struct sock *__netlink_lookup(struct netlink_table *table, u32 portid, in __netlink_lookup()
1056 static int __netlink_insert(struct netlink_table *table, struct sock *sk) in __netlink_insert()
1066 static struct sock *netlink_lookup(struct net *net, int protocol, u32 portid) in netlink_lookup()
1069 struct sock *sk; in netlink_lookup()
1083 netlink_update_listeners(struct sock *sk) in netlink_update_listeners()
1106 static int netlink_insert(struct sock *sk, u32 portid) in netlink_insert()
1147 static void netlink_remove(struct sock *sk) in netlink_remove()
1174 static int __netlink_create(struct net *net, struct socket *sock, in __netlink_create() argument
1178 struct sock *sk; in __netlink_create()
1181 sock->ops = &netlink_ops; in __netlink_create()
1187 sock_init_data(sock, sk); in __netlink_create()
1206 static int netlink_create(struct net *net, struct socket *sock, int protocol, in netlink_create() argument
1216 sock->state = SS_UNCONNECTED; in netlink_create()
1218 if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM) in netlink_create()
1245 err = __netlink_create(net, sock, cb_mutex, protocol, kern); in netlink_create()
1253 nlk = nlk_sk(sock->sk); in netlink_create()
1272 static int netlink_release(struct socket *sock) in netlink_release() argument
1274 struct sock *sk = sock->sk; in netlink_release()
1303 sock->sk = NULL; in netlink_release()
1348 static int netlink_autobind(struct socket *sock) in netlink_autobind() argument
1350 struct sock *sk = sock->sk; in netlink_autobind()
1452 static inline int netlink_allowed(const struct socket *sock, unsigned int flag) in netlink_allowed() argument
1454 return (nl_table[sock->sk->sk_protocol].flags & flag) || in netlink_allowed()
1455 ns_capable(sock_net(sock->sk)->user_ns, CAP_NET_ADMIN); in netlink_allowed()
1459 netlink_update_subscriptions(struct sock *sk, unsigned int subscriptions) in netlink_update_subscriptions()
1470 static int netlink_realloc_groups(struct sock *sk) in netlink_realloc_groups()
1504 struct sock *sk) in netlink_undo_bind()
1517 static int netlink_bind(struct socket *sock, struct sockaddr *addr, in netlink_bind() argument
1520 struct sock *sk = sock->sk; in netlink_bind()
1536 if (!netlink_allowed(sock, NL_CFG_F_NONROOT_RECV)) in netlink_bind()
1572 netlink_autobind(sock); in netlink_bind()
1593 static int netlink_connect(struct socket *sock, struct sockaddr *addr, in netlink_connect() argument
1597 struct sock *sk = sock->sk; in netlink_connect()
1614 !netlink_allowed(sock, NL_CFG_F_NONROOT_SEND)) in netlink_connect()
1621 err = netlink_autobind(sock); in netlink_connect()
1632 static int netlink_getname(struct socket *sock, struct sockaddr *addr, in netlink_getname() argument
1635 struct sock *sk = sock->sk; in netlink_getname()
1653 static struct sock *netlink_getsockbyportid(struct sock *ssk, u32 portid) in netlink_getsockbyportid()
1655 struct sock *sock; in netlink_getsockbyportid() local
1658 sock = netlink_lookup(sock_net(ssk), ssk->sk_protocol, portid); in netlink_getsockbyportid()
1659 if (!sock) in netlink_getsockbyportid()
1663 nlk = nlk_sk(sock); in netlink_getsockbyportid()
1664 if (sock->sk_state == NETLINK_CONNECTED && in netlink_getsockbyportid()
1666 sock_put(sock); in netlink_getsockbyportid()
1669 return sock; in netlink_getsockbyportid()
1672 struct sock *netlink_getsockbyfilp(struct file *filp) in netlink_getsockbyfilp()
1675 struct sock *sock; in netlink_getsockbyfilp() local
1680 sock = SOCKET_I(inode)->sk; in netlink_getsockbyfilp()
1681 if (sock->sk_family != AF_NETLINK) in netlink_getsockbyfilp()
1684 sock_hold(sock); in netlink_getsockbyfilp()
1685 return sock; in netlink_getsockbyfilp()
1723 int netlink_attachskb(struct sock *sk, struct sk_buff *skb, in netlink_attachskb()
1724 long *timeo, struct sock *ssk) in netlink_attachskb()
1764 static int __netlink_sendskb(struct sock *sk, struct sk_buff *skb) in __netlink_sendskb()
1782 int netlink_sendskb(struct sock *sk, struct sk_buff *skb) in netlink_sendskb()
1790 void netlink_detachskb(struct sock *sk, struct sk_buff *skb) in netlink_detachskb()
1822 static int netlink_unicast_kernel(struct sock *sk, struct sk_buff *skb, in netlink_unicast_kernel()
1823 struct sock *ssk) in netlink_unicast_kernel()
1843 int netlink_unicast(struct sock *ssk, struct sk_buff *skb, in netlink_unicast()
1846 struct sock *sk; in netlink_unicast()
1879 struct sk_buff *__netlink_alloc_skb(struct sock *ssk, unsigned int size, in __netlink_alloc_skb()
1885 struct sock *sk = NULL; in __netlink_alloc_skb()
1952 int netlink_has_listeners(struct sock *sk, unsigned int group) in netlink_has_listeners()
1971 static int netlink_broadcast_deliver(struct sock *sk, struct sk_buff *skb) in netlink_broadcast_deliver()
1985 struct sock *exclude_sk;
1995 int (*tx_filter)(struct sock *dsk, struct sk_buff *skb, void *data);
1999 static void do_one_broadcast(struct sock *sk, in do_one_broadcast()
2076 int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb, u32 portid, in netlink_broadcast_filtered()
2078 int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data), in netlink_broadcast_filtered()
2083 struct sock *sk; in netlink_broadcast_filtered()
2127 int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 portid, in netlink_broadcast()
2136 struct sock *exclude_sk;
2142 static int do_one_set_err(struct sock *sk, struct netlink_set_err_data *p) in do_one_set_err()
2178 int netlink_set_err(struct sock *ssk, u32 portid, u32 group, int code) in netlink_set_err()
2181 struct sock *sk; in netlink_set_err()
2217 static int netlink_setsockopt(struct socket *sock, int level, int optname, in netlink_setsockopt() argument
2220 struct sock *sk = sock->sk; in netlink_setsockopt()
2243 if (!netlink_allowed(sock, NL_CFG_F_NONROOT_RECV)) in netlink_setsockopt()
2324 static int netlink_getsockopt(struct socket *sock, int level, int optname, in netlink_getsockopt() argument
2327 struct sock *sk = sock->sk; in netlink_getsockopt()
2416 static void netlink_cmsg_listen_all_nsid(struct sock *sk, struct msghdr *msg, in netlink_cmsg_listen_all_nsid()
2426 static int netlink_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) in netlink_sendmsg() argument
2428 struct sock *sk = sock->sk; in netlink_sendmsg()
2441 err = scm_send(sock, msg, &scm, true); in netlink_sendmsg()
2453 !netlink_allowed(sock, NL_CFG_F_NONROOT_SEND)) in netlink_sendmsg()
2462 err = netlink_autobind(sock); in netlink_sendmsg()
2518 static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, in netlink_recvmsg() argument
2522 struct sock *sk = sock->sk; in netlink_recvmsg()
2601 scm_recv(sock, msg, &scm, flags); in netlink_recvmsg()
2607 static void netlink_data_ready(struct sock *sk) in netlink_data_ready()
2618 struct sock *
2622 struct socket *sock; in __netlink_kernel_create() local
2623 struct sock *sk; in __netlink_kernel_create()
2634 if (sock_create_lite(PF_NETLINK, SOCK_DGRAM, unit, &sock)) in __netlink_kernel_create()
2637 if (__netlink_create(net, sock, cb_mutex, unit, 1) < 0) in __netlink_kernel_create()
2640 sk = sock->sk; in __netlink_kernel_create()
2688 sock_release(sock); in __netlink_kernel_create()
2694 netlink_kernel_release(struct sock *sk) in netlink_kernel_release()
2703 int __netlink_change_ngroups(struct sock *sk, unsigned int groups) in __netlink_change_ngroups()
2738 int netlink_change_ngroups(struct sock *sk, unsigned int groups) in netlink_change_ngroups()
2749 void __netlink_clear_multicast_users(struct sock *ksk, unsigned int group) in __netlink_clear_multicast_users()
2751 struct sock *sk; in __netlink_clear_multicast_users()
2781 static int netlink_dump(struct sock *sk) in netlink_dump()
2880 int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb, in __netlink_dump_start()
2885 struct sock *sk; in __netlink_dump_start()
2970 struct sock *sk; in netlink_ack()
3043 int nlmsg_notify(struct sock *sk, struct sk_buff *skb, u32 portid, in nlmsg_notify()
3177 struct sock *s = v; in netlink_seq_show()