]>
git.proxmox.com Git - mirror_frr.git/blob - ldpd/keepalive.c
1 // SPDX-License-Identifier: ISC
5 * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
13 #include "ldp_debug.h"
16 send_keepalive(struct nbr
*nbr
)
21 size
= LDP_HDR_SIZE
+ LDP_MSG_SIZE
;
22 if ((buf
= ibuf_open(size
)) == NULL
)
25 gen_ldp_hdr(buf
, size
);
27 gen_msg_hdr(buf
, MSG_TYPE_KEEPALIVE
, size
);
29 debug_kalive_send("keepalive: lsr-id %pI4", &nbr
->id
);
31 evbuf_enqueue(&nbr
->tcp
->wbuf
, buf
);
32 nbr
->stats
.kalive_sent
++;
36 recv_keepalive(struct nbr
*nbr
, char *buf
, uint16_t len
)
40 memcpy(&msg
, buf
, sizeof(msg
));
41 if (len
!= LDP_MSG_SIZE
) {
42 session_shutdown(nbr
, S_BAD_MSG_LEN
, msg
.id
, msg
.type
);
46 debug_kalive_recv("keepalive: lsr-id %pI4", &nbr
->id
);
48 if (nbr
->state
!= NBR_STA_OPER
)
49 nbr_fsm(nbr
, NBR_EVT_KEEPALIVE_RCVD
);