]> git.puffer.fish Git - mirror/frr.git/commitdiff
Correct build TLV functions 839/head
authorOlivier Dugeon <olivier.dugeon@orange.com>
Mon, 31 Jul 2017 16:03:00 +0000 (18:03 +0200)
committerOlivier Dugeon <olivier.dugeon@orange.com>
Mon, 31 Jul 2017 16:03:00 +0000 (18:03 +0200)
 * Functions that build TLVs in ospf_te.c and ospf_te.c use 'tlvh + 1'
to move the pointer to the TLV payload ifor strem_put().
 * Correct this by using TLV_DATA() macro which is saffer.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
ospfd/ospf_ri.c
ospfd/ospf_te.c

index e41b9c15245e995d99e192566c6c5895f8a7a0b3..13013bf8cac055187f6ec238e717bf303c3d3e44 100644 (file)
@@ -506,7 +506,7 @@ static void build_tlv(struct stream *s, struct tlv_header *tlvh)
 
        if (ntohs(tlvh->type) != 0) {
                build_tlv_header(s, tlvh);
-               stream_put(s, tlvh + 1, TLV_BODY_SIZE(tlvh));
+               stream_put(s, TLV_DATA(tlvh), TLV_BODY_SIZE(tlvh));
        }
        return;
 }
index 521844b9eab6211dd9b6ceae02c25988193e1807..482d9d48c575c0982020a3a00a2087c18dc3ce62 100644 (file)
@@ -1065,7 +1065,7 @@ static void build_router_tlv(struct stream *s)
        struct tlv_header *tlvh = &OspfMplsTE.router_addr.header;
        if (ntohs(tlvh->type) != 0) {
                build_tlv_header(s, tlvh);
-               stream_put(s, tlvh + 1, TLV_BODY_SIZE(tlvh));
+               stream_put(s, TLV_DATA(tlvh), TLV_BODY_SIZE(tlvh));
        }
        return;
 }
@@ -1075,7 +1075,7 @@ static void build_link_subtlv(struct stream *s, struct tlv_header *tlvh)
 
        if ((tlvh != NULL) && (ntohs(tlvh->type) != 0)) {
                build_tlv_header(s, tlvh);
-               stream_put(s, tlvh + 1, TLV_BODY_SIZE(tlvh));
+               stream_put(s, TLV_DATA(tlvh), TLV_BODY_SIZE(tlvh));
        }
        return;
 }
@@ -2141,7 +2141,7 @@ static void ospf_mpls_te_show_info(struct vty *vty, struct ospf_lsa *lsa)
                case TE_TLV_LINK:
                        sum += show_vty_link_header(vty, tlvh);
                        subfunc = ospf_mpls_te_show_link_subtlv;
-                       next = tlvh + 1;
+                       next = TLV_DATA(tlvh);
                        break;
                default:
                        sum += show_vty_unknown_tlv(vty, tlvh);