]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_rtp_asterisk: Always return provided DTLS packet length.
authorJoshua Colp <jcolp@digium.com>
Thu, 14 Nov 2019 10:19:04 +0000 (06:19 -0400)
committerJoshua Colp <jcolp@digium.com>
Thu, 14 Nov 2019 10:20:17 +0000 (06:20 -0400)
OpenSSL can not tolerate if the packet sent out does not
match the length that it provided to the sender. This change
lies and says that each time the full packet was sent. If
a problem does occur then a retransmission will occur as
appropriate.

ASTERISK-28576

Change-Id: Id42455b15c9dc4eb987c8c023ece6fbf3c22a449

res/res_rtp_asterisk.c

index cb68abeac9c73022112cf1bd9e840305333a93e6..f2601ed967fb441c74457afbc23e604e643f1a14 100644 (file)
@@ -589,6 +589,10 @@ static int dtls_bio_write(BIO *bio, const char *buf, int len)
        struct ast_sockaddr remote_address = { {0, } };
        int ice;
 
+       /* OpenSSL can't tolerate a packet not being sent, so we always state that
+        * we sent the packet. If it isn't then retransmission will occur.
+        */
+
        if (rtp->rtcp && rtp->rtcp->dtls.write_bio == bio) {
                rtcp = 1;
                ast_sockaddr_copy(&remote_address, &rtp->rtcp->them);
@@ -597,10 +601,12 @@ static int dtls_bio_write(BIO *bio, const char *buf, int len)
        }
 
        if (ast_sockaddr_isnull(&remote_address)) {
-               return 0;
+               return len;
        }
 
-       return __rtp_sendto(instance, (char *)buf, len, 0, &remote_address, rtcp, &ice, 0);
+       __rtp_sendto(instance, (char *)buf, len, 0, &remote_address, rtcp, &ice, 0);
+
+       return len;
 }
 
 static long dtls_bio_ctrl(BIO *bio, int cmd, long arg1, void *arg2)