Skip to content

Commit

Permalink
l2tp: fix userspace reception on plain L2TP sockets
Browse files Browse the repository at this point in the history
As pppol2tp_recv() never queues up packets to plain L2TP sockets,
pppol2tp_recvmsg() never returns data to userspace, thus making
the recv*() system calls unusable.

Instead of dropping packets when the L2TP socket isn't bound to a PPP
channel, this patch adds them to its reception queue.

Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Guillaume Nault authored and David S. Miller committed Mar 6, 2014
1 parent bb5016e commit 9e9cb62
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions net/l2tp/l2tp_ppp.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,14 @@ static void pppol2tp_recv(struct l2tp_session *session, struct sk_buff *skb, int
po = pppox_sk(sk);
ppp_input(&po->chan, skb);
} else {
l2tp_info(session, PPPOL2TP_MSG_DATA, "%s: socket not bound\n",
session->name);
l2tp_dbg(session, PPPOL2TP_MSG_DATA,
"%s: recv %d byte data frame, passing to L2TP socket\n",
session->name, data_len);

/* Not bound. Nothing we can do, so discard. */
atomic_long_inc(&session->stats.rx_errors);
kfree_skb(skb);
if (sock_queue_rcv_skb(sk, skb) < 0) {
atomic_long_inc(&session->stats.rx_errors);
kfree_skb(skb);
}
}

return;
Expand Down

0 comments on commit 9e9cb62

Please sign in to comment.