diff --git a/net/net_close.c b/net/net_close.c index fdb60c69479..33c13f495bb 100644 --- a/net/net_close.c +++ b/net/net_close.c @@ -433,6 +433,32 @@ int psock_close(FAR struct socket *psock) switch (psock->s_type) { +#ifdef CONFIG_NET_PKT + case SOCK_RAW: + { + struct uip_pkt_conn *conn = psock->s_conn; + + /* Is this the last reference to the connection structure (there + * could be more if the socket was dup'ed). + */ + + if (conn->crefs <= 1) + { + /* Yes... free the connection structure */ + + conn->crefs = 0; /* No more references on the connection */ + uip_pktfree(psock->s_conn); /* Free uIP resources */ + } + else + { + /* No.. Just decrement the reference count */ + + conn->crefs--; + } + } + break; +#endif + #ifdef CONFIG_NET_TCP case SOCK_STREAM: { diff --git a/net/net_send_unbuffered.c b/net/net_send_unbuffered.c index b5e2de18db2..10c623ddbfe 100644 --- a/net/net_send_unbuffered.c +++ b/net/net_send_unbuffered.c @@ -195,6 +195,10 @@ static uint16_t pktsend_interrupt(FAR struct uip_driver_s *dev, if (pstate->snd_buflen > 0 && pstate->snd_buflen < CONFIG_NET_BUFSIZE) { memcpy(dev->d_buf, pstate->snd_buffer, pstate->snd_buflen); + + /* Set the number of bytes to send */ + + dev->d_len = pstate->snd_buflen; dev->d_sndlen = pstate->snd_buflen; }