|
@@ -327,7 +327,8 @@ struct l2tp_session *l2tp_session_get(struct net *net,
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(l2tp_session_get);
|
|
EXPORT_SYMBOL_GPL(l2tp_session_get);
|
|
|
|
|
|
-struct l2tp_session *l2tp_session_find_nth(struct l2tp_tunnel *tunnel, int nth)
|
|
|
|
|
|
+struct l2tp_session *l2tp_session_get_nth(struct l2tp_tunnel *tunnel, int nth,
|
|
|
|
+ bool do_ref)
|
|
{
|
|
{
|
|
int hash;
|
|
int hash;
|
|
struct l2tp_session *session;
|
|
struct l2tp_session *session;
|
|
@@ -337,6 +338,9 @@ struct l2tp_session *l2tp_session_find_nth(struct l2tp_tunnel *tunnel, int nth)
|
|
for (hash = 0; hash < L2TP_HASH_SIZE; hash++) {
|
|
for (hash = 0; hash < L2TP_HASH_SIZE; hash++) {
|
|
hlist_for_each_entry(session, &tunnel->session_hlist[hash], hlist) {
|
|
hlist_for_each_entry(session, &tunnel->session_hlist[hash], hlist) {
|
|
if (++count > nth) {
|
|
if (++count > nth) {
|
|
|
|
+ l2tp_session_inc_refcount(session);
|
|
|
|
+ if (do_ref && session->ref)
|
|
|
|
+ session->ref(session);
|
|
read_unlock_bh(&tunnel->hlist_lock);
|
|
read_unlock_bh(&tunnel->hlist_lock);
|
|
return session;
|
|
return session;
|
|
}
|
|
}
|
|
@@ -347,7 +351,7 @@ struct l2tp_session *l2tp_session_find_nth(struct l2tp_tunnel *tunnel, int nth)
|
|
|
|
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
-EXPORT_SYMBOL_GPL(l2tp_session_find_nth);
|
|
|
|
|
|
+EXPORT_SYMBOL_GPL(l2tp_session_get_nth);
|
|
|
|
|
|
/* Lookup a session by interface name.
|
|
/* Lookup a session by interface name.
|
|
* This is very inefficient but is only used by management interfaces.
|
|
* This is very inefficient but is only used by management interfaces.
|