summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl/l2tp/l2tp.c
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pppd/ctrl/l2tp/l2tp.c')
-rw-r--r--accel-pppd/ctrl/l2tp/l2tp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c
index 85d79793..6342088c 100644
--- a/accel-pppd/ctrl/l2tp/l2tp.c
+++ b/accel-pppd/ctrl/l2tp/l2tp.c
@@ -914,10 +914,16 @@ static int l2tp_conn_read(struct triton_md_handler_t *h)
struct l2tp_conn_t *conn = container_of(h, typeof(*conn), hnd);
struct l2tp_packet_t *pack, *p;
struct l2tp_attr_t *msg_type;
+ int res;
while (1) {
- if (l2tp_recv(h->fd, &pack, NULL))
+ res = l2tp_recv(h->fd, &pack, NULL);
+ if (res) {
+ if (res == -2)
+ /* No peer listening, tear down connection */
+ l2tp_disconnect(conn);
return 0;
+ }
if (!pack)
continue;