Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
0002 /***************************************************************************
0003  * Linux PPP over L2TP (PPPoL2TP) Socket Implementation (RFC 2661)
0004  *
0005  * This file supplies definitions required by the PPP over L2TP driver
0006  * (l2tp_ppp.c).  All version information wrt this file is located in l2tp_ppp.c
0007  *
0008  * License:
0009  *      This program is free software; you can redistribute it and/or
0010  *      modify it under the terms of the GNU General Public License
0011  *      as published by the Free Software Foundation; either version
0012  *      2 of the License, or (at your option) any later version.
0013  *
0014  */
0015 
0016 #ifndef _UAPI__LINUX_IF_PPPOL2TP_H
0017 #define _UAPI__LINUX_IF_PPPOL2TP_H
0018 
0019 #include <linux/types.h>
0020 #include <linux/in.h>
0021 #include <linux/in6.h>
0022 #include <linux/l2tp.h>
0023 
0024 /* Structure used to connect() the socket to a particular tunnel UDP
0025  * socket over IPv4.
0026  */
0027 struct pppol2tp_addr {
0028     __kernel_pid_t  pid;        /* pid that owns the fd.
0029                      * 0 => current */
0030     int fd;         /* FD of UDP socket to use */
0031 
0032     struct sockaddr_in addr;    /* IP address and port to send to */
0033 
0034     __u16 s_tunnel, s_session;  /* For matching incoming packets */
0035     __u16 d_tunnel, d_session;  /* For sending outgoing packets */
0036 };
0037 
0038 /* Structure used to connect() the socket to a particular tunnel UDP
0039  * socket over IPv6.
0040  */
0041 struct pppol2tpin6_addr {
0042     __kernel_pid_t  pid;        /* pid that owns the fd.
0043                      * 0 => current */
0044     int fd;         /* FD of UDP socket to use */
0045 
0046     __u16 s_tunnel, s_session;  /* For matching incoming packets */
0047     __u16 d_tunnel, d_session;  /* For sending outgoing packets */
0048 
0049     struct sockaddr_in6 addr;   /* IP address and port to send to */
0050 };
0051 
0052 /* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
0053  * bits. So we need a different sockaddr structure.
0054  */
0055 struct pppol2tpv3_addr {
0056     __kernel_pid_t  pid;        /* pid that owns the fd.
0057                      * 0 => current */
0058     int fd;         /* FD of UDP or IP socket to use */
0059 
0060     struct sockaddr_in addr;    /* IP address and port to send to */
0061 
0062     __u32 s_tunnel, s_session;  /* For matching incoming packets */
0063     __u32 d_tunnel, d_session;  /* For sending outgoing packets */
0064 };
0065 
0066 struct pppol2tpv3in6_addr {
0067     __kernel_pid_t  pid;        /* pid that owns the fd.
0068                      * 0 => current */
0069     int fd;         /* FD of UDP or IP socket to use */
0070 
0071     __u32 s_tunnel, s_session;  /* For matching incoming packets */
0072     __u32 d_tunnel, d_session;  /* For sending outgoing packets */
0073 
0074     struct sockaddr_in6 addr;   /* IP address and port to send to */
0075 };
0076 
0077 /* Socket options:
0078  * DEBUG    - bitmask of debug message categories (not used)
0079  * SENDSEQ  - 0 => don't send packets with sequence numbers
0080  *        1 => send packets with sequence numbers
0081  * RECVSEQ  - 0 => receive packet sequence numbers are optional
0082  *        1 => drop receive packets without sequence numbers
0083  * LNSMODE  - 0 => act as LAC.
0084  *        1 => act as LNS.
0085  * REORDERTO    - reorder timeout (in millisecs). If 0, don't try to reorder.
0086  */
0087 enum {
0088     PPPOL2TP_SO_DEBUG   = 1,
0089     PPPOL2TP_SO_RECVSEQ = 2,
0090     PPPOL2TP_SO_SENDSEQ = 3,
0091     PPPOL2TP_SO_LNSMODE = 4,
0092     PPPOL2TP_SO_REORDERTO   = 5,
0093 };
0094 
0095 /* Debug message categories for the DEBUG socket option (deprecated) */
0096 enum {
0097     PPPOL2TP_MSG_DEBUG  = L2TP_MSG_DEBUG,
0098     PPPOL2TP_MSG_CONTROL    = L2TP_MSG_CONTROL,
0099     PPPOL2TP_MSG_SEQ    = L2TP_MSG_SEQ,
0100     PPPOL2TP_MSG_DATA   = L2TP_MSG_DATA,
0101 };
0102 
0103 
0104 
0105 #endif /* _UAPI__LINUX_IF_PPPOL2TP_H */