]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ldpd: accept notifications during the session establishment process
authorRenato Westphal <renato@opensourcerouting.org>
Wed, 19 Apr 2017 22:31:19 +0000 (19:31 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Wed, 26 Apr 2017 13:36:33 +0000 (10:36 -0300)
If we don't do this, we'll never trigger the backoff exponential timer
since it's impossible to distinguish between Initialization NAK's and
general errors.

Also:
* Implement some missing bits from RFC 5036;
* remove superfluous log message in session_shutdown()
  (send_notification() logs that we're sending a fatal notification).

Regression introduced by commit 8819fc3.

Fixes the following ANVL LDP regressions: 6.19 and 6.21.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
ldpd/notification.c
ldpd/packet.c

index f10faa4a54b3bcf06b602388a86cabed616f09b5..4a5f3c8fa4bbc9ad2081c184b6c42d413d6837ef 100644 (file)
@@ -237,6 +237,16 @@ recv_notification(struct nbr *nbr, char *buf, uint16_t len)
                if (nbr->state == NBR_STA_OPENSENT)
                        nbr_start_idtimer(nbr);
 
+               /*
+                * RFC 5036 - Section 3.5.1.1:
+                * "When an LSR receives a Shutdown message during session
+                * initialization, it SHOULD transmit a Shutdown message and
+                * then close the transport connection".
+                */
+               if (nbr->state != NBR_STA_OPER && nm.status_code == S_SHUTDOWN)
+                       send_notification(nbr->tcp, S_SHUTDOWN,
+                           msg.id, msg.type);
+
                nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION);
                return (-1);
        }
index 46893b992bd5b2e2d0f193e47dc4c1613c4541f8..75e1a9a027aaf5a754c39e5d17e6f7ea646b22e3 100644 (file)
@@ -519,6 +519,8 @@ session_read(struct thread *thread)
                                        return (0);
                                }
                                break;
+                       case MSG_TYPE_NOTIFICATION:
+                               break;
                        default:
                                if (nbr->state != NBR_STA_OPER) {
                                        session_shutdown(nbr, S_SHUTDOWN,
@@ -661,8 +663,6 @@ session_shutdown(struct nbr *nbr, uint32_t status, uint32_t msg_id,
        case NBR_STA_OPENREC:
        case NBR_STA_OPENSENT:
        case NBR_STA_OPER:
-               log_debug("%s: lsr-id %s", __func__, inet_ntoa(nbr->id));
-
                send_notification(nbr->tcp, status, msg_id, msg_type);
 
                nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION);