diff mbox series

[2/2] slirp: Add a special case for the NULL socket

Message ID 20170920204205.40191-2-cernekee@chromium.org
State New
Headers show
Series [1/2] slirp: Fix intermittent send queue hangs on a socket | expand

Commit Message

Kevin Cernekee Sept. 20, 2017, 8:42 p.m. UTC
NULL sockets are used for NDP, BOOTP, and other critical operations.
If the topmost mbuf in a NULL session is blocked pending resolution,
it may cause problems if it blocks other packets with a NULL socket.
So do not add mbufs with a NULL socket field to the same session.

Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
---
 slirp/if.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

Comments

Samuel Thibault Sept. 24, 2017, 5:54 p.m. UTC | #1
Kevin Cernekee, on mer. 20 sept. 2017 13:42:05 -0700, wrote:
> NULL sockets are used for NDP, BOOTP, and other critical operations.
> If the topmost mbuf in a NULL session is blocked pending resolution,
> it may cause problems if it blocks other packets with a NULL socket.
> So do not add mbufs with a NULL socket field to the same session.

That makes a lot of sense indeed, applied to my tree.

Thanks!
Samuel
diff mbox series

Patch

diff --git a/slirp/if.c b/slirp/if.c
index 6262d7749563..590753c6582f 100644
--- a/slirp/if.c
+++ b/slirp/if.c
@@ -73,14 +73,16 @@  if_output(struct socket *so, struct mbuf *ifm)
 	 * We mustn't put this packet back on the fastq (or we'll send it out of order)
 	 * XXX add cache here?
 	 */
-	for (ifq = (struct mbuf *) slirp->if_batchq.qh_rlink;
-	     (struct quehead *) ifq != &slirp->if_batchq;
-	     ifq = ifq->ifq_prev) {
-		if (so == ifq->ifq_so) {
-			/* A match! */
-			ifm->ifq_so = so;
-			ifs_insque(ifm, ifq->ifs_prev);
-			goto diddit;
+	if (so) {
+		for (ifq = (struct mbuf *) slirp->if_batchq.qh_rlink;
+		     (struct quehead *) ifq != &slirp->if_batchq;
+		     ifq = ifq->ifq_prev) {
+			if (so == ifq->ifq_so) {
+				/* A match! */
+				ifm->ifq_so = so;
+				ifs_insque(ifm, ifq->ifs_prev);
+				goto diddit;
+			}
 		}
 	}