Lines Matching refs:sock
60 #include <net/sock.h>
68 /* struct sock has to be the first member of netlink_sock */
69 struct sock sk;
96 static inline struct netlink_sock *nlk_sk(struct sock *sk)
101 static inline int netlink_is_kernel(struct sock *sk)
134 static int netlink_dump(struct sock *sk);
152 static void netlink_sock_destruct(struct sock *sk)
229 static inline struct sock *netlink_lookup(struct net *net, int protocol,
234 struct sock *sk;
298 struct sock *sk;
328 netlink_update_listeners(struct sock *sk)
347 static int netlink_insert(struct sock *sk, struct net *net, u32 pid)
352 struct sock *osk;
387 static void netlink_remove(struct sock *sk)
403 static int __netlink_create(struct net *net, struct socket *sock,
406 struct sock *sk;
409 sock->ops = &netlink_ops;
415 sock_init_data(sock, sk);
431 static int netlink_create(struct net *net, struct socket *sock, int protocol,
439 sock->state = SS_UNCONNECTED;
441 if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
466 err = __netlink_create(net, sock, cb_mutex, protocol);
474 nlk = nlk_sk(sock->sk);
484 static int netlink_release(struct socket *sock)
486 struct sock *sk = sock->sk;
501 sock->sk = NULL;
540 static int netlink_autobind(struct socket *sock)
542 struct sock *sk = sock->sk;
546 struct sock *osk;
581 static inline int netlink_capable(struct socket *sock, unsigned int flag)
583 return (nl_table[sock->sk->sk_protocol].nl_nonroot & flag) ||
588 netlink_update_subscriptions(struct sock *sk, unsigned int subscriptions)
599 static int netlink_realloc_groups(struct sock *sk)
632 static int netlink_bind(struct socket *sock, struct sockaddr *addr,
635 struct sock *sk = sock->sk;
646 if (!netlink_capable(sock, NL_NONROOT_RECV))
659 netlink_autobind(sock);
678 static int netlink_connect(struct socket *sock, struct sockaddr *addr,
682 struct sock *sk = sock->sk;
699 if (nladdr->nl_groups && !netlink_capable(sock, NL_NONROOT_SEND))
703 err = netlink_autobind(sock);
714 static int netlink_getname(struct socket *sock, struct sockaddr *addr,
717 struct sock *sk = sock->sk;
735 static void netlink_overrun(struct sock *sk)
748 static struct sock *netlink_getsockbypid(struct sock *ssk, u32 pid)
750 struct sock *sock;
753 sock = netlink_lookup(sock_net(ssk), ssk->sk_protocol, pid);
754 if (!sock)
758 nlk = nlk_sk(sock);
759 if (sock->sk_state == NETLINK_CONNECTED &&
761 sock_put(sock);
764 return sock;
767 struct sock *netlink_getsockbyfilp(struct file *filp)
770 struct sock *sock;
775 sock = SOCKET_I(inode)->sk;
776 if (sock->sk_family != AF_NETLINK)
779 sock_hold(sock);
780 return sock;
789 * < 0: error. skb freed, reference to sock dropped.
793 int netlink_attachskb(struct sock *sk, struct sk_buff *skb,
794 long *timeo, struct sock *ssk)
833 int netlink_sendskb(struct sock *sk, struct sk_buff *skb)
843 void netlink_detachskb(struct sock *sk, struct sk_buff *skb)
874 static inline void netlink_rcv_wake(struct sock *sk)
884 static inline int netlink_unicast_kernel(struct sock *sk, struct sk_buff *skb)
900 int netlink_unicast(struct sock *ssk, struct sk_buff *skb,
903 struct sock *sk;
936 int netlink_has_listeners(struct sock *sk, unsigned int group)
955 static inline int netlink_broadcast_deliver(struct sock *sk,
971 struct sock *exclude_sk;
981 int (*tx_filter)(struct sock *dsk, struct sk_buff *skb, void *data);
985 static inline int do_one_broadcast(struct sock *sk,
1046 int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb, u32 pid,
1048 int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data),
1054 struct sock *sk;
1098 int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 pid,
1107 struct sock *exclude_sk;
1113 static inline int do_one_set_err(struct sock *sk,
1150 int netlink_set_err(struct sock *ssk, u32 pid, u32 group, int code)
1154 struct sock *sk;
1190 static int netlink_setsockopt(struct socket *sock, int level, int optname,
1193 struct sock *sk = sock->sk;
1215 if (!netlink_capable(sock, NL_NONROOT_RECV))
1251 static int netlink_getsockopt(struct socket *sock, int level, int optname,
1254 struct sock *sk = sock->sk;
1311 static int netlink_sendmsg(struct kiocb *kiocb, struct socket *sock,
1315 struct sock *sk = sock->sk;
1331 err = scm_send(sock, msg, siocb->scm);
1342 if (dst_group && !netlink_capable(sock, NL_NONROOT_SEND))
1350 err = netlink_autobind(sock);
1399 static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
1405 struct sock *sk = sock->sk;
1476 scm_recv(sock, msg, siocb->scm, flags);
1482 static void netlink_data_ready(struct sock *sk, int len)
1493 struct sock *
1498 struct socket *sock;
1499 struct sock *sk;
1508 if (sock_create_lite(PF_NETLINK, SOCK_DGRAM, unit, &sock))
1517 if (__netlink_create(&init_net, sock, cb_mutex, unit) < 0)
1520 sk = sock->sk;
1561 sock_release(sock);
1568 netlink_kernel_release(struct sock *sk)
1583 int __netlink_change_ngroups(struct sock *sk, unsigned int groups)
1630 int netlink_change_ngroups(struct sock *sk, unsigned int groups)
1641 void __netlink_clear_multicast_users(struct sock *ksk, unsigned int group)
1643 struct sock *sk;
1659 void netlink_clear_multicast_users(struct sock *ksk, unsigned int group)
1684 static int netlink_dump(struct sock *sk)
1746 int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
1753 struct sock *sk;
1806 struct sock *sk;
1879 int nlmsg_notify(struct sock *sk, struct sk_buff *skb, u32 pid,
1916 static struct sock *netlink_seq_socket_idx(struct seq_file *seq, loff_t pos)
1920 struct sock *s;
1952 struct sock *s;
2006 struct sock *s = v;
2062 int netlink_ioctl(struct sock *sk, int cmd, unsigned long arg)