[RFC 9/9] * Ensure udp stats counter correct when dropped packets

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[RFC 9/9] * Ensure udp stats counter correct when dropped packets

Will Wagner
There is a code path when udp packets are dropped due to lack
of buffers where the stats object is not correctly updated.

Signed-off-by: Andrew Parlane <[hidden email]>
Signed-off-by: Will Wagner <[hidden email]>
---
  packages/net/lwip_tcpip/current/src/api/api_msg.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/packages/net/lwip_tcpip/current/src/api/api_msg.c
b/packages/net/lwip_tcpip/current/src/api/api_msg.c
index d4e44b9..25fa01b 100644
--- a/packages/net/lwip_tcpip/current/src/api/api_msg.c
+++ b/packages/net/lwip_tcpip/current/src/api/api_msg.c
@@ -51,6 +51,7 @@
  #include "lwip/tcpip.h"
  #include "lwip/igmp.h"
  #include "lwip/dns.h"
+#include "lwip/stats.h"

  #include <string.h>

@@ -193,6 +194,7 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,

    len = p->tot_len;
    if (sys_mbox_trypost(&conn->recvmbox, buf) != ERR_OK) {
+    UDP_STATS_INC(udp.drop);
      netbuf_delete(buf);
      return;
    } else {
--
1.8.1.msysgit.1