]> git.proxmox.com Git - mirror_frr.git/commitdiff
ldpd: fix corner case in which we wouldn't respect the max pdu length
authorRenato Westphal <renato@opensourcerouting.org>
Tue, 22 Jan 2019 19:50:33 +0000 (17:50 -0200)
committerRenato Westphal <renato@opensourcerouting.org>
Tue, 22 Jan 2019 23:24:06 +0000 (21:24 -0200)
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>
ldpd/labelmapping.c

index 944f93331f002a3fb1ef6c6ae3cfaa4a6b27171f..5e1b422a41638f20612b3aa65fc4f6368a39e8da 100644 (file)
@@ -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;
                }