l2tp: split l2tp_session_get()
l2tp_session_get() is used for two different purposes. If 'tunnel' is NULL, the session is searched globally in the supplied network namespace. Otherwise it is searched exclusively in the tunnel context. Callers always know the context in which they need to search the session. But some of them do provide both a namespace and a tunnel, making the semantic of the call unclear. This patch defines l2tp_tunnel_get_session() for lookups done in a tunnel and restricts l2tp_session_get() to namespace searches. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
d6a61ec936
commit
01e28b921b
@@ -757,7 +757,7 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
|
||||
if (tunnel->peer_tunnel_id == 0)
|
||||
tunnel->peer_tunnel_id = info.peer_tunnel_id;
|
||||
|
||||
session = l2tp_session_get(sock_net(sk), tunnel, info.session_id);
|
||||
session = l2tp_tunnel_get_session(tunnel, info.session_id);
|
||||
if (session) {
|
||||
drop_refcnt = true;
|
||||
|
||||
@@ -1134,10 +1134,10 @@ static int pppol2tp_tunnel_ioctl(struct l2tp_tunnel *tunnel,
|
||||
}
|
||||
if (stats.session_id != 0) {
|
||||
/* resend to session ioctl handler */
|
||||
struct l2tp_session *session =
|
||||
l2tp_session_get(sock_net(sk), tunnel,
|
||||
stats.session_id);
|
||||
struct l2tp_session *session;
|
||||
|
||||
session = l2tp_tunnel_get_session(tunnel,
|
||||
stats.session_id);
|
||||
if (!session) {
|
||||
err = -EBADR;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user