xref: /linux/include/uapi/linux/if_pppol2tp.h (revision cbecf716ca618fd44feda6bd9a64a8179d031fc5)
1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2607ca46eSDavid Howells /***************************************************************************
3607ca46eSDavid Howells  * Linux PPP over L2TP (PPPoL2TP) Socket Implementation (RFC 2661)
4607ca46eSDavid Howells  *
5607ca46eSDavid Howells  * This file supplies definitions required by the PPP over L2TP driver
6607ca46eSDavid Howells  * (l2tp_ppp.c).  All version information wrt this file is located in l2tp_ppp.c
7607ca46eSDavid Howells  *
8607ca46eSDavid Howells  * License:
9607ca46eSDavid Howells  *		This program is free software; you can redistribute it and/or
10607ca46eSDavid Howells  *		modify it under the terms of the GNU General Public License
11607ca46eSDavid Howells  *		as published by the Free Software Foundation; either version
12607ca46eSDavid Howells  *		2 of the License, or (at your option) any later version.
13607ca46eSDavid Howells  *
14607ca46eSDavid Howells  */
15607ca46eSDavid Howells 
16607ca46eSDavid Howells #ifndef _UAPI__LINUX_IF_PPPOL2TP_H
17607ca46eSDavid Howells #define _UAPI__LINUX_IF_PPPOL2TP_H
18607ca46eSDavid Howells 
19607ca46eSDavid Howells #include <linux/types.h>
2005ee5de7SMikko Rapeli #include <linux/in.h>
2105ee5de7SMikko Rapeli #include <linux/in6.h>
2247c3e778SAsbjørn Sloth Tønnesen #include <linux/l2tp.h>
23607ca46eSDavid Howells 
24607ca46eSDavid Howells /* Structure used to connect() the socket to a particular tunnel UDP
25607ca46eSDavid Howells  * socket over IPv4.
26607ca46eSDavid Howells  */
27607ca46eSDavid Howells struct pppol2tp_addr {
28607ca46eSDavid Howells 	__kernel_pid_t	pid;		/* pid that owns the fd.
29607ca46eSDavid Howells 					 * 0 => current */
30607ca46eSDavid Howells 	int	fd;			/* FD of UDP socket to use */
31607ca46eSDavid Howells 
32607ca46eSDavid Howells 	struct sockaddr_in addr;	/* IP address and port to send to */
33607ca46eSDavid Howells 
34607ca46eSDavid Howells 	__u16 s_tunnel, s_session;	/* For matching incoming packets */
35607ca46eSDavid Howells 	__u16 d_tunnel, d_session;	/* For sending outgoing packets */
36607ca46eSDavid Howells };
37607ca46eSDavid Howells 
38607ca46eSDavid Howells /* Structure used to connect() the socket to a particular tunnel UDP
39607ca46eSDavid Howells  * socket over IPv6.
40607ca46eSDavid Howells  */
41607ca46eSDavid Howells struct pppol2tpin6_addr {
42607ca46eSDavid Howells 	__kernel_pid_t	pid;		/* pid that owns the fd.
43607ca46eSDavid Howells 					 * 0 => current */
44607ca46eSDavid Howells 	int	fd;			/* FD of UDP socket to use */
45607ca46eSDavid Howells 
46607ca46eSDavid Howells 	__u16 s_tunnel, s_session;	/* For matching incoming packets */
47607ca46eSDavid Howells 	__u16 d_tunnel, d_session;	/* For sending outgoing packets */
48607ca46eSDavid Howells 
49607ca46eSDavid Howells 	struct sockaddr_in6 addr;	/* IP address and port to send to */
50607ca46eSDavid Howells };
51607ca46eSDavid Howells 
52607ca46eSDavid Howells /* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
53607ca46eSDavid Howells  * bits. So we need a different sockaddr structure.
54607ca46eSDavid Howells  */
55607ca46eSDavid Howells struct pppol2tpv3_addr {
56607ca46eSDavid Howells 	__kernel_pid_t	pid;		/* pid that owns the fd.
57607ca46eSDavid Howells 					 * 0 => current */
58607ca46eSDavid Howells 	int	fd;			/* FD of UDP or IP socket to use */
59607ca46eSDavid Howells 
60607ca46eSDavid Howells 	struct sockaddr_in addr;	/* IP address and port to send to */
61607ca46eSDavid Howells 
62607ca46eSDavid Howells 	__u32 s_tunnel, s_session;	/* For matching incoming packets */
63607ca46eSDavid Howells 	__u32 d_tunnel, d_session;	/* For sending outgoing packets */
64607ca46eSDavid Howells };
65607ca46eSDavid Howells 
66607ca46eSDavid Howells struct pppol2tpv3in6_addr {
67607ca46eSDavid Howells 	__kernel_pid_t	pid;		/* pid that owns the fd.
68607ca46eSDavid Howells 					 * 0 => current */
69607ca46eSDavid Howells 	int	fd;			/* FD of UDP or IP socket to use */
70607ca46eSDavid Howells 
71607ca46eSDavid Howells 	__u32 s_tunnel, s_session;	/* For matching incoming packets */
72607ca46eSDavid Howells 	__u32 d_tunnel, d_session;	/* For sending outgoing packets */
73607ca46eSDavid Howells 
74607ca46eSDavid Howells 	struct sockaddr_in6 addr;	/* IP address and port to send to */
75607ca46eSDavid Howells };
76607ca46eSDavid Howells 
77607ca46eSDavid Howells /* Socket options:
78*eee049c0STom Parkin  * DEBUG	- bitmask of debug message categories (not used)
79607ca46eSDavid Howells  * SENDSEQ	- 0 => don't send packets with sequence numbers
80607ca46eSDavid Howells  *		  1 => send packets with sequence numbers
81607ca46eSDavid Howells  * RECVSEQ	- 0 => receive packet sequence numbers are optional
82607ca46eSDavid Howells  *		  1 => drop receive packets without sequence numbers
83607ca46eSDavid Howells  * LNSMODE	- 0 => act as LAC.
84607ca46eSDavid Howells  *		  1 => act as LNS.
85607ca46eSDavid Howells  * REORDERTO	- reorder timeout (in millisecs). If 0, don't try to reorder.
86607ca46eSDavid Howells  */
87607ca46eSDavid Howells enum {
88607ca46eSDavid Howells 	PPPOL2TP_SO_DEBUG	= 1,
89607ca46eSDavid Howells 	PPPOL2TP_SO_RECVSEQ	= 2,
90607ca46eSDavid Howells 	PPPOL2TP_SO_SENDSEQ	= 3,
91607ca46eSDavid Howells 	PPPOL2TP_SO_LNSMODE	= 4,
92607ca46eSDavid Howells 	PPPOL2TP_SO_REORDERTO	= 5,
93607ca46eSDavid Howells };
94607ca46eSDavid Howells 
9547c3e778SAsbjørn Sloth Tønnesen /* Debug message categories for the DEBUG socket option (deprecated) */
96607ca46eSDavid Howells enum {
9747c3e778SAsbjørn Sloth Tønnesen 	PPPOL2TP_MSG_DEBUG	= L2TP_MSG_DEBUG,
9847c3e778SAsbjørn Sloth Tønnesen 	PPPOL2TP_MSG_CONTROL	= L2TP_MSG_CONTROL,
9947c3e778SAsbjørn Sloth Tønnesen 	PPPOL2TP_MSG_SEQ	= L2TP_MSG_SEQ,
10047c3e778SAsbjørn Sloth Tønnesen 	PPPOL2TP_MSG_DATA	= L2TP_MSG_DATA,
101607ca46eSDavid Howells };
102607ca46eSDavid Howells 
103607ca46eSDavid Howells 
104607ca46eSDavid Howells 
105607ca46eSDavid Howells #endif /* _UAPI__LINUX_IF_PPPOL2TP_H */
106