Lines Matching refs:sock
89 #include <net/sock.h>
187 struct sock *tunnel_sock;
208 struct sock *sock; /* Pointer to the session
210 struct sock *tunnel_sock; /* Pointer to the tunnel UDP
262 void (*old_data_ready)(struct sock *, int);
263 void (*old_sk_destruct)(struct sock *);
265 struct sock *sock; /* Parent socket */
291 #define SOCK_2_SESSION(sock, session, err, errval, label, quiet) \
292 session = (struct pppol2tp_session *)((sock)->sk_user_data); \
296 "(" #sock "=%p) session=%p magic=%x\n", \
297 __FUNCTION__, __FILE__, __LINE__, sock, \
303 #define SOCK_2_TUNNEL(sock, tunnel, err, errval, label, quiet) \
304 tunnel = (struct pppol2tp_tunnel *)((sock)->sk_user_data); \
308 "(" #sock "=%p) tunnel=%p magic=%x\n", \
309 __FUNCTION__, __FILE__, __LINE__, sock, \
394 struct sock *session_sock = NULL;
423 session_sock = session->sock;
474 session->sock->sk_refcnt.counter);
475 sock_put(session->sock);
545 static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
561 SOCK_2_TUNNEL(sock, tunnel, error, 1, end, 0);
636 sock_hold(session->sock);
639 session->name, atomic_read(&sock->sk_rmem_alloc));
782 session->sock->sk_refcnt.counter);
783 sock_put(session->sock);
796 static void pppol2tp_data_ready(struct sock *sk, int len)
827 static int pppol2tp_recvmsg(struct kiocb *iocb, struct socket *sock,
833 struct sock *sk = sock->sk;
838 if (sock->state & PPPOX_BOUND)
972 static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
976 struct sock *sk = sock->sk;
1122 static void pppol2tp_fill_ip_header(struct sock *sk,
1151 struct sock *sk = (struct sock *) chan->private;
1282 * Use the tunnel sock info instead.
1381 struct sock *sk;
1395 sk = session->sock;
1434 struct sock *sk = tunnel->sock;
1459 static void pppol2tp_tunnel_destruct(struct sock *sk)
1479 static void pppol2tp_session_destruct(struct sock *sk)
1537 static int pppol2tp_release(struct socket *sock)
1539 struct sock *sk = sock->sk;
1583 sock->sk = NULL;
1593 session->sock->sk_refcnt.counter);
1632 struct socket *sock;
1641 if (!inode->i_sock || !(sock = SOCKET_I(inode))) {
1643 if (!(sock = SOCKET_I(inode))) {
1650 if (sock->file != file) {
1652 sock->file = file;
1654 return sock;
1660 static struct sock *pppol2tp_prepare_tunnel_socket(pid_t pid, int fd,
1664 struct socket *sock = NULL;
1665 struct sock *sk;
1667 struct sock *ret = NULL;
1673 sock = pppol2tp_sockfd_lookup(pid, fd, &err);
1674 if (!sock) {
1683 if (sock->type != SOCK_DGRAM) {
1686 tunnel_id, fd, sock->type, SOCK_DGRAM);
1690 if (sock->ops->family!=AF_INET) {
1693 tunnel_id, fd, sock->ops->family, AF_INET);
1698 sk = sock->sk;
1714 ret = tunnel->sock;
1736 DPRINTK(tunnel->debug, "tunl %hu: allocated tunnel=%p, sk=%p, sock=%p\n",
1737 tunnel_id, tunnel, sk, sock);
1757 tunnel->sock = sk;
1766 ret = tunnel->sock;
1770 if (sock)
1771 sockfd_put(sock);
1791 /* socket() handler. Initialize a new struct sock.
1793 static int pppol2tp_create(struct socket *sock)
1796 struct sock *sk;
1802 DPRINTK(-1, "sock=%p\n", sock);
1814 sock_init_data(sock, sk);
1820 sock->state = SS_UNCONNECTED;
1821 sock->ops = &pppol2tp_ops;
1841 sock->sk = sk;
1854 int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
1857 struct sock *sk = sock->sk;
1864 struct sock *tunnel_sock = NULL;
1872 DPRINTK(-1, "sock=%p, uservaddr=%p, sockaddr_len=%d, flags=%d, addr=%x/%hu\n",
1873 sock, uservaddr, sockaddr_len, flags,
1918 session->sock = sk;
1971 DPRINTK(session->debug, "%s: allocated session=%p, sock=%p, owner=%d\n",
2027 static int pppol2tp_getname(struct socket *sock, struct sockaddr *uaddr,
2038 if (sock->sk->sk_state != PPPOX_CONNECTED)
2041 SOCK_2_SESSION(sock->sk, session, error, -EBADF, end, 0);
2076 struct sock *sk = session->sock;
2226 struct sock *sk = tunnel->sock;
2283 static int pppol2tp_ioctl(struct socket *sock, unsigned int cmd,
2286 struct sock *sk = sock->sk;
2337 static int pppol2tp_tunnel_setsockopt(struct sock *sk,
2360 static int pppol2tp_session_setsockopt(struct sock *sk,
2388 struct sock *sk = session->sock;
2438 static int pppol2tp_setsockopt(struct socket *sock, int level, int optname,
2441 struct sock *sk = sock->sk;
2483 static int pppol2tp_tunnel_getsockopt(struct sock *sk,
2506 static int pppol2tp_session_getsockopt(struct sock *sk,
2555 static int pppol2tp_getsockopt(struct socket *sock, int level,
2558 struct sock *sk = sock->sk;
2673 sock_hold(tunnel->sock);
2718 sock_put(tunnel->sock);
2748 (tunnel == tunnel->sock->sk_user_data) ? 'Y':'N',
2775 session->sock->sk_state,
2776 (session == session->sock->sk_user_data) ?