1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun==== 4*4882a593SmuzhiyunL2TP 5*4882a593Smuzhiyun==== 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunLayer 2 Tunneling Protocol (L2TP) allows L2 frames to be tunneled over 8*4882a593Smuzhiyunan IP network. 9*4882a593Smuzhiyun 10*4882a593SmuzhiyunThis document covers the kernel's L2TP subsystem. It documents kernel 11*4882a593SmuzhiyunAPIs for application developers who want to use the L2TP subsystem and 12*4882a593Smuzhiyunit provides some technical details about the internal implementation 13*4882a593Smuzhiyunwhich may be useful to kernel developers and maintainers. 14*4882a593Smuzhiyun 15*4882a593SmuzhiyunOverview 16*4882a593Smuzhiyun======== 17*4882a593Smuzhiyun 18*4882a593SmuzhiyunThe kernel's L2TP subsystem implements the datapath for L2TPv2 and 19*4882a593SmuzhiyunL2TPv3. L2TPv2 is carried over UDP. L2TPv3 is carried over UDP or 20*4882a593Smuzhiyundirectly over IP (protocol 115). 21*4882a593Smuzhiyun 22*4882a593SmuzhiyunThe L2TP RFCs define two basic kinds of L2TP packets: control packets 23*4882a593Smuzhiyun(the "control plane"), and data packets (the "data plane"). The kernel 24*4882a593Smuzhiyundeals only with data packets. The more complex control packets are 25*4882a593Smuzhiyunhandled by user space. 26*4882a593Smuzhiyun 27*4882a593SmuzhiyunAn L2TP tunnel carries one or more L2TP sessions. Each tunnel is 28*4882a593Smuzhiyunassociated with a socket. Each session is associated with a virtual 29*4882a593Smuzhiyunnetdevice, e.g. ``pppN``, ``l2tpethN``, through which data frames pass 30*4882a593Smuzhiyunto/from L2TP. Fields in the L2TP header identify the tunnel or session 31*4882a593Smuzhiyunand whether it is a control or data packet. When tunnels and sessions 32*4882a593Smuzhiyunare set up using the Linux kernel API, we're just setting up the L2TP 33*4882a593Smuzhiyundata path. All aspects of the control protocol are to be handled by 34*4882a593Smuzhiyunuser space. 35*4882a593Smuzhiyun 36*4882a593SmuzhiyunThis split in responsibilities leads to a natural sequence of 37*4882a593Smuzhiyunoperations when establishing tunnels and sessions. The procedure looks 38*4882a593Smuzhiyunlike this: 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun 1) Create a tunnel socket. Exchange L2TP control protocol messages 41*4882a593Smuzhiyun with the peer over that socket in order to establish a tunnel. 42*4882a593Smuzhiyun 43*4882a593Smuzhiyun 2) Create a tunnel context in the kernel, using information 44*4882a593Smuzhiyun obtained from the peer using the control protocol messages. 45*4882a593Smuzhiyun 46*4882a593Smuzhiyun 3) Exchange L2TP control protocol messages with the peer over the 47*4882a593Smuzhiyun tunnel socket in order to establish a session. 48*4882a593Smuzhiyun 49*4882a593Smuzhiyun 4) Create a session context in the kernel using information 50*4882a593Smuzhiyun obtained from the peer using the control protocol messages. 51*4882a593Smuzhiyun 52*4882a593SmuzhiyunL2TP APIs 53*4882a593Smuzhiyun========= 54*4882a593Smuzhiyun 55*4882a593SmuzhiyunThis section documents each userspace API of the L2TP subsystem. 56*4882a593Smuzhiyun 57*4882a593SmuzhiyunTunnel Sockets 58*4882a593Smuzhiyun-------------- 59*4882a593Smuzhiyun 60*4882a593SmuzhiyunL2TPv2 always uses UDP. L2TPv3 may use UDP or IP encapsulation. 61*4882a593Smuzhiyun 62*4882a593SmuzhiyunTo create a tunnel socket for use by L2TP, the standard POSIX 63*4882a593Smuzhiyunsocket API is used. 64*4882a593Smuzhiyun 65*4882a593SmuzhiyunFor example, for a tunnel using IPv4 addresses and UDP encapsulation:: 66*4882a593Smuzhiyun 67*4882a593Smuzhiyun int sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); 68*4882a593Smuzhiyun 69*4882a593SmuzhiyunOr for a tunnel using IPv6 addresses and IP encapsulation:: 70*4882a593Smuzhiyun 71*4882a593Smuzhiyun int sockfd = socket(AF_INET6, SOCK_DGRAM, IPPROTO_L2TP); 72*4882a593Smuzhiyun 73*4882a593SmuzhiyunUDP socket programming doesn't need to be covered here. 74*4882a593Smuzhiyun 75*4882a593SmuzhiyunIPPROTO_L2TP is an IP protocol type implemented by the kernel's L2TP 76*4882a593Smuzhiyunsubsystem. The L2TPIP socket address is defined in struct 77*4882a593Smuzhiyunsockaddr_l2tpip and struct sockaddr_l2tpip6 at 78*4882a593Smuzhiyun`include/uapi/linux/l2tp.h`_. The address includes the L2TP tunnel 79*4882a593Smuzhiyun(connection) id. To use L2TP IP encapsulation, an L2TPv3 application 80*4882a593Smuzhiyunshould bind the L2TPIP socket using the locally assigned 81*4882a593Smuzhiyuntunnel id. When the peer's tunnel id and IP address is known, a 82*4882a593Smuzhiyunconnect must be done. 83*4882a593Smuzhiyun 84*4882a593SmuzhiyunIf the L2TP application needs to handle L2TPv3 tunnel setup requests 85*4882a593Smuzhiyunfrom peers using L2TPIP, it must open a dedicated L2TPIP 86*4882a593Smuzhiyunsocket to listen for those requests and bind the socket using tunnel 87*4882a593Smuzhiyunid 0 since tunnel setup requests are addressed to tunnel id 0. 88*4882a593Smuzhiyun 89*4882a593SmuzhiyunAn L2TP tunnel and all of its sessions are automatically closed when 90*4882a593Smuzhiyunits tunnel socket is closed. 91*4882a593Smuzhiyun 92*4882a593SmuzhiyunNetlink API 93*4882a593Smuzhiyun----------- 94*4882a593Smuzhiyun 95*4882a593SmuzhiyunL2TP applications use netlink to manage L2TP tunnel and session 96*4882a593Smuzhiyuninstances in the kernel. The L2TP netlink API is defined in 97*4882a593Smuzhiyun`include/uapi/linux/l2tp.h`_. 98*4882a593Smuzhiyun 99*4882a593SmuzhiyunL2TP uses `Generic Netlink`_ (GENL). Several commands are defined: 100*4882a593SmuzhiyunCreate, Delete, Modify and Get for tunnel and session 101*4882a593Smuzhiyuninstances, e.g. ``L2TP_CMD_TUNNEL_CREATE``. The API header lists the 102*4882a593Smuzhiyunnetlink attribute types that can be used with each command. 103*4882a593Smuzhiyun 104*4882a593SmuzhiyunTunnel and session instances are identified by a locally unique 105*4882a593Smuzhiyun32-bit id. L2TP tunnel ids are given by ``L2TP_ATTR_CONN_ID`` and 106*4882a593Smuzhiyun``L2TP_ATTR_PEER_CONN_ID`` attributes and L2TP session ids are given 107*4882a593Smuzhiyunby ``L2TP_ATTR_SESSION_ID`` and ``L2TP_ATTR_PEER_SESSION_ID`` 108*4882a593Smuzhiyunattributes. If netlink is used to manage L2TPv2 tunnel and session 109*4882a593Smuzhiyuninstances, the L2TPv2 16-bit tunnel/session id is cast to a 32-bit 110*4882a593Smuzhiyunvalue in these attributes. 111*4882a593Smuzhiyun 112*4882a593SmuzhiyunIn the ``L2TP_CMD_TUNNEL_CREATE`` command, ``L2TP_ATTR_FD`` tells the 113*4882a593Smuzhiyunkernel the tunnel socket fd being used. If not specified, the kernel 114*4882a593Smuzhiyuncreates a kernel socket for the tunnel, using IP parameters set in 115*4882a593Smuzhiyun``L2TP_ATTR_IP[6]_SADDR``, ``L2TP_ATTR_IP[6]_DADDR``, 116*4882a593Smuzhiyun``L2TP_ATTR_UDP_SPORT``, ``L2TP_ATTR_UDP_DPORT`` attributes. Kernel 117*4882a593Smuzhiyunsockets are used to implement unmanaged L2TPv3 tunnels (iproute2's "ip 118*4882a593Smuzhiyunl2tp" commands). If ``L2TP_ATTR_FD`` is given, it must be a socket fd 119*4882a593Smuzhiyunthat is already bound and connected. There is more information about 120*4882a593Smuzhiyununmanaged tunnels later in this document. 121*4882a593Smuzhiyun 122*4882a593Smuzhiyun``L2TP_CMD_TUNNEL_CREATE`` attributes:- 123*4882a593Smuzhiyun 124*4882a593Smuzhiyun================== ======== === 125*4882a593SmuzhiyunAttribute Required Use 126*4882a593Smuzhiyun================== ======== === 127*4882a593SmuzhiyunCONN_ID Y Sets the tunnel (connection) id. 128*4882a593SmuzhiyunPEER_CONN_ID Y Sets the peer tunnel (connection) id. 129*4882a593SmuzhiyunPROTO_VERSION Y Protocol version. 2 or 3. 130*4882a593SmuzhiyunENCAP_TYPE Y Encapsulation type: UDP or IP. 131*4882a593SmuzhiyunFD N Tunnel socket file descriptor. 132*4882a593SmuzhiyunUDP_CSUM N Enable IPv4 UDP checksums. Used only if FD is 133*4882a593Smuzhiyun not set. 134*4882a593SmuzhiyunUDP_ZERO_CSUM6_TX N Zero IPv6 UDP checksum on transmit. Used only 135*4882a593Smuzhiyun if FD is not set. 136*4882a593SmuzhiyunUDP_ZERO_CSUM6_RX N Zero IPv6 UDP checksum on receive. Used only if 137*4882a593Smuzhiyun FD is not set. 138*4882a593SmuzhiyunIP_SADDR N IPv4 source address. Used only if FD is not 139*4882a593Smuzhiyun set. 140*4882a593SmuzhiyunIP_DADDR N IPv4 destination address. Used only if FD is 141*4882a593Smuzhiyun not set. 142*4882a593SmuzhiyunUDP_SPORT N UDP source port. Used only if FD is not set. 143*4882a593SmuzhiyunUDP_DPORT N UDP destination port. Used only if FD is not 144*4882a593Smuzhiyun set. 145*4882a593SmuzhiyunIP6_SADDR N IPv6 source address. Used only if FD is not 146*4882a593Smuzhiyun set. 147*4882a593SmuzhiyunIP6_DADDR N IPv6 destination address. Used only if FD is 148*4882a593Smuzhiyun not set. 149*4882a593SmuzhiyunDEBUG N Debug flags. 150*4882a593Smuzhiyun================== ======== === 151*4882a593Smuzhiyun 152*4882a593Smuzhiyun``L2TP_CMD_TUNNEL_DESTROY`` attributes:- 153*4882a593Smuzhiyun 154*4882a593Smuzhiyun================== ======== === 155*4882a593SmuzhiyunAttribute Required Use 156*4882a593Smuzhiyun================== ======== === 157*4882a593SmuzhiyunCONN_ID Y Identifies the tunnel id to be destroyed. 158*4882a593Smuzhiyun================== ======== === 159*4882a593Smuzhiyun 160*4882a593Smuzhiyun``L2TP_CMD_TUNNEL_MODIFY`` attributes:- 161*4882a593Smuzhiyun 162*4882a593Smuzhiyun================== ======== === 163*4882a593SmuzhiyunAttribute Required Use 164*4882a593Smuzhiyun================== ======== === 165*4882a593SmuzhiyunCONN_ID Y Identifies the tunnel id to be modified. 166*4882a593SmuzhiyunDEBUG N Debug flags. 167*4882a593Smuzhiyun================== ======== === 168*4882a593Smuzhiyun 169*4882a593Smuzhiyun``L2TP_CMD_TUNNEL_GET`` attributes:- 170*4882a593Smuzhiyun 171*4882a593Smuzhiyun================== ======== === 172*4882a593SmuzhiyunAttribute Required Use 173*4882a593Smuzhiyun================== ======== === 174*4882a593SmuzhiyunCONN_ID N Identifies the tunnel id to be queried. 175*4882a593Smuzhiyun Ignored in DUMP requests. 176*4882a593Smuzhiyun================== ======== === 177*4882a593Smuzhiyun 178*4882a593Smuzhiyun``L2TP_CMD_SESSION_CREATE`` attributes:- 179*4882a593Smuzhiyun 180*4882a593Smuzhiyun================== ======== === 181*4882a593SmuzhiyunAttribute Required Use 182*4882a593Smuzhiyun================== ======== === 183*4882a593SmuzhiyunCONN_ID Y The parent tunnel id. 184*4882a593SmuzhiyunSESSION_ID Y Sets the session id. 185*4882a593SmuzhiyunPEER_SESSION_ID Y Sets the parent session id. 186*4882a593SmuzhiyunPW_TYPE Y Sets the pseudowire type. 187*4882a593SmuzhiyunDEBUG N Debug flags. 188*4882a593SmuzhiyunRECV_SEQ N Enable rx data sequence numbers. 189*4882a593SmuzhiyunSEND_SEQ N Enable tx data sequence numbers. 190*4882a593SmuzhiyunLNS_MODE N Enable LNS mode (auto-enable data sequence 191*4882a593Smuzhiyun numbers). 192*4882a593SmuzhiyunRECV_TIMEOUT N Timeout to wait when reordering received 193*4882a593Smuzhiyun packets. 194*4882a593SmuzhiyunL2SPEC_TYPE N Sets layer2-specific-sublayer type (L2TPv3 195*4882a593Smuzhiyun only). 196*4882a593SmuzhiyunCOOKIE N Sets optional cookie (L2TPv3 only). 197*4882a593SmuzhiyunPEER_COOKIE N Sets optional peer cookie (L2TPv3 only). 198*4882a593SmuzhiyunIFNAME N Sets interface name (L2TPv3 only). 199*4882a593Smuzhiyun================== ======== === 200*4882a593Smuzhiyun 201*4882a593SmuzhiyunFor Ethernet session types, this will create an l2tpeth virtual 202*4882a593Smuzhiyuninterface which can then be configured as required. For PPP session 203*4882a593Smuzhiyuntypes, a PPPoL2TP socket must also be opened and connected, mapping it 204*4882a593Smuzhiyunonto the new session. This is covered in "PPPoL2TP Sockets" later. 205*4882a593Smuzhiyun 206*4882a593Smuzhiyun``L2TP_CMD_SESSION_DESTROY`` attributes:- 207*4882a593Smuzhiyun 208*4882a593Smuzhiyun================== ======== === 209*4882a593SmuzhiyunAttribute Required Use 210*4882a593Smuzhiyun================== ======== === 211*4882a593SmuzhiyunCONN_ID Y Identifies the parent tunnel id of the session 212*4882a593Smuzhiyun to be destroyed. 213*4882a593SmuzhiyunSESSION_ID Y Identifies the session id to be destroyed. 214*4882a593SmuzhiyunIFNAME N Identifies the session by interface name. If 215*4882a593Smuzhiyun set, this overrides any CONN_ID and SESSION_ID 216*4882a593Smuzhiyun attributes. Currently supported for L2TPv3 217*4882a593Smuzhiyun Ethernet sessions only. 218*4882a593Smuzhiyun================== ======== === 219*4882a593Smuzhiyun 220*4882a593Smuzhiyun``L2TP_CMD_SESSION_MODIFY`` attributes:- 221*4882a593Smuzhiyun 222*4882a593Smuzhiyun================== ======== === 223*4882a593SmuzhiyunAttribute Required Use 224*4882a593Smuzhiyun================== ======== === 225*4882a593SmuzhiyunCONN_ID Y Identifies the parent tunnel id of the session 226*4882a593Smuzhiyun to be modified. 227*4882a593SmuzhiyunSESSION_ID Y Identifies the session id to be modified. 228*4882a593SmuzhiyunIFNAME N Identifies the session by interface name. If 229*4882a593Smuzhiyun set, this overrides any CONN_ID and SESSION_ID 230*4882a593Smuzhiyun attributes. Currently supported for L2TPv3 231*4882a593Smuzhiyun Ethernet sessions only. 232*4882a593SmuzhiyunDEBUG N Debug flags. 233*4882a593SmuzhiyunRECV_SEQ N Enable rx data sequence numbers. 234*4882a593SmuzhiyunSEND_SEQ N Enable tx data sequence numbers. 235*4882a593SmuzhiyunLNS_MODE N Enable LNS mode (auto-enable data sequence 236*4882a593Smuzhiyun numbers). 237*4882a593SmuzhiyunRECV_TIMEOUT N Timeout to wait when reordering received 238*4882a593Smuzhiyun packets. 239*4882a593Smuzhiyun================== ======== === 240*4882a593Smuzhiyun 241*4882a593Smuzhiyun``L2TP_CMD_SESSION_GET`` attributes:- 242*4882a593Smuzhiyun 243*4882a593Smuzhiyun================== ======== === 244*4882a593SmuzhiyunAttribute Required Use 245*4882a593Smuzhiyun================== ======== === 246*4882a593SmuzhiyunCONN_ID N Identifies the tunnel id to be queried. 247*4882a593Smuzhiyun Ignored for DUMP requests. 248*4882a593SmuzhiyunSESSION_ID N Identifies the session id to be queried. 249*4882a593Smuzhiyun Ignored for DUMP requests. 250*4882a593SmuzhiyunIFNAME N Identifies the session by interface name. 251*4882a593Smuzhiyun If set, this overrides any CONN_ID and 252*4882a593Smuzhiyun SESSION_ID attributes. Ignored for DUMP 253*4882a593Smuzhiyun requests. Currently supported for L2TPv3 254*4882a593Smuzhiyun Ethernet sessions only. 255*4882a593Smuzhiyun================== ======== === 256*4882a593Smuzhiyun 257*4882a593SmuzhiyunApplication developers should refer to `include/uapi/linux/l2tp.h`_ for 258*4882a593Smuzhiyunnetlink command and attribute definitions. 259*4882a593Smuzhiyun 260*4882a593SmuzhiyunSample userspace code using libmnl_: 261*4882a593Smuzhiyun 262*4882a593Smuzhiyun - Open L2TP netlink socket:: 263*4882a593Smuzhiyun 264*4882a593Smuzhiyun struct nl_sock *nl_sock; 265*4882a593Smuzhiyun int l2tp_nl_family_id; 266*4882a593Smuzhiyun 267*4882a593Smuzhiyun nl_sock = nl_socket_alloc(); 268*4882a593Smuzhiyun genl_connect(nl_sock); 269*4882a593Smuzhiyun genl_id = genl_ctrl_resolve(nl_sock, L2TP_GENL_NAME); 270*4882a593Smuzhiyun 271*4882a593Smuzhiyun - Create a tunnel:: 272*4882a593Smuzhiyun 273*4882a593Smuzhiyun struct nlmsghdr *nlh; 274*4882a593Smuzhiyun struct genlmsghdr *gnlh; 275*4882a593Smuzhiyun 276*4882a593Smuzhiyun nlh = mnl_nlmsg_put_header(buf); 277*4882a593Smuzhiyun nlh->nlmsg_type = genl_id; /* assigned to genl socket */ 278*4882a593Smuzhiyun nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; 279*4882a593Smuzhiyun nlh->nlmsg_seq = seq; 280*4882a593Smuzhiyun 281*4882a593Smuzhiyun gnlh = mnl_nlmsg_put_extra_header(nlh, sizeof(*gnlh)); 282*4882a593Smuzhiyun gnlh->cmd = L2TP_CMD_TUNNEL_CREATE; 283*4882a593Smuzhiyun gnlh->version = L2TP_GENL_VERSION; 284*4882a593Smuzhiyun gnlh->reserved = 0; 285*4882a593Smuzhiyun 286*4882a593Smuzhiyun mnl_attr_put_u32(nlh, L2TP_ATTR_FD, tunl_sock_fd); 287*4882a593Smuzhiyun mnl_attr_put_u32(nlh, L2TP_ATTR_CONN_ID, tid); 288*4882a593Smuzhiyun mnl_attr_put_u32(nlh, L2TP_ATTR_PEER_CONN_ID, peer_tid); 289*4882a593Smuzhiyun mnl_attr_put_u8(nlh, L2TP_ATTR_PROTO_VERSION, protocol_version); 290*4882a593Smuzhiyun mnl_attr_put_u16(nlh, L2TP_ATTR_ENCAP_TYPE, encap); 291*4882a593Smuzhiyun 292*4882a593Smuzhiyun - Create a session:: 293*4882a593Smuzhiyun 294*4882a593Smuzhiyun struct nlmsghdr *nlh; 295*4882a593Smuzhiyun struct genlmsghdr *gnlh; 296*4882a593Smuzhiyun 297*4882a593Smuzhiyun nlh = mnl_nlmsg_put_header(buf); 298*4882a593Smuzhiyun nlh->nlmsg_type = genl_id; /* assigned to genl socket */ 299*4882a593Smuzhiyun nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; 300*4882a593Smuzhiyun nlh->nlmsg_seq = seq; 301*4882a593Smuzhiyun 302*4882a593Smuzhiyun gnlh = mnl_nlmsg_put_extra_header(nlh, sizeof(*gnlh)); 303*4882a593Smuzhiyun gnlh->cmd = L2TP_CMD_SESSION_CREATE; 304*4882a593Smuzhiyun gnlh->version = L2TP_GENL_VERSION; 305*4882a593Smuzhiyun gnlh->reserved = 0; 306*4882a593Smuzhiyun 307*4882a593Smuzhiyun mnl_attr_put_u32(nlh, L2TP_ATTR_CONN_ID, tid); 308*4882a593Smuzhiyun mnl_attr_put_u32(nlh, L2TP_ATTR_PEER_CONN_ID, peer_tid); 309*4882a593Smuzhiyun mnl_attr_put_u32(nlh, L2TP_ATTR_SESSION_ID, sid); 310*4882a593Smuzhiyun mnl_attr_put_u32(nlh, L2TP_ATTR_PEER_SESSION_ID, peer_sid); 311*4882a593Smuzhiyun mnl_attr_put_u16(nlh, L2TP_ATTR_PW_TYPE, pwtype); 312*4882a593Smuzhiyun /* there are other session options which can be set using netlink 313*4882a593Smuzhiyun * attributes during session creation -- see l2tp.h 314*4882a593Smuzhiyun */ 315*4882a593Smuzhiyun 316*4882a593Smuzhiyun - Delete a session:: 317*4882a593Smuzhiyun 318*4882a593Smuzhiyun struct nlmsghdr *nlh; 319*4882a593Smuzhiyun struct genlmsghdr *gnlh; 320*4882a593Smuzhiyun 321*4882a593Smuzhiyun nlh = mnl_nlmsg_put_header(buf); 322*4882a593Smuzhiyun nlh->nlmsg_type = genl_id; /* assigned to genl socket */ 323*4882a593Smuzhiyun nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; 324*4882a593Smuzhiyun nlh->nlmsg_seq = seq; 325*4882a593Smuzhiyun 326*4882a593Smuzhiyun gnlh = mnl_nlmsg_put_extra_header(nlh, sizeof(*gnlh)); 327*4882a593Smuzhiyun gnlh->cmd = L2TP_CMD_SESSION_DELETE; 328*4882a593Smuzhiyun gnlh->version = L2TP_GENL_VERSION; 329*4882a593Smuzhiyun gnlh->reserved = 0; 330*4882a593Smuzhiyun 331*4882a593Smuzhiyun mnl_attr_put_u32(nlh, L2TP_ATTR_CONN_ID, tid); 332*4882a593Smuzhiyun mnl_attr_put_u32(nlh, L2TP_ATTR_SESSION_ID, sid); 333*4882a593Smuzhiyun 334*4882a593Smuzhiyun - Delete a tunnel and all of its sessions (if any):: 335*4882a593Smuzhiyun 336*4882a593Smuzhiyun struct nlmsghdr *nlh; 337*4882a593Smuzhiyun struct genlmsghdr *gnlh; 338*4882a593Smuzhiyun 339*4882a593Smuzhiyun nlh = mnl_nlmsg_put_header(buf); 340*4882a593Smuzhiyun nlh->nlmsg_type = genl_id; /* assigned to genl socket */ 341*4882a593Smuzhiyun nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; 342*4882a593Smuzhiyun nlh->nlmsg_seq = seq; 343*4882a593Smuzhiyun 344*4882a593Smuzhiyun gnlh = mnl_nlmsg_put_extra_header(nlh, sizeof(*gnlh)); 345*4882a593Smuzhiyun gnlh->cmd = L2TP_CMD_TUNNEL_DELETE; 346*4882a593Smuzhiyun gnlh->version = L2TP_GENL_VERSION; 347*4882a593Smuzhiyun gnlh->reserved = 0; 348*4882a593Smuzhiyun 349*4882a593Smuzhiyun mnl_attr_put_u32(nlh, L2TP_ATTR_CONN_ID, tid); 350*4882a593Smuzhiyun 351*4882a593SmuzhiyunPPPoL2TP Session Socket API 352*4882a593Smuzhiyun--------------------------- 353*4882a593Smuzhiyun 354*4882a593SmuzhiyunFor PPP session types, a PPPoL2TP socket must be opened and connected 355*4882a593Smuzhiyunto the L2TP session. 356*4882a593Smuzhiyun 357*4882a593SmuzhiyunWhen creating PPPoL2TP sockets, the application provides information 358*4882a593Smuzhiyunto the kernel about the tunnel and session in a socket connect() 359*4882a593Smuzhiyuncall. Source and destination tunnel and session ids are provided, as 360*4882a593Smuzhiyunwell as the file descriptor of a UDP or L2TPIP socket. See struct 361*4882a593Smuzhiyunpppol2tp_addr in `include/linux/if_pppol2tp.h`_. For historical reasons, 362*4882a593Smuzhiyunthere are unfortunately slightly different address structures for 363*4882a593SmuzhiyunL2TPv2/L2TPv3 IPv4/IPv6 tunnels and userspace must use the appropriate 364*4882a593Smuzhiyunstructure that matches the tunnel socket type. 365*4882a593Smuzhiyun 366*4882a593SmuzhiyunUserspace may control behavior of the tunnel or session using 367*4882a593Smuzhiyunsetsockopt and ioctl on the PPPoX socket. The following socket 368*4882a593Smuzhiyunoptions are supported:- 369*4882a593Smuzhiyun 370*4882a593Smuzhiyun========= =========================================================== 371*4882a593SmuzhiyunDEBUG bitmask of debug message categories. See below. 372*4882a593SmuzhiyunSENDSEQ - 0 => don't send packets with sequence numbers 373*4882a593Smuzhiyun - 1 => send packets with sequence numbers 374*4882a593SmuzhiyunRECVSEQ - 0 => receive packet sequence numbers are optional 375*4882a593Smuzhiyun - 1 => drop receive packets without sequence numbers 376*4882a593SmuzhiyunLNSMODE - 0 => act as LAC. 377*4882a593Smuzhiyun - 1 => act as LNS. 378*4882a593SmuzhiyunREORDERTO reorder timeout (in millisecs). If 0, don't try to reorder. 379*4882a593Smuzhiyun========= =========================================================== 380*4882a593Smuzhiyun 381*4882a593SmuzhiyunIn addition to the standard PPP ioctls, a PPPIOCGL2TPSTATS is provided 382*4882a593Smuzhiyunto retrieve tunnel and session statistics from the kernel using the 383*4882a593SmuzhiyunPPPoX socket of the appropriate tunnel or session. 384*4882a593Smuzhiyun 385*4882a593SmuzhiyunSample userspace code: 386*4882a593Smuzhiyun 387*4882a593Smuzhiyun - Create session PPPoX data socket:: 388*4882a593Smuzhiyun 389*4882a593Smuzhiyun struct sockaddr_pppol2tp sax; 390*4882a593Smuzhiyun int fd; 391*4882a593Smuzhiyun 392*4882a593Smuzhiyun /* Note, the tunnel socket must be bound already, else it 393*4882a593Smuzhiyun * will not be ready 394*4882a593Smuzhiyun */ 395*4882a593Smuzhiyun sax.sa_family = AF_PPPOX; 396*4882a593Smuzhiyun sax.sa_protocol = PX_PROTO_OL2TP; 397*4882a593Smuzhiyun sax.pppol2tp.fd = tunnel_fd; 398*4882a593Smuzhiyun sax.pppol2tp.addr.sin_addr.s_addr = addr->sin_addr.s_addr; 399*4882a593Smuzhiyun sax.pppol2tp.addr.sin_port = addr->sin_port; 400*4882a593Smuzhiyun sax.pppol2tp.addr.sin_family = AF_INET; 401*4882a593Smuzhiyun sax.pppol2tp.s_tunnel = tunnel_id; 402*4882a593Smuzhiyun sax.pppol2tp.s_session = session_id; 403*4882a593Smuzhiyun sax.pppol2tp.d_tunnel = peer_tunnel_id; 404*4882a593Smuzhiyun sax.pppol2tp.d_session = peer_session_id; 405*4882a593Smuzhiyun 406*4882a593Smuzhiyun /* session_fd is the fd of the session's PPPoL2TP socket. 407*4882a593Smuzhiyun * tunnel_fd is the fd of the tunnel UDP / L2TPIP socket. 408*4882a593Smuzhiyun */ 409*4882a593Smuzhiyun fd = connect(session_fd, (struct sockaddr *)&sax, sizeof(sax)); 410*4882a593Smuzhiyun if (fd < 0 ) { 411*4882a593Smuzhiyun return -errno; 412*4882a593Smuzhiyun } 413*4882a593Smuzhiyun return 0; 414*4882a593Smuzhiyun 415*4882a593SmuzhiyunOld L2TPv2-only API 416*4882a593Smuzhiyun------------------- 417*4882a593Smuzhiyun 418*4882a593SmuzhiyunWhen L2TP was first added to the Linux kernel in 2.6.23, it 419*4882a593Smuzhiyunimplemented only L2TPv2 and did not include a netlink API. Instead, 420*4882a593Smuzhiyuntunnel and session instances in the kernel were managed directly using 421*4882a593Smuzhiyunonly PPPoL2TP sockets. The PPPoL2TP socket is used as described in 422*4882a593Smuzhiyunsection "PPPoL2TP Session Socket API" but tunnel and session instances 423*4882a593Smuzhiyunare automatically created on a connect() of the socket instead of 424*4882a593Smuzhiyunbeing created by a separate netlink request: 425*4882a593Smuzhiyun 426*4882a593Smuzhiyun - Tunnels are managed using a tunnel management socket which is a 427*4882a593Smuzhiyun dedicated PPPoL2TP socket, connected to (invalid) session 428*4882a593Smuzhiyun id 0. The L2TP tunnel instance is created when the PPPoL2TP 429*4882a593Smuzhiyun tunnel management socket is connected and is destroyed when the 430*4882a593Smuzhiyun socket is closed. 431*4882a593Smuzhiyun 432*4882a593Smuzhiyun - Session instances are created in the kernel when a PPPoL2TP 433*4882a593Smuzhiyun socket is connected to a non-zero session id. Session parameters 434*4882a593Smuzhiyun are set using setsockopt. The L2TP session instance is destroyed 435*4882a593Smuzhiyun when the socket is closed. 436*4882a593Smuzhiyun 437*4882a593SmuzhiyunThis API is still supported but its use is discouraged. Instead, new 438*4882a593SmuzhiyunL2TPv2 applications should use netlink to first create the tunnel and 439*4882a593Smuzhiyunsession, then create a PPPoL2TP socket for the session. 440*4882a593Smuzhiyun 441*4882a593SmuzhiyunUnmanaged L2TPv3 tunnels 442*4882a593Smuzhiyun------------------------ 443*4882a593Smuzhiyun 444*4882a593SmuzhiyunThe kernel L2TP subsystem also supports static (unmanaged) L2TPv3 445*4882a593Smuzhiyuntunnels. Unmanaged tunnels have no userspace tunnel socket, and 446*4882a593Smuzhiyunexchange no control messages with the peer to set up the tunnel; the 447*4882a593Smuzhiyuntunnel is configured manually at each end of the tunnel. All 448*4882a593Smuzhiyunconfiguration is done using netlink. There is no need for an L2TP 449*4882a593Smuzhiyunuserspace application in this case -- the tunnel socket is created by 450*4882a593Smuzhiyunthe kernel and configured using parameters sent in the 451*4882a593Smuzhiyun``L2TP_CMD_TUNNEL_CREATE`` netlink request. The ``ip`` utility of 452*4882a593Smuzhiyun``iproute2`` has commands for managing static L2TPv3 tunnels; do ``ip 453*4882a593Smuzhiyunl2tp help`` for more information. 454*4882a593Smuzhiyun 455*4882a593SmuzhiyunDebugging 456*4882a593Smuzhiyun--------- 457*4882a593Smuzhiyun 458*4882a593SmuzhiyunThe L2TP subsystem offers a range of debugging interfaces through the 459*4882a593Smuzhiyundebugfs filesystem. 460*4882a593Smuzhiyun 461*4882a593SmuzhiyunTo access these interfaces, the debugfs filesystem must first be mounted:: 462*4882a593Smuzhiyun 463*4882a593Smuzhiyun # mount -t debugfs debugfs /debug 464*4882a593Smuzhiyun 465*4882a593SmuzhiyunFiles under the l2tp directory can then be accessed, providing a summary 466*4882a593Smuzhiyunof the current population of tunnel and session contexts existing in the 467*4882a593Smuzhiyunkernel:: 468*4882a593Smuzhiyun 469*4882a593Smuzhiyun # cat /debug/l2tp/tunnels 470*4882a593Smuzhiyun 471*4882a593SmuzhiyunThe debugfs files should not be used by applications to obtain L2TP 472*4882a593Smuzhiyunstate information because the file format is subject to change. It is 473*4882a593Smuzhiyunimplemented to provide extra debug information to help diagnose 474*4882a593Smuzhiyunproblems. Applications should instead use the netlink API. 475*4882a593Smuzhiyun 476*4882a593SmuzhiyunIn addition the L2TP subsystem implements tracepoints using the standard 477*4882a593Smuzhiyunkernel event tracing API. The available L2TP events can be reviewed as 478*4882a593Smuzhiyunfollows:: 479*4882a593Smuzhiyun 480*4882a593Smuzhiyun # find /debug/tracing/events/l2tp 481*4882a593Smuzhiyun 482*4882a593SmuzhiyunFinally, /proc/net/pppol2tp is also provided for backwards compatibility 483*4882a593Smuzhiyunwith the original pppol2tp code. It lists information about L2TPv2 484*4882a593Smuzhiyuntunnels and sessions only. Its use is discouraged. 485*4882a593Smuzhiyun 486*4882a593SmuzhiyunInternal Implementation 487*4882a593Smuzhiyun======================= 488*4882a593Smuzhiyun 489*4882a593SmuzhiyunThis section is for kernel developers and maintainers. 490*4882a593Smuzhiyun 491*4882a593SmuzhiyunSockets 492*4882a593Smuzhiyun------- 493*4882a593Smuzhiyun 494*4882a593SmuzhiyunUDP sockets are implemented by the networking core. When an L2TP 495*4882a593Smuzhiyuntunnel is created using a UDP socket, the socket is set up as an 496*4882a593Smuzhiyunencapsulated UDP socket by setting encap_rcv and encap_destroy 497*4882a593Smuzhiyuncallbacks on the UDP socket. l2tp_udp_encap_recv is called when 498*4882a593Smuzhiyunpackets are received on the socket. l2tp_udp_encap_destroy is called 499*4882a593Smuzhiyunwhen userspace closes the socket. 500*4882a593Smuzhiyun 501*4882a593SmuzhiyunL2TPIP sockets are implemented in `net/l2tp/l2tp_ip.c`_ and 502*4882a593Smuzhiyun`net/l2tp/l2tp_ip6.c`_. 503*4882a593Smuzhiyun 504*4882a593SmuzhiyunTunnels 505*4882a593Smuzhiyun------- 506*4882a593Smuzhiyun 507*4882a593SmuzhiyunThe kernel keeps a struct l2tp_tunnel context per L2TP tunnel. The 508*4882a593Smuzhiyunl2tp_tunnel is always associated with a UDP or L2TP/IP socket and 509*4882a593Smuzhiyunkeeps a list of sessions in the tunnel. When a tunnel is first 510*4882a593Smuzhiyunregistered with L2TP core, the reference count on the socket is 511*4882a593Smuzhiyunincreased. This ensures that the socket cannot be removed while L2TP's 512*4882a593Smuzhiyundata structures reference it. 513*4882a593Smuzhiyun 514*4882a593SmuzhiyunTunnels are identified by a unique tunnel id. The id is 16-bit for 515*4882a593SmuzhiyunL2TPv2 and 32-bit for L2TPv3. Internally, the id is stored as a 32-bit 516*4882a593Smuzhiyunvalue. 517*4882a593Smuzhiyun 518*4882a593SmuzhiyunTunnels are kept in a per-net list, indexed by tunnel id. The tunnel 519*4882a593Smuzhiyunid namespace is shared by L2TPv2 and L2TPv3. The tunnel context can be 520*4882a593Smuzhiyunderived from the socket's sk_user_data. 521*4882a593Smuzhiyun 522*4882a593SmuzhiyunHandling tunnel socket close is perhaps the most tricky part of the 523*4882a593SmuzhiyunL2TP implementation. If userspace closes a tunnel socket, the L2TP 524*4882a593Smuzhiyuntunnel and all of its sessions must be closed and destroyed. Since the 525*4882a593Smuzhiyuntunnel context holds a ref on the tunnel socket, the socket's 526*4882a593Smuzhiyunsk_destruct won't be called until the tunnel sock_put's its 527*4882a593Smuzhiyunsocket. For UDP sockets, when userspace closes the tunnel socket, the 528*4882a593Smuzhiyunsocket's encap_destroy handler is invoked, which L2TP uses to initiate 529*4882a593Smuzhiyunits tunnel close actions. For L2TPIP sockets, the socket's close 530*4882a593Smuzhiyunhandler initiates the same tunnel close actions. All sessions are 531*4882a593Smuzhiyunfirst closed. Each session drops its tunnel ref. When the tunnel ref 532*4882a593Smuzhiyunreaches zero, the tunnel puts its socket ref. When the socket is 533*4882a593Smuzhiyuneventually destroyed, it's sk_destruct finally frees the L2TP tunnel 534*4882a593Smuzhiyuncontext. 535*4882a593Smuzhiyun 536*4882a593SmuzhiyunSessions 537*4882a593Smuzhiyun-------- 538*4882a593Smuzhiyun 539*4882a593SmuzhiyunThe kernel keeps a struct l2tp_session context for each session. Each 540*4882a593Smuzhiyunsession has private data which is used for data specific to the 541*4882a593Smuzhiyunsession type. With L2TPv2, the session always carries PPP 542*4882a593Smuzhiyuntraffic. With L2TPv3, the session can carry Ethernet frames (Ethernet 543*4882a593Smuzhiyunpseudowire) or other data types such as PPP, ATM, HDLC or Frame 544*4882a593SmuzhiyunRelay. Linux currently implements only Ethernet and PPP session types. 545*4882a593Smuzhiyun 546*4882a593SmuzhiyunSome L2TP session types also have a socket (PPP pseudowires) while 547*4882a593Smuzhiyunothers do not (Ethernet pseudowires). We can't therefore use the 548*4882a593Smuzhiyunsocket reference count as the reference count for session 549*4882a593Smuzhiyuncontexts. The L2TP implementation therefore has its own internal 550*4882a593Smuzhiyunreference counts on the session contexts. 551*4882a593Smuzhiyun 552*4882a593SmuzhiyunLike tunnels, L2TP sessions are identified by a unique 553*4882a593Smuzhiyunsession id. Just as with tunnel ids, the session id is 16-bit for 554*4882a593SmuzhiyunL2TPv2 and 32-bit for L2TPv3. Internally, the id is stored as a 32-bit 555*4882a593Smuzhiyunvalue. 556*4882a593Smuzhiyun 557*4882a593SmuzhiyunSessions hold a ref on their parent tunnel to ensure that the tunnel 558*4882a593Smuzhiyunstays extant while one or more sessions references it. 559*4882a593Smuzhiyun 560*4882a593SmuzhiyunSessions are kept in a per-tunnel list, indexed by session id. L2TPv3 561*4882a593Smuzhiyunsessions are also kept in a per-net list indexed by session id, 562*4882a593Smuzhiyunbecause L2TPv3 session ids are unique across all tunnels and L2TPv3 563*4882a593Smuzhiyundata packets do not contain a tunnel id in the header. This list is 564*4882a593Smuzhiyuntherefore needed to find the session context associated with a 565*4882a593Smuzhiyunreceived data packet when the tunnel context cannot be derived from 566*4882a593Smuzhiyunthe tunnel socket. 567*4882a593Smuzhiyun 568*4882a593SmuzhiyunAlthough the L2TPv3 RFC specifies that L2TPv3 session ids are not 569*4882a593Smuzhiyunscoped by the tunnel, the kernel does not police this for L2TPv3 UDP 570*4882a593Smuzhiyuntunnels and does not add sessions of L2TPv3 UDP tunnels into the 571*4882a593Smuzhiyunper-net session list. In the UDP receive code, we must trust that the 572*4882a593Smuzhiyuntunnel can be identified using the tunnel socket's sk_user_data and 573*4882a593Smuzhiyunlookup the session in the tunnel's session list instead of the per-net 574*4882a593Smuzhiyunsession list. 575*4882a593Smuzhiyun 576*4882a593SmuzhiyunPPP 577*4882a593Smuzhiyun--- 578*4882a593Smuzhiyun 579*4882a593Smuzhiyun`net/l2tp/l2tp_ppp.c`_ implements the PPPoL2TP socket family. Each PPP 580*4882a593Smuzhiyunsession has a PPPoL2TP socket. 581*4882a593Smuzhiyun 582*4882a593SmuzhiyunThe PPPoL2TP socket's sk_user_data references the l2tp_session. 583*4882a593Smuzhiyun 584*4882a593SmuzhiyunUserspace sends and receives PPP packets over L2TP using a PPPoL2TP 585*4882a593Smuzhiyunsocket. Only PPP control frames pass over this socket: PPP data 586*4882a593Smuzhiyunpackets are handled entirely by the kernel, passing between the L2TP 587*4882a593Smuzhiyunsession and its associated ``pppN`` netdev through the PPP channel 588*4882a593Smuzhiyuninterface of the kernel PPP subsystem. 589*4882a593Smuzhiyun 590*4882a593SmuzhiyunThe L2TP PPP implementation handles the closing of a PPPoL2TP socket 591*4882a593Smuzhiyunby closing its corresponding L2TP session. This is complicated because 592*4882a593Smuzhiyunit must consider racing with netlink session create/destroy requests 593*4882a593Smuzhiyunand pppol2tp_connect trying to reconnect with a session that is in the 594*4882a593Smuzhiyunprocess of being closed. Unlike tunnels, PPP sessions do not hold a 595*4882a593Smuzhiyunref on their associated socket, so code must be careful to sock_hold 596*4882a593Smuzhiyunthe socket where necessary. For all the details, see commit 597*4882a593Smuzhiyun3d609342cc04129ff7568e19316ce3d7451a27e8. 598*4882a593Smuzhiyun 599*4882a593SmuzhiyunEthernet 600*4882a593Smuzhiyun-------- 601*4882a593Smuzhiyun 602*4882a593Smuzhiyun`net/l2tp/l2tp_eth.c`_ implements L2TPv3 Ethernet pseudowires. It 603*4882a593Smuzhiyunmanages a netdev for each session. 604*4882a593Smuzhiyun 605*4882a593SmuzhiyunL2TP Ethernet sessions are created and destroyed by netlink request, 606*4882a593Smuzhiyunor are destroyed when the tunnel is destroyed. Unlike PPP sessions, 607*4882a593SmuzhiyunEthernet sessions do not have an associated socket. 608*4882a593Smuzhiyun 609*4882a593SmuzhiyunMiscellaneous 610*4882a593Smuzhiyun============= 611*4882a593Smuzhiyun 612*4882a593SmuzhiyunRFCs 613*4882a593Smuzhiyun---- 614*4882a593Smuzhiyun 615*4882a593SmuzhiyunThe kernel code implements the datapath features specified in the 616*4882a593Smuzhiyunfollowing RFCs: 617*4882a593Smuzhiyun 618*4882a593Smuzhiyun======= =============== =================================== 619*4882a593SmuzhiyunRFC2661 L2TPv2 https://tools.ietf.org/html/rfc2661 620*4882a593SmuzhiyunRFC3931 L2TPv3 https://tools.ietf.org/html/rfc3931 621*4882a593SmuzhiyunRFC4719 L2TPv3 Ethernet https://tools.ietf.org/html/rfc4719 622*4882a593Smuzhiyun======= =============== =================================== 623*4882a593Smuzhiyun 624*4882a593SmuzhiyunImplementations 625*4882a593Smuzhiyun--------------- 626*4882a593Smuzhiyun 627*4882a593SmuzhiyunA number of open source applications use the L2TP kernel subsystem: 628*4882a593Smuzhiyun 629*4882a593Smuzhiyun============ ============================================== 630*4882a593Smuzhiyuniproute2 https://github.com/shemminger/iproute2 631*4882a593Smuzhiyungo-l2tp https://github.com/katalix/go-l2tp 632*4882a593Smuzhiyuntunneldigger https://github.com/wlanslovenija/tunneldigger 633*4882a593Smuzhiyunxl2tpd https://github.com/xelerance/xl2tpd 634*4882a593Smuzhiyun============ ============================================== 635*4882a593Smuzhiyun 636*4882a593SmuzhiyunLimitations 637*4882a593Smuzhiyun----------- 638*4882a593Smuzhiyun 639*4882a593SmuzhiyunThe current implementation has a number of limitations: 640*4882a593Smuzhiyun 641*4882a593Smuzhiyun 1) Multiple UDP sockets with the same 5-tuple address cannot be 642*4882a593Smuzhiyun used. The kernel's tunnel context is identified using private 643*4882a593Smuzhiyun data associated with the socket so it is important that each 644*4882a593Smuzhiyun socket is uniquely identified by its address. 645*4882a593Smuzhiyun 646*4882a593Smuzhiyun 2) Interfacing with openvswitch is not yet implemented. It may be 647*4882a593Smuzhiyun useful to map OVS Ethernet and VLAN ports into L2TPv3 tunnels. 648*4882a593Smuzhiyun 649*4882a593Smuzhiyun 3) VLAN pseudowires are implemented using an ``l2tpethN`` interface 650*4882a593Smuzhiyun configured with a VLAN sub-interface. Since L2TPv3 VLAN 651*4882a593Smuzhiyun pseudowires carry one and only one VLAN, it may be better to use 652*4882a593Smuzhiyun a single netdevice rather than an ``l2tpethN`` and ``l2tpethN``:M 653*4882a593Smuzhiyun pair per VLAN session. The netlink attribute 654*4882a593Smuzhiyun ``L2TP_ATTR_VLAN_ID`` was added for this, but it was never 655*4882a593Smuzhiyun implemented. 656*4882a593Smuzhiyun 657*4882a593SmuzhiyunTesting 658*4882a593Smuzhiyun------- 659*4882a593Smuzhiyun 660*4882a593SmuzhiyunUnmanaged L2TPv3 Ethernet features are tested by the kernel's built-in 661*4882a593Smuzhiyunselftests. See `tools/testing/selftests/net/l2tp.sh`_. 662*4882a593Smuzhiyun 663*4882a593SmuzhiyunAnother test suite, l2tp-ktest_, covers all 664*4882a593Smuzhiyunof the L2TP APIs and tunnel/session types. This may be integrated into 665*4882a593Smuzhiyunthe kernel's built-in L2TP selftests in the future. 666*4882a593Smuzhiyun 667*4882a593Smuzhiyun.. Links 668*4882a593Smuzhiyun.. _Generic Netlink: generic_netlink.html 669*4882a593Smuzhiyun.. _libmnl: https://www.netfilter.org/projects/libmnl 670*4882a593Smuzhiyun.. _include/uapi/linux/l2tp.h: ../../../include/uapi/linux/l2tp.h 671*4882a593Smuzhiyun.. _include/linux/if_pppol2tp.h: ../../../include/linux/if_pppol2tp.h 672*4882a593Smuzhiyun.. _net/l2tp/l2tp_ip.c: ../../../net/l2tp/l2tp_ip.c 673*4882a593Smuzhiyun.. _net/l2tp/l2tp_ip6.c: ../../../net/l2tp/l2tp_ip6.c 674*4882a593Smuzhiyun.. _net/l2tp/l2tp_ppp.c: ../../../net/l2tp/l2tp_ppp.c 675*4882a593Smuzhiyun.. _net/l2tp/l2tp_eth.c: ../../../net/l2tp/l2tp_eth.c 676*4882a593Smuzhiyun.. _tools/testing/selftests/net/l2tp.sh: ../../../tools/testing/selftests/net/l2tp.sh 677*4882a593Smuzhiyun.. _l2tp-ktest: https://github.com/katalix/l2tp-ktest 678