aboutsummaryrefslogtreecommitdiffstats
path: root/net/l2tp/l2tp_core.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/l2tp/l2tp_core.h')
-rw-r--r--net/l2tp/l2tp_core.h34
1 files changed, 14 insertions, 20 deletions
diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h
index d2395984645e..2974d9ade167 100644
--- a/net/l2tp/l2tp_core.h
+++ b/net/l2tp/l2tp_core.h
@@ -33,26 +33,6 @@ enum {
33 L2TP_MSG_DATA = (1 << 3), /* data packets */ 33 L2TP_MSG_DATA = (1 << 3), /* data packets */
34}; 34};
35 35
36enum l2tp_pwtype {
37 L2TP_PWTYPE_NONE = 0x0000,
38 L2TP_PWTYPE_ETH_VLAN = 0x0004,
39 L2TP_PWTYPE_ETH = 0x0005,
40 L2TP_PWTYPE_PPP = 0x0007,
41 L2TP_PWTYPE_PPP_AC = 0x0008,
42 L2TP_PWTYPE_IP = 0x000b,
43 __L2TP_PWTYPE_MAX
44};
45
46enum l2tp_l2spec_type {
47 L2TP_L2SPECTYPE_NONE,
48 L2TP_L2SPECTYPE_DEFAULT,
49};
50
51enum l2tp_encap_type {
52 L2TP_ENCAPTYPE_UDP,
53 L2TP_ENCAPTYPE_IP,
54};
55
56struct sk_buff; 36struct sk_buff;
57 37
58struct l2tp_stats { 38struct l2tp_stats {
@@ -87,6 +67,7 @@ struct l2tp_session_cfg {
87 * control of LNS. */ 67 * control of LNS. */
88 int debug; /* bitmask of debug message 68 int debug; /* bitmask of debug message
89 * categories */ 69 * categories */
70 u16 vlan_id; /* VLAN pseudowire only */
90 u16 offset; /* offset to payload */ 71 u16 offset; /* offset to payload */
91 u16 l2specific_len; /* Layer 2 specific length */ 72 u16 l2specific_len; /* Layer 2 specific length */
92 u16 l2specific_type; /* Layer 2 specific type */ 73 u16 l2specific_type; /* Layer 2 specific type */
@@ -98,6 +79,7 @@ struct l2tp_session_cfg {
98 * (in jiffies) */ 79 * (in jiffies) */
99 int mtu; 80 int mtu;
100 int mru; 81 int mru;
82 char *ifname;
101}; 83};
102 84
103struct l2tp_session { 85struct l2tp_session {
@@ -124,6 +106,7 @@ struct l2tp_session {
124 atomic_t ref_count; 106 atomic_t ref_count;
125 107
126 char name[32]; /* for logging */ 108 char name[32]; /* for logging */
109 char ifname[IFNAMSIZ];
127 unsigned data_seq:2; /* data sequencing level 110 unsigned data_seq:2; /* data sequencing level
128 * 0 => none, 1 => IP only, 111 * 0 => none, 1 => IP only,
129 * 2 => all 112 * 2 => all
@@ -192,6 +175,11 @@ struct l2tp_tunnel {
192 uint8_t priv[0]; /* private data */ 175 uint8_t priv[0]; /* private data */
193}; 176};
194 177
178struct l2tp_nl_cmd_ops {
179 int (*session_create)(struct net *net, u32 tunnel_id, u32 session_id, u32 peer_session_id, struct l2tp_session_cfg *cfg);
180 int (*session_delete)(struct l2tp_session *session);
181};
182
195static inline void *l2tp_tunnel_priv(struct l2tp_tunnel *tunnel) 183static inline void *l2tp_tunnel_priv(struct l2tp_tunnel *tunnel)
196{ 184{
197 return &tunnel->priv[0]; 185 return &tunnel->priv[0];
@@ -224,11 +212,14 @@ out:
224 212
225extern struct l2tp_session *l2tp_session_find(struct net *net, struct l2tp_tunnel *tunnel, u32 session_id); 213extern struct l2tp_session *l2tp_session_find(struct net *net, struct l2tp_tunnel *tunnel, u32 session_id);
226extern struct l2tp_session *l2tp_session_find_nth(struct l2tp_tunnel *tunnel, int nth); 214extern struct l2tp_session *l2tp_session_find_nth(struct l2tp_tunnel *tunnel, int nth);
215extern struct l2tp_session *l2tp_session_find_by_ifname(struct net *net, char *ifname);
227extern struct l2tp_tunnel *l2tp_tunnel_find(struct net *net, u32 tunnel_id); 216extern struct l2tp_tunnel *l2tp_tunnel_find(struct net *net, u32 tunnel_id);
228extern struct l2tp_tunnel *l2tp_tunnel_find_nth(struct net *net, int nth); 217extern struct l2tp_tunnel *l2tp_tunnel_find_nth(struct net *net, int nth);
229 218
230extern int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 peer_tunnel_id, struct l2tp_tunnel_cfg *cfg, struct l2tp_tunnel **tunnelp); 219extern int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 peer_tunnel_id, struct l2tp_tunnel_cfg *cfg, struct l2tp_tunnel **tunnelp);
220extern int l2tp_tunnel_delete(struct l2tp_tunnel *tunnel);
231extern struct l2tp_session *l2tp_session_create(int priv_size, struct l2tp_tunnel *tunnel, u32 session_id, u32 peer_session_id, struct l2tp_session_cfg *cfg); 221extern struct l2tp_session *l2tp_session_create(int priv_size, struct l2tp_tunnel *tunnel, u32 session_id, u32 peer_session_id, struct l2tp_session_cfg *cfg);
222extern int l2tp_session_delete(struct l2tp_session *session);
232extern void l2tp_tunnel_free(struct l2tp_tunnel *tunnel); 223extern void l2tp_tunnel_free(struct l2tp_tunnel *tunnel);
233extern void l2tp_session_free(struct l2tp_session *session); 224extern void l2tp_session_free(struct l2tp_session *session);
234extern void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, unsigned char *ptr, unsigned char *optr, u16 hdrflags, int length, int (*payload_hook)(struct sk_buff *skb)); 225extern void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, unsigned char *ptr, unsigned char *optr, u16 hdrflags, int length, int (*payload_hook)(struct sk_buff *skb));
@@ -241,6 +232,9 @@ extern void l2tp_tunnel_destruct(struct sock *sk);
241extern void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel); 232extern void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel);
242extern void l2tp_session_set_header_len(struct l2tp_session *session, int version); 233extern void l2tp_session_set_header_len(struct l2tp_session *session, int version);
243 234
235extern int l2tp_nl_register_ops(enum l2tp_pwtype pw_type, const struct l2tp_nl_cmd_ops *ops);
236extern void l2tp_nl_unregister_ops(enum l2tp_pwtype pw_type);
237
244/* Tunnel reference counts. Incremented per session that is added to 238/* Tunnel reference counts. Incremented per session that is added to
245 * the tunnel. 239 * the tunnel.
246 */ 240 */