diff options
Diffstat (limited to 'include/linux/l2tp.h')
-rw-r--r-- | include/linux/l2tp.h | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/include/linux/l2tp.h b/include/linux/l2tp.h index deff7bca4e05..4bdb31df8e72 100644 --- a/include/linux/l2tp.h +++ b/include/linux/l2tp.h | |||
@@ -11,6 +11,8 @@ | |||
11 | #ifdef __KERNEL__ | 11 | #ifdef __KERNEL__ |
12 | #include <linux/socket.h> | 12 | #include <linux/socket.h> |
13 | #include <linux/in.h> | 13 | #include <linux/in.h> |
14 | #else | ||
15 | #include <netinet/in.h> | ||
14 | #endif | 16 | #endif |
15 | 17 | ||
16 | #define IPPROTO_L2TP 115 | 18 | #define IPPROTO_L2TP 115 |
@@ -21,6 +23,7 @@ | |||
21 | * @l2tp_addr: protocol specific address information | 23 | * @l2tp_addr: protocol specific address information |
22 | * @l2tp_conn_id: connection id of tunnel | 24 | * @l2tp_conn_id: connection id of tunnel |
23 | */ | 25 | */ |
26 | #define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ | ||
24 | struct sockaddr_l2tpip { | 27 | struct sockaddr_l2tpip { |
25 | /* The first fields must match struct sockaddr_in */ | 28 | /* The first fields must match struct sockaddr_in */ |
26 | sa_family_t l2tp_family; /* AF_INET */ | 29 | sa_family_t l2tp_family; /* AF_INET */ |
@@ -35,4 +38,126 @@ struct sockaddr_l2tpip { | |||
35 | sizeof(__u32)]; | 38 | sizeof(__u32)]; |
36 | }; | 39 | }; |
37 | 40 | ||
41 | /***************************************************************************** | ||
42 | * NETLINK_GENERIC netlink family. | ||
43 | *****************************************************************************/ | ||
44 | |||
45 | /* | ||
46 | * Commands. | ||
47 | * Valid TLVs of each command are:- | ||
48 | * TUNNEL_CREATE - CONN_ID, pw_type, netns, ifname, ipinfo, udpinfo, udpcsum, vlanid | ||
49 | * TUNNEL_DELETE - CONN_ID | ||
50 | * TUNNEL_MODIFY - CONN_ID, udpcsum | ||
51 | * TUNNEL_GETSTATS - CONN_ID, (stats) | ||
52 | * TUNNEL_GET - CONN_ID, (...) | ||
53 | * SESSION_CREATE - SESSION_ID, PW_TYPE, offset, data_seq, cookie, peer_cookie, offset, l2spec | ||
54 | * SESSION_DELETE - SESSION_ID | ||
55 | * SESSION_MODIFY - SESSION_ID, data_seq | ||
56 | * SESSION_GET - SESSION_ID, (...) | ||
57 | * SESSION_GETSTATS - SESSION_ID, (stats) | ||
58 | * | ||
59 | */ | ||
60 | enum { | ||
61 | L2TP_CMD_NOOP, | ||
62 | L2TP_CMD_TUNNEL_CREATE, | ||
63 | L2TP_CMD_TUNNEL_DELETE, | ||
64 | L2TP_CMD_TUNNEL_MODIFY, | ||
65 | L2TP_CMD_TUNNEL_GET, | ||
66 | L2TP_CMD_SESSION_CREATE, | ||
67 | L2TP_CMD_SESSION_DELETE, | ||
68 | L2TP_CMD_SESSION_MODIFY, | ||
69 | L2TP_CMD_SESSION_GET, | ||
70 | __L2TP_CMD_MAX, | ||
71 | }; | ||
72 | |||
73 | #define L2TP_CMD_MAX (__L2TP_CMD_MAX - 1) | ||
74 | |||
75 | /* | ||
76 | * ATTR types defined for L2TP | ||
77 | */ | ||
78 | enum { | ||
79 | L2TP_ATTR_NONE, /* no data */ | ||
80 | L2TP_ATTR_PW_TYPE, /* u16, enum l2tp_pwtype */ | ||
81 | L2TP_ATTR_ENCAP_TYPE, /* u16, enum l2tp_encap_type */ | ||
82 | L2TP_ATTR_OFFSET, /* u16 */ | ||
83 | L2TP_ATTR_DATA_SEQ, /* u16 */ | ||
84 | L2TP_ATTR_L2SPEC_TYPE, /* u8, enum l2tp_l2spec_type */ | ||
85 | L2TP_ATTR_L2SPEC_LEN, /* u8, enum l2tp_l2spec_type */ | ||
86 | L2TP_ATTR_PROTO_VERSION, /* u8 */ | ||
87 | L2TP_ATTR_IFNAME, /* string */ | ||
88 | L2TP_ATTR_CONN_ID, /* u32 */ | ||
89 | L2TP_ATTR_PEER_CONN_ID, /* u32 */ | ||
90 | L2TP_ATTR_SESSION_ID, /* u32 */ | ||
91 | L2TP_ATTR_PEER_SESSION_ID, /* u32 */ | ||
92 | L2TP_ATTR_UDP_CSUM, /* u8 */ | ||
93 | L2TP_ATTR_VLAN_ID, /* u16 */ | ||
94 | L2TP_ATTR_COOKIE, /* 0, 4 or 8 bytes */ | ||
95 | L2TP_ATTR_PEER_COOKIE, /* 0, 4 or 8 bytes */ | ||
96 | L2TP_ATTR_DEBUG, /* u32 */ | ||
97 | L2TP_ATTR_RECV_SEQ, /* u8 */ | ||
98 | L2TP_ATTR_SEND_SEQ, /* u8 */ | ||
99 | L2TP_ATTR_LNS_MODE, /* u8 */ | ||
100 | L2TP_ATTR_USING_IPSEC, /* u8 */ | ||
101 | L2TP_ATTR_RECV_TIMEOUT, /* msec */ | ||
102 | L2TP_ATTR_FD, /* int */ | ||
103 | L2TP_ATTR_IP_SADDR, /* u32 */ | ||
104 | L2TP_ATTR_IP_DADDR, /* u32 */ | ||
105 | L2TP_ATTR_UDP_SPORT, /* u16 */ | ||
106 | L2TP_ATTR_UDP_DPORT, /* u16 */ | ||
107 | L2TP_ATTR_MTU, /* u16 */ | ||
108 | L2TP_ATTR_MRU, /* u16 */ | ||
109 | L2TP_ATTR_STATS, /* nested */ | ||
110 | __L2TP_ATTR_MAX, | ||
111 | }; | ||
112 | |||
113 | #define L2TP_ATTR_MAX (__L2TP_ATTR_MAX - 1) | ||
114 | |||
115 | /* Nested in L2TP_ATTR_STATS */ | ||
116 | enum { | ||
117 | L2TP_ATTR_STATS_NONE, /* no data */ | ||
118 | L2TP_ATTR_TX_PACKETS, /* u64 */ | ||
119 | L2TP_ATTR_TX_BYTES, /* u64 */ | ||
120 | L2TP_ATTR_TX_ERRORS, /* u64 */ | ||
121 | L2TP_ATTR_RX_PACKETS, /* u64 */ | ||
122 | L2TP_ATTR_RX_BYTES, /* u64 */ | ||
123 | L2TP_ATTR_RX_SEQ_DISCARDS, /* u64 */ | ||
124 | L2TP_ATTR_RX_OOS_PACKETS, /* u64 */ | ||
125 | L2TP_ATTR_RX_ERRORS, /* u64 */ | ||
126 | __L2TP_ATTR_STATS_MAX, | ||
127 | }; | ||
128 | |||
129 | #define L2TP_ATTR_STATS_MAX (__L2TP_ATTR_STATS_MAX - 1) | ||
130 | |||
131 | enum l2tp_pwtype { | ||
132 | L2TP_PWTYPE_NONE = 0x0000, | ||
133 | L2TP_PWTYPE_ETH_VLAN = 0x0004, | ||
134 | L2TP_PWTYPE_ETH = 0x0005, | ||
135 | L2TP_PWTYPE_PPP = 0x0007, | ||
136 | L2TP_PWTYPE_PPP_AC = 0x0008, | ||
137 | L2TP_PWTYPE_IP = 0x000b, | ||
138 | __L2TP_PWTYPE_MAX | ||
139 | }; | ||
140 | |||
141 | enum l2tp_l2spec_type { | ||
142 | L2TP_L2SPECTYPE_NONE, | ||
143 | L2TP_L2SPECTYPE_DEFAULT, | ||
144 | }; | ||
145 | |||
146 | enum l2tp_encap_type { | ||
147 | L2TP_ENCAPTYPE_UDP, | ||
148 | L2TP_ENCAPTYPE_IP, | ||
149 | }; | ||
150 | |||
151 | enum l2tp_seqmode { | ||
152 | L2TP_SEQ_NONE = 0, | ||
153 | L2TP_SEQ_IP = 1, | ||
154 | L2TP_SEQ_ALL = 2, | ||
155 | }; | ||
156 | |||
157 | /* | ||
158 | * NETLINK_GENERIC related info | ||
159 | */ | ||
160 | #define L2TP_GENL_NAME "l2tp" | ||
161 | #define L2TP_GENL_VERSION 0x1 | ||
162 | |||
38 | #endif | 163 | #endif |