diff options
author | Tom Parkin <tparkin@katalix.com> | 2013-03-19 02:11:14 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-20 12:10:38 -0400 |
commit | e34f4c7050e5471b6d4fb25380713937fc837514 (patch) | |
tree | 676057248524a261fe9976cc677dc19658bc5e63 | |
parent | 9980d001cec86c3c75f3a6008ddb73c397ea3b3e (diff) |
l2tp: export l2tp_tunnel_closeall
l2tp_core internally uses l2tp_tunnel_closeall to close all sessions in a
tunnel when a UDP-encapsulation socket is destroyed. We need to do something
similar for IP-encapsulation sockets.
Export l2tp_tunnel_closeall as a GPL symbol to enable l2tp_ip and l2tp_ip6 to
call it from their .destroy handlers.
Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: James Chapman <jchapman@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/l2tp/l2tp_core.c | 4 | ||||
-rw-r--r-- | net/l2tp/l2tp_core.h | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index ee726a752292..287e327342d1 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c | |||
@@ -114,7 +114,6 @@ struct l2tp_net { | |||
114 | 114 | ||
115 | static void l2tp_session_set_header_len(struct l2tp_session *session, int version); | 115 | static void l2tp_session_set_header_len(struct l2tp_session *session, int version); |
116 | static void l2tp_tunnel_free(struct l2tp_tunnel *tunnel); | 116 | static void l2tp_tunnel_free(struct l2tp_tunnel *tunnel); |
117 | static void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel); | ||
118 | 117 | ||
119 | static inline struct l2tp_net *l2tp_pernet(struct net *net) | 118 | static inline struct l2tp_net *l2tp_pernet(struct net *net) |
120 | { | 119 | { |
@@ -1312,7 +1311,7 @@ end: | |||
1312 | 1311 | ||
1313 | /* When the tunnel is closed, all the attached sessions need to go too. | 1312 | /* When the tunnel is closed, all the attached sessions need to go too. |
1314 | */ | 1313 | */ |
1315 | static void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel) | 1314 | void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel) |
1316 | { | 1315 | { |
1317 | int hash; | 1316 | int hash; |
1318 | struct hlist_node *walk; | 1317 | struct hlist_node *walk; |
@@ -1375,6 +1374,7 @@ again: | |||
1375 | } | 1374 | } |
1376 | write_unlock_bh(&tunnel->hlist_lock); | 1375 | write_unlock_bh(&tunnel->hlist_lock); |
1377 | } | 1376 | } |
1377 | EXPORT_SYMBOL_GPL(l2tp_tunnel_closeall); | ||
1378 | 1378 | ||
1379 | /* Tunnel socket destroy hook for UDP encapsulation */ | 1379 | /* Tunnel socket destroy hook for UDP encapsulation */ |
1380 | static void l2tp_udp_encap_destroy(struct sock *sk) | 1380 | static void l2tp_udp_encap_destroy(struct sock *sk) |
diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h index 8eb8f1d47f3a..b0861f68a10b 100644 --- a/net/l2tp/l2tp_core.h +++ b/net/l2tp/l2tp_core.h | |||
@@ -240,6 +240,7 @@ extern struct l2tp_tunnel *l2tp_tunnel_find(struct net *net, u32 tunnel_id); | |||
240 | extern struct l2tp_tunnel *l2tp_tunnel_find_nth(struct net *net, int nth); | 240 | extern struct l2tp_tunnel *l2tp_tunnel_find_nth(struct net *net, int nth); |
241 | 241 | ||
242 | 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); | 242 | 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); |
243 | extern void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel); | ||
243 | extern int l2tp_tunnel_delete(struct l2tp_tunnel *tunnel); | 244 | extern int l2tp_tunnel_delete(struct l2tp_tunnel *tunnel); |
244 | 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); | 245 | 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); |
245 | extern int l2tp_session_delete(struct l2tp_session *session); | 246 | extern int l2tp_session_delete(struct l2tp_session *session); |