diff options
-rw-r--r-- | accel-pppd/ctrl/l2tp/l2tp.c | 8 | ||||
-rw-r--r-- | accel-pppd/ctrl/l2tp/packet.c | 5 |
2 files changed, 11 insertions, 2 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; diff --git a/accel-pppd/ctrl/l2tp/packet.c b/accel-pppd/ctrl/l2tp/packet.c index f8a46e7f..60b9d36c 100644 --- a/accel-pppd/ctrl/l2tp/packet.c +++ b/accel-pppd/ctrl/l2tp/packet.c @@ -147,8 +147,11 @@ int l2tp_recv(int fd, struct l2tp_packet_t **p, struct in_pktinfo *pkt_info) if (n < 0) { mempool_free(buf); - if (errno == EAGAIN) + if (errno == EAGAIN) { return -1; + } else if (errno == ECONNREFUSED) { + return -2; + } log_error("l2tp: recv: %s\n", strerror(errno)); return 0; } |