Lines Matching refs:sock
67 #include <net/sock.h>
81 static inline int netlink_is_kernel(struct sock *sk)
129 static int netlink_dump(struct sock *sk);
255 struct sock *sk = skb->sk;
279 struct sock *sk = skb->sk;
333 static void netlink_deliver_tap_kernel(struct sock *dst, struct sock *src,
340 static void netlink_overrun(struct sock *sk)
354 static void netlink_rcv_wake(struct sock *sk)
377 static void netlink_skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
386 static void netlink_sock_destruct(struct sock *sk)
502 static struct sock *__netlink_lookup(struct netlink_table *table, u32 portid,
512 static int __netlink_insert(struct netlink_table *table, struct sock *sk)
522 static struct sock *netlink_lookup(struct net *net, int protocol, u32 portid)
525 struct sock *sk;
539 netlink_update_listeners(struct sock *sk)
562 static int netlink_insert(struct sock *sk, u32 portid)
603 static void netlink_remove(struct sock *sk)
630 static int __netlink_create(struct net *net, struct socket *sock,
634 struct sock *sk;
637 sock->ops = &netlink_ops;
643 sock_init_data(sock, sk);
662 static int netlink_create(struct net *net, struct socket *sock, int protocol,
672 sock->state = SS_UNCONNECTED;
674 if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
702 err = __netlink_create(net, sock, cb_mutex, protocol, kern);
710 nlk = nlk_sk(sock->sk);
725 struct sock *sk = &nlk->sk;
742 static int netlink_release(struct socket *sock)
744 struct sock *sk = sock->sk;
773 sock->sk = NULL;
815 static int netlink_autobind(struct socket *sock)
817 struct sock *sk = sock->sk;
919 static inline int netlink_allowed(const struct socket *sock, unsigned int flag)
921 return (nl_table[sock->sk->sk_protocol].flags & flag) ||
922 ns_capable(sock_net(sock->sk)->user_ns, CAP_NET_ADMIN);
926 netlink_update_subscriptions(struct sock *sk, unsigned int subscriptions)
937 static int netlink_realloc_groups(struct sock *sk)
971 struct sock *sk)
984 static int netlink_bind(struct socket *sock, struct sockaddr *addr,
987 struct sock *sk = sock->sk;
1004 if (!netlink_allowed(sock, NL_CFG_F_NONROOT_RECV))
1046 netlink_autobind(sock);
1072 static int netlink_connect(struct socket *sock, struct sockaddr *addr,
1076 struct sock *sk = sock->sk;
1098 !netlink_allowed(sock, NL_CFG_F_NONROOT_SEND))
1106 err = netlink_autobind(sock);
1119 static int netlink_getname(struct socket *sock, struct sockaddr *addr,
1122 struct sock *sk = sock->sk;
1143 static int netlink_ioctl(struct socket *sock, unsigned int cmd,
1151 static struct sock *netlink_getsockbyportid(struct sock *ssk, u32 portid)
1153 struct sock *sock;
1156 sock = netlink_lookup(sock_net(ssk), ssk->sk_protocol, portid);
1157 if (!sock)
1161 nlk = nlk_sk(sock);
1163 if (READ_ONCE(sock->sk_state) == NETLINK_CONNECTED &&
1165 sock_put(sock);
1168 return sock;
1171 struct sock *netlink_getsockbyfilp(struct file *filp)
1174 struct sock *sock;
1179 sock = SOCKET_I(inode)->sk;
1180 if (sock->sk_family != AF_NETLINK)
1183 sock_hold(sock);
1184 return sock;
1218 * < 0: error. skb freed, reference to sock dropped.
1222 int netlink_attachskb(struct sock *sk, struct sk_buff *skb,
1223 long *timeo, struct sock *ssk)
1262 static int __netlink_sendskb(struct sock *sk, struct sk_buff *skb)
1273 int netlink_sendskb(struct sock *sk, struct sk_buff *skb)
1281 void netlink_detachskb(struct sock *sk, struct sk_buff *skb)
1310 static int netlink_unicast_kernel(struct sock *sk, struct sk_buff *skb,
1311 struct sock *ssk)
1331 int netlink_unicast(struct sock *ssk, struct sk_buff *skb,
1334 struct sock *sk;
1367 int netlink_has_listeners(struct sock *sk, unsigned int group)
1394 static int netlink_broadcast_deliver(struct sock *sk, struct sk_buff *skb)
1408 struct sock *exclude_sk;
1418 int (*tx_filter)(struct sock *dsk, struct sk_buff *skb, void *data);
1422 static void do_one_broadcast(struct sock *sk,
1500 int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb, u32 portid,
1502 int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data),
1507 struct sock *sk;
1551 int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 portid,
1560 struct sock *exclude_sk;
1566 static int do_one_set_err(struct sock *sk, struct netlink_set_err_data *p)
1602 int netlink_set_err(struct sock *ssk, u32 portid, u32 group, int code)
1606 struct sock *sk;
1642 static int netlink_setsockopt(struct socket *sock, int level, int optname,
1645 struct sock *sk = sock->sk;
1667 if (!netlink_allowed(sock, NL_CFG_F_NONROOT_RECV))
1743 static int netlink_getsockopt(struct socket *sock, int level, int optname,
1746 struct sock *sk = sock->sk;
1824 static void netlink_cmsg_listen_all_nsid(struct sock *sk, struct msghdr *msg,
1834 static int netlink_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
1836 struct sock *sk = sock->sk;
1854 err = scm_send(sock, msg, &scm, true);
1868 !netlink_allowed(sock, NL_CFG_F_NONROOT_SEND))
1879 err = netlink_autobind(sock);
1923 static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
1927 struct sock *sk = sock->sk;
2005 scm_recv(sock, msg, &scm, flags);
2011 static void netlink_data_ready(struct sock *sk)
2022 struct sock *
2026 struct socket *sock;
2027 struct sock *sk;
2038 if (sock_create_lite(PF_NETLINK, SOCK_DGRAM, unit, &sock))
2041 if (__netlink_create(net, sock, cb_mutex, unit, 1) < 0)
2044 sk = sock->sk;
2092 sock_release(sock);
2098 netlink_kernel_release(struct sock *sk)
2107 int __netlink_change_ngroups(struct sock *sk, unsigned int groups)
2142 int netlink_change_ngroups(struct sock *sk, unsigned int groups)
2153 void __netlink_clear_multicast_users(struct sock *ksk, unsigned int group)
2155 struct sock *sk;
2208 static int netlink_dump(struct sock *sk)
2322 int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
2328 struct sock *sk;
2525 int nlmsg_notify(struct sock *sk, struct sk_buff *skb, u32 portid,
2647 struct sock *s = v;
2683 ctx.sk = nlk_sk((struct sock *)v);