Module Name: src
Committed By: kefren
Date: Thu Jun 16 14:48:30 UTC 2011
Modified Files:
src/usr.sbin/ldpd: fsm.c ldp.h socketops.c
Log Message:
obey RFC3036 3.5.2 regarding holdtimes
wire SIGINT
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/ldpd/fsm.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/ldpd/ldp.h
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/ldpd/socketops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/ldpd/fsm.c
diff -u src/usr.sbin/ldpd/fsm.c:1.4 src/usr.sbin/ldpd/fsm.c:1.5
--- src/usr.sbin/ldpd/fsm.c:1.4 Tue Jun 14 11:23:02 2011
+++ src/usr.sbin/ldpd/fsm.c Thu Jun 16 14:48:30 2011
@@ -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 @@
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,
Index: src/usr.sbin/ldpd/ldp.h
diff -u src/usr.sbin/ldpd/ldp.h:1.2 src/usr.sbin/ldpd/ldp.h:1.3
--- src/usr.sbin/ldpd/ldp.h:1.2 Thu Dec 30 11:29:21 2010
+++ src/usr.sbin/ldpd/ldp.h Thu Jun 16 14:48:30 2011
@@ -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 @@
/* 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
Index: src/usr.sbin/ldpd/socketops.c
diff -u src/usr.sbin/ldpd/socketops.c:1.9 src/usr.sbin/ldpd/socketops.c:1.10
--- src/usr.sbin/ldpd/socketops.c:1.9 Thu Jun 16 06:05:47 2011
+++ src/usr.sbin/ldpd/socketops.c Thu Jun 16 14:48:30 2011
@@ -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 @@
/* 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 @@
signal(SIGALRM, send_hello_alarm);
signal(SIGPIPE, SIG_IGN);
+ signal(SIGINT, bail_out);
signal(SIGTERM, bail_out);
send_hello_alarm(1);