X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/1b6a7a95e600f89a70e59ca31e971c119b20cb6b..57a847d9a36386aefb1d61bdb40399d9e8f5b463:/l2tpns.c diff --git a/l2tpns.c b/l2tpns.c index 598e3ab..b4828c3 100644 --- a/l2tpns.c +++ b/l2tpns.c @@ -4,7 +4,7 @@ // Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced // vim: sw=8 ts=8 -char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.160 2006-04-13 11:14:35 bodea Exp $"; +char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.162 2006-04-23 23:18:31 bodea Exp $"; #include #include @@ -2381,12 +2381,12 @@ void processudp(uint8_t *buf, int len, struct sockaddr_in *addr) disc_reason = "Administrative disconnect"; break; case 3: // lcp terminate - if (dir != 1) break; // 1=peer, 2=local + if (dir != 2) break; // 1=peer (LNS), 2=local (LAC) disc_cause = TERM_USER_REQUEST; disc_reason = "Normal disconnection"; break; case 4: // compulsory encryption unavailable - if (dir != 2) break; // 1=refused by peer, 2=local + if (dir != 1) break; // 1=refused by peer, 2=local disc_cause = TERM_USER_ERROR; disc_reason = "Compulsory encryption refused"; break; @@ -3255,9 +3255,12 @@ static void mainloop(void) e.events = EPOLLIN; i = 0; - d[i].type = FD_TYPE_CLI; - e.data.ptr = &d[i++]; - epoll_ctl(epollfd, EPOLL_CTL_ADD, clifd, &e); + if (clifd >= 0) + { + d[i].type = FD_TYPE_CLI; + e.data.ptr = &d[i++]; + epoll_ctl(epollfd, EPOLL_CTL_ADD, clifd, &e); + } d[i].type = FD_TYPE_CLUSTER; e.data.ptr = &d[i++];