[PATCH 7/9] libnetworking: Disconnect after mbuf shortage

Gedare Bloom gedare at rtems.org
Thu Jan 11 18:13:09 UTC 2018


From: Sebastian Huber <sebastian.huber at embedded-brains.de>

The missing disconnect left the socket in an unusable state.  Each send
request resulted in an EISCONN error.
---
 cpukit/libnetworking/netinet/udp_usrreq.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/cpukit/libnetworking/netinet/udp_usrreq.c b/cpukit/libnetworking/netinet/udp_usrreq.c
index f09531d..ddd3f3c 100644
--- a/cpukit/libnetworking/netinet/udp_usrreq.c
+++ b/cpukit/libnetworking/netinet/udp_usrreq.c
@@ -399,8 +399,11 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct mbuf *addr,
 	M_PREPEND(m, sizeof(struct udpiphdr), M_DONTWAIT);
 	if (m == 0) {
 		error = ENOBUFS;
-		if (addr)
+		if (addr) {
+			in_pcbdisconnect(inp);
+			inp->inp_laddr = laddr;
 			splx(s);
+		}
 		goto release;
 	}
 
-- 
2.7.4




More information about the devel mailing list