Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/ldpd obey RFC3036 3.5.2 regarding holdtimes



details:   https://anonhg.NetBSD.org/src/rev/3cc80af1329f
branches:  trunk
changeset: 766130:3cc80af1329f
user:      kefren <kefren%NetBSD.org@localhost>
date:      Thu Jun 16 14:48:30 2011 +0000

description:
obey RFC3036 3.5.2 regarding holdtimes
wire SIGINT

diffstat:

 usr.sbin/ldpd/fsm.c       |  10 ++++++++--
 usr.sbin/ldpd/ldp.h       |   3 ++-
 usr.sbin/ldpd/socketops.c |   6 ++++--
 3 files changed, 14 insertions(+), 5 deletions(-)

diffs (69 lines):

diff -r d8f1788e8d7f -r 3cc80af1329f usr.sbin/ldpd/fsm.c
--- a/usr.sbin/ldpd/fsm.c       Thu Jun 16 13:44:56 2011 +0000
+++ b/usr.sbin/ldpd/fsm.c       Thu Jun 16 14:48:30 2011 +0000
@@ -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,
diff -r d8f1788e8d7f -r 3cc80af1329f usr.sbin/ldpd/ldp.h
--- a/usr.sbin/ldpd/ldp.h       Thu Jun 16 13:44:56 2011 +0000
+++ b/usr.sbin/ldpd/ldp.h       Thu Jun 16 14:48:30 2011 +0000
@@ -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
 
diff -r d8f1788e8d7f -r 3cc80af1329f usr.sbin/ldpd/socketops.c
--- a/usr.sbin/ldpd/socketops.c Thu Jun 16 13:44:56 2011 +0000
+++ b/usr.sbin/ldpd/socketops.c Thu Jun 16 14:48:30 2011 +0000
@@ -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);
 



Home | Main Index | Thread Index | Old Index