xref: /OK3568_Linux_fs/kernel/include/uapi/linux/if_pppol2tp.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2*4882a593Smuzhiyun /***************************************************************************
3*4882a593Smuzhiyun  * Linux PPP over L2TP (PPPoL2TP) Socket Implementation (RFC 2661)
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * This file supplies definitions required by the PPP over L2TP driver
6*4882a593Smuzhiyun  * (l2tp_ppp.c).  All version information wrt this file is located in l2tp_ppp.c
7*4882a593Smuzhiyun  *
8*4882a593Smuzhiyun  * License:
9*4882a593Smuzhiyun  *		This program is free software; you can redistribute it and/or
10*4882a593Smuzhiyun  *		modify it under the terms of the GNU General Public License
11*4882a593Smuzhiyun  *		as published by the Free Software Foundation; either version
12*4882a593Smuzhiyun  *		2 of the License, or (at your option) any later version.
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  */
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun #ifndef _UAPI__LINUX_IF_PPPOL2TP_H
17*4882a593Smuzhiyun #define _UAPI__LINUX_IF_PPPOL2TP_H
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun #include <linux/types.h>
20*4882a593Smuzhiyun #include <linux/in.h>
21*4882a593Smuzhiyun #include <linux/in6.h>
22*4882a593Smuzhiyun #include <linux/l2tp.h>
23*4882a593Smuzhiyun 
24*4882a593Smuzhiyun /* Structure used to connect() the socket to a particular tunnel UDP
25*4882a593Smuzhiyun  * socket over IPv4.
26*4882a593Smuzhiyun  */
27*4882a593Smuzhiyun struct pppol2tp_addr {
28*4882a593Smuzhiyun 	__kernel_pid_t	pid;		/* pid that owns the fd.
29*4882a593Smuzhiyun 					 * 0 => current */
30*4882a593Smuzhiyun 	int	fd;			/* FD of UDP socket to use */
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun 	struct sockaddr_in addr;	/* IP address and port to send to */
33*4882a593Smuzhiyun 
34*4882a593Smuzhiyun 	__u16 s_tunnel, s_session;	/* For matching incoming packets */
35*4882a593Smuzhiyun 	__u16 d_tunnel, d_session;	/* For sending outgoing packets */
36*4882a593Smuzhiyun };
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun /* Structure used to connect() the socket to a particular tunnel UDP
39*4882a593Smuzhiyun  * socket over IPv6.
40*4882a593Smuzhiyun  */
41*4882a593Smuzhiyun struct pppol2tpin6_addr {
42*4882a593Smuzhiyun 	__kernel_pid_t	pid;		/* pid that owns the fd.
43*4882a593Smuzhiyun 					 * 0 => current */
44*4882a593Smuzhiyun 	int	fd;			/* FD of UDP socket to use */
45*4882a593Smuzhiyun 
46*4882a593Smuzhiyun 	__u16 s_tunnel, s_session;	/* For matching incoming packets */
47*4882a593Smuzhiyun 	__u16 d_tunnel, d_session;	/* For sending outgoing packets */
48*4882a593Smuzhiyun 
49*4882a593Smuzhiyun 	struct sockaddr_in6 addr;	/* IP address and port to send to */
50*4882a593Smuzhiyun };
51*4882a593Smuzhiyun 
52*4882a593Smuzhiyun /* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
53*4882a593Smuzhiyun  * bits. So we need a different sockaddr structure.
54*4882a593Smuzhiyun  */
55*4882a593Smuzhiyun struct pppol2tpv3_addr {
56*4882a593Smuzhiyun 	__kernel_pid_t	pid;		/* pid that owns the fd.
57*4882a593Smuzhiyun 					 * 0 => current */
58*4882a593Smuzhiyun 	int	fd;			/* FD of UDP or IP socket to use */
59*4882a593Smuzhiyun 
60*4882a593Smuzhiyun 	struct sockaddr_in addr;	/* IP address and port to send to */
61*4882a593Smuzhiyun 
62*4882a593Smuzhiyun 	__u32 s_tunnel, s_session;	/* For matching incoming packets */
63*4882a593Smuzhiyun 	__u32 d_tunnel, d_session;	/* For sending outgoing packets */
64*4882a593Smuzhiyun };
65*4882a593Smuzhiyun 
66*4882a593Smuzhiyun struct pppol2tpv3in6_addr {
67*4882a593Smuzhiyun 	__kernel_pid_t	pid;		/* pid that owns the fd.
68*4882a593Smuzhiyun 					 * 0 => current */
69*4882a593Smuzhiyun 	int	fd;			/* FD of UDP or IP socket to use */
70*4882a593Smuzhiyun 
71*4882a593Smuzhiyun 	__u32 s_tunnel, s_session;	/* For matching incoming packets */
72*4882a593Smuzhiyun 	__u32 d_tunnel, d_session;	/* For sending outgoing packets */
73*4882a593Smuzhiyun 
74*4882a593Smuzhiyun 	struct sockaddr_in6 addr;	/* IP address and port to send to */
75*4882a593Smuzhiyun };
76*4882a593Smuzhiyun 
77*4882a593Smuzhiyun /* Socket options:
78*4882a593Smuzhiyun  * DEBUG	- bitmask of debug message categories (not used)
79*4882a593Smuzhiyun  * SENDSEQ	- 0 => don't send packets with sequence numbers
80*4882a593Smuzhiyun  *		  1 => send packets with sequence numbers
81*4882a593Smuzhiyun  * RECVSEQ	- 0 => receive packet sequence numbers are optional
82*4882a593Smuzhiyun  *		  1 => drop receive packets without sequence numbers
83*4882a593Smuzhiyun  * LNSMODE	- 0 => act as LAC.
84*4882a593Smuzhiyun  *		  1 => act as LNS.
85*4882a593Smuzhiyun  * REORDERTO	- reorder timeout (in millisecs). If 0, don't try to reorder.
86*4882a593Smuzhiyun  */
87*4882a593Smuzhiyun enum {
88*4882a593Smuzhiyun 	PPPOL2TP_SO_DEBUG	= 1,
89*4882a593Smuzhiyun 	PPPOL2TP_SO_RECVSEQ	= 2,
90*4882a593Smuzhiyun 	PPPOL2TP_SO_SENDSEQ	= 3,
91*4882a593Smuzhiyun 	PPPOL2TP_SO_LNSMODE	= 4,
92*4882a593Smuzhiyun 	PPPOL2TP_SO_REORDERTO	= 5,
93*4882a593Smuzhiyun };
94*4882a593Smuzhiyun 
95*4882a593Smuzhiyun /* Debug message categories for the DEBUG socket option (deprecated) */
96*4882a593Smuzhiyun enum {
97*4882a593Smuzhiyun 	PPPOL2TP_MSG_DEBUG	= L2TP_MSG_DEBUG,
98*4882a593Smuzhiyun 	PPPOL2TP_MSG_CONTROL	= L2TP_MSG_CONTROL,
99*4882a593Smuzhiyun 	PPPOL2TP_MSG_SEQ	= L2TP_MSG_SEQ,
100*4882a593Smuzhiyun 	PPPOL2TP_MSG_DATA	= L2TP_MSG_DATA,
101*4882a593Smuzhiyun };
102*4882a593Smuzhiyun 
103*4882a593Smuzhiyun 
104*4882a593Smuzhiyun 
105*4882a593Smuzhiyun #endif /* _UAPI__LINUX_IF_PPPOL2TP_H */
106