summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2019-01-22 17:50:33 -0200
committerRenato Westphal <renato@opensourcerouting.org>2019-01-22 18:17:44 -0200
commit7ced70a6e566eda5f4fea7ae45faec9ca91c18f3 (patch)
tree6094960542e09b81e4f86fb6a6a5a720f4df2801
parentf10780c9c39ede4ca27a48e5372204409a5f41ba (diff)
ldpd: fix corner case in which we wouldn't respect the max pdu length
The calculation to know when an LDP PDU went past the maximum negotiated PDU length was wrong because it wasn't taking the "Version" and "PDU Length" fields into account (total of four bytes). Fix this. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
-rw-r--r--ldpd/labelmapping.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ldpd/labelmapping.c b/ldpd/labelmapping.c
index 944f93331f..5e1b422a41 100644
--- a/ldpd/labelmapping.c
+++ b/ldpd/labelmapping.c
@@ -37,7 +37,7 @@ enqueue_pdu(struct nbr *nbr, uint16_t type, struct ibuf *buf, uint16_t size)
struct ldp_hdr *ldp_hdr;
ldp_hdr = ibuf_seek(buf, 0, sizeof(struct ldp_hdr));
- ldp_hdr->length = htons(size);
+ ldp_hdr->length = htons(size - LDP_HDR_DEAD_LEN);
evbuf_enqueue(&nbr->tcp->wbuf, buf);
}
@@ -65,7 +65,7 @@ send_labelmessage(struct nbr *nbr, uint16_t type, struct mapping_head *mh)
/* real size will be set up later */
err |= gen_ldp_hdr(buf, 0);
- size = LDP_HDR_PDU_LEN;
+ size = LDP_HDR_SIZE;
first = 0;
}