]> git.proxmox.com Git - mirror_frr.git/blobdiff - ldpd/notification.c
Merge pull request #2932 from donaldsharp/ferr_fix
[mirror_frr.git] / ldpd / notification.c
index 393994ed5f72686990055cd99c131b46384693e5..4a5f3c8fa4bbc9ad2081c184b6c42d413d6837ef 100644 (file)
@@ -66,6 +66,7 @@ send_notification_full(struct tcp_conn *tcp, struct notify_msg *nm)
        if (tcp->nbr) {
                log_msg_notification(1, tcp->nbr, nm);
                nbr_fsm(tcp->nbr, NBR_EVT_PDU_SENT);
+               tcp->nbr->stats.notif_sent++;
        }
 
        evbuf_enqueue(&tcp->wbuf, buf);
@@ -236,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);
        }