xl2tpd-exit-on-close.patch (1503B)
1 diff --git a/xl2tpd.c b/xl2tpd.c 2 index 791d5a4..1382b68 100644 3 --- a/xl2tpd.c 4 +++ b/xl2tpd.c 5 @@ -814,6 +814,33 @@ static struct call *lac_call (int tid, struct lac *lac, struct lns *lns) 6 return NULL; 7 } 8 9 +void terminate_if_no_active(void * _unused) 10 +{ 11 + l2tp_log (LOG_WARNING, "%s : is anything still happening?\n", __FUNCTION__); 12 + 13 + struct lac *lac = (struct lac *) laclist; 14 + while(lac) { 15 + l2tp_log (LOG_INFO, "%s : lac %s active %s\n", __FUNCTION__, 16 + lac->entname, (lac->active ? "yes" : "no")); 17 + if(lac->active) 18 + return; 19 + lac = lac->next; 20 + } 21 + 22 + struct lns *lns = (struct lns *) lnslist; 23 + while(lns) { 24 + l2tp_log (LOG_INFO, "%s : lns %s active %s\n", __FUNCTION__, 25 + lns->entname, (lns->active ? "yes" : "no")); 26 + if(lns->active) 27 + return; 28 + lns = lns->next; 29 + } 30 + 31 + l2tp_log (LOG_WARNING, "%s : apparently nothing\n", __FUNCTION__); 32 + 33 + death_handler(SIGTERM); 34 +} 35 + 36 void magic_lac_dial (void *data) 37 { 38 struct lac *lac; 39 @@ -832,7 +859,15 @@ void magic_lac_dial (void *data) 40 lac->rtries++; 41 if (lac->rmax && (lac->rtries > lac->rmax)) 42 { 43 - l2tp_log (LOG_INFO, "%s: maximum retries exceeded.\n", __FUNCTION__); 44 + struct timeval tv; 45 + 46 + l2tp_log (LOG_INFO, "%s: maximum retries exceeded %d/%d.\n", 47 + __FUNCTION__, lac->rtries , lac->rmax); 48 + lac->active = 0; 49 + tv.tv_sec = 0; 50 + tv.tv_usec = 100; 51 + schedule (tv, &terminate_if_no_active, NULL); 52 + 53 return; 54 } 55 if (!lac->t)