obey RFC3036 3.5.2 regarding holdtimes

wire SIGINT
This commit is contained in:
kefren 2011-06-16 14:48:30 +00:00
parent be964ea63f
commit c2db1af7a2
3 changed files with 14 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fsm.c,v 1.4 2011/06/14 11:23:02 kefren Exp $ */
/* $NetBSD: fsm.c,v 1.5 2011/06/16 14:48:30 kefren Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -91,8 +91,14 @@ run_ldp_hello(struct ldp_pdu * pduid, struct hello_tlv * ht,
debugp("Common hello Type: 0x%.4X Length: %.2d R:%d T:%d"
"Hold time: %d\n", ht->ch.type, ht->ch.length,
ht->ch.tr / 2, ht->ch.tr % 2, ht->ch.holdtime);
if (ht->ch.holdtime)
if (ht->ch.holdtime != 0)
hi->keepalive = ht->ch.holdtime;
else {
if (ht->ch.res >> 15 == 0)
hi->keepalive = LDP_HELLO_KEEP;
else
hi->keepalive = LDP_THELLO_KEEP;
}
if (!get_ldp_peer(&pduid->ldp_id)) {
/* First of all set peer_addr to announced LDP_ID */
memcpy(&peer_addr, &pduid->ldp_id,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ldp.h,v 1.2 2010/12/30 11:29:21 kefren Exp $ */
/* $NetBSD: ldp.h,v 1.3 2011/06/16 14:48:30 kefren Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -66,6 +66,7 @@ extern char my_ldp_id[20];
/* Various timers */
#define LDP_HELLO_TIME 5
#define LDP_HELLO_KEEP 15
#define LDP_THELLO_KEEP 45
#define LDP_KEEPALIVE_TIME 4
#define LDP_HOLDTIME 15

View File

@ -1,4 +1,4 @@
/* $NetBSD: socketops.c,v 1.9 2011/06/16 06:05:47 kefren Exp $ */
/* $NetBSD: socketops.c,v 1.10 2011/06/16 14:48:30 kefren Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -504,7 +504,8 @@ send_hello_alarm(int unused)
/* Decrement hello info keepalives */
SLIST_FOREACH(hi, &hello_info_head, infos)
hi->keepalive--;
if (hi->keepalive != 0xFFFF)
hi->keepalive--;
/* Check hello keepalives */
SLIST_FOREACH_SAFE(hi, &hello_info_head, infos, hinext)
@ -544,6 +545,7 @@ the_big_loop(void)
signal(SIGALRM, send_hello_alarm);
signal(SIGPIPE, SIG_IGN);
signal(SIGINT, bail_out);
signal(SIGTERM, bail_out);
send_hello_alarm(1);