diff --git a/slirp/if.c b/slirp/if.c index 14fdef1e57e337e76b90d9a067d2567c1557d5ec..f7aebe95572f5ec14b87750ee8de78e02b47f533 100644 --- a/slirp/if.c +++ b/slirp/if.c @@ -163,10 +163,17 @@ void if_start(Slirp *slirp) DEBUG_CALL("if_start"); + if (slirp->if_start_busy) { + return; + } + slirp->if_start_busy = true; + while (slirp->if_queued) { /* check if we can really output */ - if (!slirp_can_output(slirp->opaque)) + if (!slirp_can_output(slirp->opaque)) { + slirp->if_start_busy = false; return; + } /* * See which queue to get next packet from @@ -221,4 +228,6 @@ void if_start(Slirp *slirp) } slirp->if_queued = requeued; + + slirp->if_start_busy = false; } diff --git a/slirp/slirp.h b/slirp/slirp.h index 28a5c037e6aa4f25f628e63ea0636ab5bd0eb8f4..416d44a996a066c9c032bf456e6d801c7edd5c99 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -239,6 +239,7 @@ struct Slirp { struct mbuf if_fastq; /* fast queue (for interactive data) */ struct mbuf if_batchq; /* queue for non-interactive data */ struct mbuf *next_m; /* pointer to next mbuf to output */ + bool if_start_busy; /* avoid if_start recursion */ /* ip states */ struct ipq ipq; /* ip reass. queue */