OSDN Git Service

slirp: Add a special case for the NULL socket
authorKevin Cernekee <cernekee@chromium.org>
Wed, 20 Sep 2017 20:42:05 +0000 (13:42 -0700)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 24 Sep 2017 18:04:09 +0000 (20:04 +0200)
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>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
slirp/if.c

index 6262d77..590753c 100644 (file)
@@ -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;
+                       }
                }
        }