slirp: Fix intermittent send queue hangs on a socket
commite2aad34d73a9bd2b95275598daf05f190a02b899
authorKevin Cernekee <cernekee@chromium.org>
Wed, 20 Sep 2017 20:42:04 +0000 (20 13:42 -0700)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 24 Sep 2017 18:04:09 +0000 (24 20:04 +0200)
treef911799e05a3e706203052c469bae73117916bf5
parent0e7e4fb0a6b8f1043182dcccc91a7b984587d1ae
slirp: Fix intermittent send queue hangs on a socket

if_output() originally sent one mbuf per call and used the slirp->next_m
variable to keep track of where it left off.  But nowadays it tries to
send all of the mbufs from the fastq, and one mbuf from each session on
the batchq.  The next_m variable is both redundant and harmful: there is
a case[0] involving delayed packets in which next_m ends up pointing
to &slirp->if_batchq when an active session still exists, and this
blocks all traffic for that session until qemu is restarted.

The test case was created to reproduce a problem that was seen on
long-running Chromium OS VM tests[1] which rapidly create and
destroy ssh connections through hostfwd.

[0] https://pastebin.com/NNy6LreF
[1] https://bugs.chromium.org/p/chromium/issues/detail?id=766323

Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
slirp/if.c
slirp/slirp.h