Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
l2tp.h
Go to the documentation of this file.
1 /*
2  * L2TP-over-IP socket for L2TPv3.
3  *
4  * Author: James Chapman <[email protected]>
5  */
6 
7 #ifndef _UAPI_LINUX_L2TP_H_
8 #define _UAPI_LINUX_L2TP_H_
9 
10 #include <linux/types.h>
11 #include <linux/socket.h>
12 #ifndef __KERNEL__
13 #include <netinet/in.h>
14 #endif
15 
16 #define IPPROTO_L2TP 115
17 
24 #define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */
26  /* The first fields must match struct sockaddr_in */
28  __be16 l2tp_unused; /* INET port number (unused) */
29  struct in_addr l2tp_addr; /* Internet address */
30 
31  __u32 l2tp_conn_id; /* Connection ID of tunnel */
32 
33  /* Pad to size of `struct sockaddr'. */
34  unsigned char __pad[sizeof(struct sockaddr) -
38 };
39 
47  /* The first fields must match struct sockaddr_in6 */
49  __be16 l2tp_unused; /* INET port number (unused) */
50  __be32 l2tp_flowinfo; /* IPv6 flow information */
51  struct in6_addr l2tp_addr; /* IPv6 address */
52  __u32 l2tp_scope_id; /* scope id (new in RFC2553) */
53  __u32 l2tp_conn_id; /* Connection ID of tunnel */
54 };
55 
56 /*****************************************************************************
57  * NETLINK_GENERIC netlink family.
58  *****************************************************************************/
59 
60 /*
61  * Commands.
62  * Valid TLVs of each command are:-
63  * TUNNEL_CREATE - CONN_ID, pw_type, netns, ifname, ipinfo, udpinfo, udpcsum, vlanid
64  * TUNNEL_DELETE - CONN_ID
65  * TUNNEL_MODIFY - CONN_ID, udpcsum
66  * TUNNEL_GETSTATS - CONN_ID, (stats)
67  * TUNNEL_GET - CONN_ID, (...)
68  * SESSION_CREATE - SESSION_ID, PW_TYPE, offset, data_seq, cookie, peer_cookie, offset, l2spec
69  * SESSION_DELETE - SESSION_ID
70  * SESSION_MODIFY - SESSION_ID, data_seq
71  * SESSION_GET - SESSION_ID, (...)
72  * SESSION_GETSTATS - SESSION_ID, (stats)
73  *
74  */
75 enum {
86 };
87 
88 #define L2TP_CMD_MAX (__L2TP_CMD_MAX - 1)
89 
90 /*
91  * ATTR types defined for L2TP
92  */
93 enum {
94  L2TP_ATTR_NONE, /* no data */
95  L2TP_ATTR_PW_TYPE, /* u16, enum l2tp_pwtype */
96  L2TP_ATTR_ENCAP_TYPE, /* u16, enum l2tp_encap_type */
97  L2TP_ATTR_OFFSET, /* u16 */
98  L2TP_ATTR_DATA_SEQ, /* u16 */
99  L2TP_ATTR_L2SPEC_TYPE, /* u8, enum l2tp_l2spec_type */
100  L2TP_ATTR_L2SPEC_LEN, /* u8, enum l2tp_l2spec_type */
102  L2TP_ATTR_IFNAME, /* string */
103  L2TP_ATTR_CONN_ID, /* u32 */
108  L2TP_ATTR_VLAN_ID, /* u16 */
109  L2TP_ATTR_COOKIE, /* 0, 4 or 8 bytes */
110  L2TP_ATTR_PEER_COOKIE, /* 0, 4 or 8 bytes */
111  L2TP_ATTR_DEBUG, /* u32 */
117  L2TP_ATTR_FD, /* int */
122  L2TP_ATTR_MTU, /* u16 */
123  L2TP_ATTR_MRU, /* u16 */
124  L2TP_ATTR_STATS, /* nested */
125  L2TP_ATTR_IP6_SADDR, /* struct in6_addr */
126  L2TP_ATTR_IP6_DADDR, /* struct in6_addr */
128 };
129 
130 #define L2TP_ATTR_MAX (__L2TP_ATTR_MAX - 1)
131 
132 /* Nested in L2TP_ATTR_STATS */
133 enum {
134  L2TP_ATTR_STATS_NONE, /* no data */
144 };
145 
146 #define L2TP_ATTR_STATS_MAX (__L2TP_ATTR_STATS_MAX - 1)
147 
151  L2TP_PWTYPE_ETH = 0x0005,
152  L2TP_PWTYPE_PPP = 0x0007,
154  L2TP_PWTYPE_IP = 0x000b,
156 };
157 
161 };
162 
166 };
167 
172 };
173 
174 /*
175  * NETLINK_GENERIC related info
176  */
177 #define L2TP_GENL_NAME "l2tp"
178 #define L2TP_GENL_VERSION 0x1
179 
180 #endif /* _UAPI_LINUX_L2TP_H_ */