Lines Matching refs:sock
89 #include <net/sock.h>
188 struct sock *tunnel_sock;
209 struct sock *sock; /* Pointer to the session
211 struct sock *tunnel_sock; /* Pointer to the tunnel UDP
263 void (*old_data_ready)(struct sock *, int);
264 void (*old_sk_destruct)(struct sock *);
266 struct sock *sock; /* Parent socket */
292 #define SOCK_2_SESSION(sock, session, err, errval, label, quiet) \
293 session = (struct pppol2tp_session *)((sock)->sk_user_data); \
297 "(" #sock "=%p) session=%p magic=%x\n", \
298 __FUNCTION__, __FILE__, __LINE__, sock, \
304 #define SOCK_2_TUNNEL(sock, tunnel, err, errval, label, quiet) \
305 tunnel = (struct pppol2tp_tunnel *)((sock)->sk_user_data); \
309 "(" #sock "=%p) tunnel=%p magic=%x\n", \
310 __FUNCTION__, __FILE__, __LINE__, sock, \
395 struct sock *session_sock = NULL;
424 session_sock = session->sock;
480 session->sock->sk_refcnt.counter);
481 sock_put(session->sock);
551 static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
567 SOCK_2_TUNNEL(sock, tunnel, error, 1, end, 0);
642 sock_hold(session->sock);
645 session->name, atomic_read(&sock->sk_rmem_alloc));
788 session->sock->sk_refcnt.counter);
789 sock_put(session->sock);
802 static void pppol2tp_data_ready(struct sock *sk, int len)
833 static int pppol2tp_recvmsg(struct kiocb *iocb, struct socket *sock,
839 struct sock *sk = sock->sk;
844 if (sock->state & PPPOX_BOUND)
978 static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
982 struct sock *sk = sock->sk;
1128 static void pppol2tp_fill_ip_header(struct sock *sk,
1179 struct sock *sk = (struct sock *) chan->private;
1325 * Use the tunnel sock info instead.
1424 struct sock *sk;
1438 sk = session->sock;
1477 struct sock *sk = tunnel->sock;
1502 static void pppol2tp_tunnel_destruct(struct sock *sk)
1522 static void pppol2tp_session_destruct(struct sock *sk)
1580 static int pppol2tp_release(struct socket *sock)
1582 struct sock *sk = sock->sk;
1626 sock->sk = NULL;
1636 session->sock->sk_refcnt.counter);
1679 struct socket *sock;
1688 if (!inode->i_sock || !(sock = SOCKET_I(inode))) {
1690 if (!(sock = SOCKET_I(inode))) {
1697 if (sock->file != file) {
1699 sock->file = file;
1701 return sock;
1707 static struct sock *pppol2tp_prepare_tunnel_socket(pid_t pid, int fd,
1711 struct socket *sock = NULL;
1712 struct sock *sk;
1714 struct sock *ret = NULL;
1720 sock = pppol2tp_sockfd_lookup(pid, fd, &err);
1721 if (!sock) {
1730 if (sock->type != SOCK_DGRAM) {
1733 tunnel_id, fd, sock->type, SOCK_DGRAM);
1737 if (sock->ops->family!=AF_INET) {
1740 tunnel_id, fd, sock->ops->family, AF_INET);
1745 sk = sock->sk;
1761 ret = tunnel->sock;
1783 DPRINTK(tunnel->debug, "tunl %hu: allocated tunnel=%p, sk=%p, sock=%p\n",
1784 tunnel_id, tunnel, sk, sock);
1804 tunnel->sock = sk;
1813 ret = tunnel->sock;
1817 if (sock)
1818 sockfd_put(sock);
1838 /* socket() handler. Initialize a new struct sock.
1842 static int pppol2tp_create(struct socket *sock)
1844 static int pppol2tp_create(struct net *net, struct socket *sock)
1848 struct sock *sk;
1854 DPRINTK(-1, "sock=%p\n", sock);
1866 sock_init_data(sock, sk);
1872 sock->state = SS_UNCONNECTED;
1873 sock->ops = &pppol2tp_ops;
1893 sock->sk = sk;
1906 int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
1909 struct sock *sk = sock->sk;
1916 struct sock *tunnel_sock = NULL;
1924 DPRINTK(-1, "sock=%p, uservaddr=%p, sockaddr_len=%d, flags=%d, addr=%x/%hu\n",
1925 sock, uservaddr, sockaddr_len, flags,
1970 session->sock = sk;
2023 DPRINTK(session->debug, "%s: allocated session=%p, sock=%p, owner=%d\n",
2079 static int pppol2tp_getname(struct socket *sock, struct sockaddr *uaddr,
2090 if (sock->sk->sk_state != PPPOX_CONNECTED)
2093 SOCK_2_SESSION(sock->sk, session, error, -EBADF, end, 0);
2128 struct sock *sk = session->sock;
2278 struct sock *sk = tunnel->sock;
2335 static int pppol2tp_ioctl(struct socket *sock, unsigned int cmd,
2338 struct sock *sk = sock->sk;
2389 static int pppol2tp_tunnel_setsockopt(struct sock *sk,
2412 static int pppol2tp_session_setsockopt(struct sock *sk,
2440 struct sock *sk = session->sock;
2490 static int pppol2tp_setsockopt(struct socket *sock, int level, int optname,
2493 struct sock *sk = sock->sk;
2535 static int pppol2tp_tunnel_getsockopt(struct sock *sk,
2558 static int pppol2tp_session_getsockopt(struct sock *sk,
2607 static int pppol2tp_getsockopt(struct socket *sock, int level,
2610 struct sock *sk = sock->sk;
2725 sock_hold(tunnel->sock);
2770 sock_put(tunnel->sock);
2800 (tunnel == tunnel->sock->sk_user_data) ? 'Y':'N',
2827 session->sock->sk_state,
2828 (session == session->sock->sk_user_data) ?