diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2012-08-29 12:06:37 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2012-08-29 12:06:37 +0400 |
commit | fd379e46a8e41a1a41836922a376e462bb676b0f (patch) | |
tree | 458f1d3083e5769c548711a23f3f57f40119775c | |
parent | 28df233a46f2d136e8169d86ee62861a7c024eff (diff) | |
parent | fa66284f4bddf7686d2d5cfe40b387e0bbbba71a (diff) | |
download | accel-ppp-fd379e46a8e41a1a41836922a376e462bb676b0f.tar.gz accel-ppp-fd379e46a8e41a1a41836922a376e462bb676b0f.zip |
Merge branch 'master' of ssh://accel-ppp.git.sourceforge.net/gitroot/accel-ppp/accel-ppp
-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; } |