diff options
Diffstat (limited to 'net/l2tp/l2tp_core.h')
-rw-r--r-- | net/l2tp/l2tp_core.h | 34 |
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 | ||
36 | enum 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 | |||
46 | enum l2tp_l2spec_type { | ||
47 | L2TP_L2SPECTYPE_NONE, | ||
48 | L2TP_L2SPECTYPE_DEFAULT, | ||
49 | }; | ||
50 | |||
51 | enum l2tp_encap_type { | ||
52 | L2TP_ENCAPTYPE_UDP, | ||
53 | L2TP_ENCAPTYPE_IP, | ||
54 | }; | ||
55 | |||
56 | struct sk_buff; | 36 | struct sk_buff; |
57 | 37 | ||
58 | struct l2tp_stats { | 38 | struct 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 | ||
103 | struct l2tp_session { | 85 | struct 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 | ||
178 | struct 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 | |||
195 | static inline void *l2tp_tunnel_priv(struct l2tp_tunnel *tunnel) | 183 | static 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 | ||
225 | extern struct l2tp_session *l2tp_session_find(struct net *net, struct l2tp_tunnel *tunnel, u32 session_id); | 213 | extern struct l2tp_session *l2tp_session_find(struct net *net, struct l2tp_tunnel *tunnel, u32 session_id); |
226 | extern struct l2tp_session *l2tp_session_find_nth(struct l2tp_tunnel *tunnel, int nth); | 214 | extern struct l2tp_session *l2tp_session_find_nth(struct l2tp_tunnel *tunnel, int nth); |
215 | extern struct l2tp_session *l2tp_session_find_by_ifname(struct net *net, char *ifname); | ||
227 | extern struct l2tp_tunnel *l2tp_tunnel_find(struct net *net, u32 tunnel_id); | 216 | extern struct l2tp_tunnel *l2tp_tunnel_find(struct net *net, u32 tunnel_id); |
228 | extern struct l2tp_tunnel *l2tp_tunnel_find_nth(struct net *net, int nth); | 217 | extern struct l2tp_tunnel *l2tp_tunnel_find_nth(struct net *net, int nth); |
229 | 218 | ||
230 | extern 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); | 219 | extern 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); |
220 | extern int l2tp_tunnel_delete(struct l2tp_tunnel *tunnel); | ||
231 | extern 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); | 221 | extern 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); |
222 | extern int l2tp_session_delete(struct l2tp_session *session); | ||
232 | extern void l2tp_tunnel_free(struct l2tp_tunnel *tunnel); | 223 | extern void l2tp_tunnel_free(struct l2tp_tunnel *tunnel); |
233 | extern void l2tp_session_free(struct l2tp_session *session); | 224 | extern void l2tp_session_free(struct l2tp_session *session); |
234 | extern 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)); | 225 | extern 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); | |||
241 | extern void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel); | 232 | extern void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel); |
242 | extern void l2tp_session_set_header_len(struct l2tp_session *session, int version); | 233 | extern void l2tp_session_set_header_len(struct l2tp_session *session, int version); |
243 | 234 | ||
235 | extern int l2tp_nl_register_ops(enum l2tp_pwtype pw_type, const struct l2tp_nl_cmd_ops *ops); | ||
236 | extern 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 | */ |