lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #53103] MQTT corrupted mesages


From: Roger Sala
Subject: [lwip-devel] [bug #53103] MQTT corrupted mesages
Date: Fri, 18 Aug 2023 12:49:48 -0400 (EDT)

Follow-up Comment #6, bug #53103 (project lwip):

... so I turned on the MQTT_DEBUG_TRACE and was able to establish that my
problem was occurring when the ring buffer rolled over and a mqtt publish
became fragmented which caused the TLS layer on the broker machine to issue a
"bad record MAC" alert and then the mosquitto broker to subsequently close the
connection.

Not sure if this is a LwIP problem or an MbedTLS problem. I'm integrating
MbedTLS 2.16.2 with LwIp through the altcp_tls interface.

Right now I've implemented the following grotesque hack as a workaround, but
it would be great to know what the correct fix is. I'm sure other developers
must be running into this same problem?

static void
mqtt_ringbuf_advance_get_idx(struct mqtt_ringbuf_t *rb, u16_t len)
{
  LWIP_ASSERT("mqtt_ringbuf_advance_get_idx: len < MQTT_OUTPUT_RINGBUF_SIZE",
len < MQTT_OUTPUT_RINGBUF_SIZE);

  rb->get += len;
  if(rb->get > (MQTT_OUTPUT_RINGBUF_SIZE-8192))
  {
          rb->get = rb->put = 0;
  }
  /*RCSTODO rb->get += len;
  if (rb->get >= MQTT_OUTPUT_RINGBUF_SIZE) {
    rb->get = rb->get - MQTT_OUTPUT_RINGBUF_SIZE;
  }*/
}


    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?53103>

_______________________________________________
Message sent via Savannah
https://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]