You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2021/10/25 15:02:25 UTC

[mynewt-core] branch master updated: net/oic: Minor modification to prevent transmission no data

This is an automated email from the ASF dual-hosted git repository.

wes3 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new cec16e1  net/oic: Minor modification to prevent transmission no data
cec16e1 is described below

commit cec16e18a892025fd7681442651966a398ada2ff
Author: Will San Filippo <wi...@juul.com>
AuthorDate: Fri Oct 15 10:00:59 2021 -0700

    net/oic: Minor modification to prevent transmission no data
    
    This is a minor change to the code which should prevent the code
    from sending a fragment with no data in it. In the case where
    the packet length is greater than the mtu but is an integer
    multiple of the mtu (pktlength % mtu equals 0) the code would
    allocate a packet header mbuf with no data in it and send it.
    This change should prevent that from occurring.
---
 net/oic/src/port/mynewt/ble_adaptor.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/oic/src/port/mynewt/ble_adaptor.c b/net/oic/src/port/mynewt/ble_adaptor.c
index e3f06e2..b9b9940 100644
--- a/net/oic/src/port/mynewt/ble_adaptor.c
+++ b/net/oic/src/port/mynewt/ble_adaptor.c
@@ -482,6 +482,9 @@ oc_ble_frag(struct os_mbuf *m, uint16_t mtu)
     }
 
     off = pkt->omp_len - (pkt->omp_len % mtu);
+    if (off == pkt->omp_len) {
+        off -= mtu;
+    }
     while (off >= mtu) {
         n = os_msys_get_pkthdr(mtu, 0);
         if (!n) {