if_pppol2tp.h 3.2 KB

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