aboutsummaryrefslogtreecommitdiff
path: root/slirp
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2018-11-22 02:06:27 +0400
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-01-14 00:44:29 +0100
commit6c2d0980e20d0289fa058f29afe89840f4b7b465 (patch)
tree8b4301cc36220e0af606011493a0398845dc0eb1 /slirp
parent5d300fc9222aa700b4449d73f26bf7cf0e5b9ec4 (diff)
slirp: use virtual time for packet expiration
Make all packets expiration time based on virtual clock. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'slirp')
-rw-r--r--slirp/if.c2
-rw-r--r--slirp/slirp.c7
2 files changed, 5 insertions, 4 deletions
diff --git a/slirp/if.c b/slirp/if.c
index aa88cc4e76..ce4f5fac53 100644
--- a/slirp/if.c
+++ b/slirp/if.c
@@ -148,7 +148,7 @@ diddit:
*/
void if_start(Slirp *slirp)
{
- uint64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
+ uint64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
bool from_batchq = false;
struct mbuf *ifm, *ifm_next, *ifqt;
diff --git a/slirp/slirp.c b/slirp/slirp.c
index e860750f72..7091c3998a 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -582,7 +582,7 @@ void slirp_pollfds_poll(GArray *pollfds, int select_error)
return;
}
- curtime = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
+ curtime = qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL);
QTAILQ_FOREACH(slirp, &slirp_instances, entry) {
/*
@@ -909,7 +909,8 @@ static int if_encap4(Slirp *slirp, struct mbuf *ifm, struct ethhdr *eh,
ifm->resolution_requested = true;
/* Expire request and drop outgoing packet after 1 second */
- ifm->expiration_date = qemu_clock_get_ns(QEMU_CLOCK_REALTIME) + 1000000000ULL;
+ ifm->expiration_date =
+ qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 1000000000ULL;
}
return 0;
} else {
@@ -936,7 +937,7 @@ static int if_encap6(Slirp *slirp, struct mbuf *ifm, struct ethhdr *eh,
ndp_send_ns(slirp, ip6h->ip_dst);
ifm->resolution_requested = true;
ifm->expiration_date =
- qemu_clock_get_ns(QEMU_CLOCK_REALTIME) + 1000000000ULL;
+ qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 1000000000ULL;
}
return 0;
} else {