• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/net/l2tp/

Lines Matching refs:tunnel

31  * zero, the socket is treated as a special tunnel management socket.
130 struct sock *tunnel_sock; /* Pointer to the tunnel UDP
144 /* Helpers to obtain tunnel/session contexts from sockets.
251 * of the UDP tunnel
310 struct l2tp_tunnel *tunnel;
318 /* Get session and tunnel contexts */
325 tunnel = l2tp_sock_to_tunnel(ps->tunnel_sock);
326 if (tunnel == NULL)
329 uhlen = (tunnel->encap == L2TP_ENCAPTYPE_UDP) ? sizeof(struct udphdr) : 0;
394 struct l2tp_tunnel *tunnel;
402 /* Get session and tunnel contexts from the socket */
411 tunnel = l2tp_sock_to_tunnel(sk_tun);
412 if (tunnel == NULL)
444 * Session (and tunnel control) socket create/destroy.
617 /* connect() handler. Attach a PPPoX socket to a tunnel UDP socket
627 struct l2tp_tunnel *tunnel;
677 tunnel = l2tp_tunnel_find(sock_net(sk), tunnel_id);
679 /* Special case: create tunnel context if session_id and
680 * peer_session_id is 0. Otherwise look up tunnel using supplied
681 * tunnel id.
684 if (tunnel == NULL) {
689 error = l2tp_tunnel_create(sock_net(sk), fd, ver, tunnel_id, peer_tunnel_id, &tcfg, &tunnel);
694 /* Error if we can't find the tunnel */
696 if (tunnel == NULL)
700 if (tunnel->sock == NULL)
704 if (tunnel->recv_payload_hook == NULL)
705 tunnel->recv_payload_hook = pppol2tp_recv_payload_hook;
707 if (tunnel->peer_tunnel_id == 0) {
709 tunnel->peer_tunnel_id = sp->pppol2tp.d_tunnel;
711 tunnel->peer_tunnel_id = sp3->pppol2tp.d_tunnel;
717 * a socket and its tunnel socket are what we expect. If any
720 session = l2tp_session_find(sock_net(sk), tunnel, session_id);
729 tunnel, session_id,
742 if (ps->tunnel_sock != tunnel->sock)
750 ps->tunnel_sock = tunnel->sock;
775 * socket is being created to manage the tunnel. Just set up
819 struct l2tp_tunnel *tunnel;
823 tunnel = l2tp_tunnel_find(net, tunnel_id);
825 /* Error if we can't find the tunnel */
827 if (tunnel == NULL)
830 /* Error if tunnel socket is not prepped */
831 if (tunnel->sock == NULL)
836 session = l2tp_session_find(net, tunnel, session_id);
849 tunnel, session_id,
855 ps->tunnel_sock = tunnel->sock;
888 struct l2tp_tunnel *tunnel;
905 tunnel = l2tp_sock_to_tunnel(pls->tunnel_sock);
906 if (tunnel == NULL) {
912 if (tunnel->version == 2) {
918 sp.pppol2tp.fd = tunnel->fd;
920 sp.pppol2tp.s_tunnel = tunnel->tunnel_id;
921 sp.pppol2tp.d_tunnel = tunnel->peer_tunnel_id;
928 } else if (tunnel->version == 3) {
934 sp.pppol2tp.fd = tunnel->fd;
936 sp.pppol2tp.s_tunnel = tunnel->tunnel_id;
937 sp.pppol2tp.d_tunnel = tunnel->peer_tunnel_id;
961 * sockets. However, in order to control kernel tunnel features, we allow
962 * userspace to create a special "tunnel" PPPoX socket which is used for
991 struct l2tp_tunnel *tunnel = session->tunnel;
1090 stats.tunnel_id = tunnel->tunnel_id;
1115 * application to retrieve session stats via a tunnel socket.
1117 static int pppol2tp_tunnel_ioctl(struct l2tp_tunnel *tunnel,
1124 PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_DEBUG,
1126 tunnel->name, cmd, arg);
1128 sk = tunnel->sock;
1145 l2tp_session_find(sock_net(sk), tunnel, stats.session_id);
1155 pppol2tp_copy_stats(&stats, &tunnel->stats);
1160 PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO,
1161 "%s: get L2TP stats\n", tunnel->name);
1176 * Dispatch to tunnel or session helpers depending on the socket.
1183 struct l2tp_tunnel *tunnel;
1206 * tunnel ioctl
1212 tunnel = l2tp_sock_to_tunnel(ps->tunnel_sock);
1213 if (tunnel == NULL)
1216 err = pppol2tp_tunnel_ioctl(tunnel, cmd, arg);
1233 * sockets. In order to control kernel tunnel features, we allow userspace to
1234 * create a special "tunnel" PPPoX socket which is used for control only.
1242 struct l2tp_tunnel *tunnel,
1249 tunnel->debug = val;
1250 PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO,
1251 "%s: set debug=%x\n", tunnel->name, tunnel->debug);
1329 * Does API checks, then calls either the tunnel or session setsockopt
1331 * session or the special tunnel type.
1338 struct l2tp_tunnel *tunnel;
1362 /* Special case: if session_id == 0x0000, treat as operation on tunnel
1368 tunnel = l2tp_sock_to_tunnel(ps->tunnel_sock);
1369 if (tunnel == NULL)
1372 err = pppol2tp_tunnel_setsockopt(sk, tunnel, optname, val);
1388 struct l2tp_tunnel *tunnel,
1395 *val = tunnel->debug;
1396 PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO,
1397 "%s: get debug=%x\n", tunnel->name, tunnel->debug);
1455 * Does API checks, then calls either the tunnel or session getsockopt
1457 * or the special tunnel type.
1464 struct l2tp_tunnel *tunnel;
1490 /* Special case: if session_id == 0x0000, treat as operation on tunnel */
1495 tunnel = l2tp_sock_to_tunnel(ps->tunnel_sock);
1496 if (tunnel == NULL)
1499 err = pppol2tp_tunnel_getsockopt(sk, tunnel, optname, &val);
1531 int tunnel_idx; /* current tunnel */
1532 int session_idx; /* index of session within current tunnel */
1533 struct l2tp_tunnel *tunnel;
1534 struct l2tp_session *session; /* NULL means get next tunnel */
1540 pd->tunnel = l2tp_tunnel_find_nth(net, pd->tunnel_idx);
1543 if (pd->tunnel == NULL)
1547 if (pd->tunnel->version < 3)
1554 pd->session = l2tp_session_find_nth(pd->tunnel, pd->session_idx);
1576 if (pd->tunnel == NULL)
1581 /* NULL tunnel and session indicates end of list */
1582 if ((pd->tunnel == NULL) && (pd->session == NULL))
1602 struct l2tp_tunnel *tunnel = v;
1605 tunnel->name,
1606 (tunnel == tunnel->sock->sk_user_data) ? 'Y' : 'N',
1607 atomic_read(&tunnel->ref_count) - 1);
1609 tunnel->debug,
1610 (unsigned long long)tunnel->stats.tx_packets,
1611 (unsigned long long)tunnel->stats.tx_bytes,
1612 (unsigned long long)tunnel->stats.tx_errors,
1613 (unsigned long long)tunnel->stats.rx_packets,
1614 (unsigned long long)tunnel->stats.rx_bytes,
1615 (unsigned long long)tunnel->stats.rx_errors);
1621 struct l2tp_tunnel *tunnel = session->tunnel;
1627 if (tunnel->sock) {
1628 struct inet_sock *inet = inet_sk(tunnel->sock);
1636 tunnel->tunnel_id,
1638 tunnel->peer_tunnel_id,
1679 /* Show the tunnel or session context.
1682 pppol2tp_seq_tunnel_show(m, pd->tunnel);
1698 * iterating our tunnel / session contexts and store it in the private