From ec7c62a2715fef8d267a037166cd38d756e62188 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 11 Apr 2022 12:24:58 +0200 Subject: slirp: invoke client callback before creating timers The introduction of .timer_new_opaque adds an interesting conundrum. The Slirp* needs to be stored in .timer_new_opaque so that it can be passed back to slirp_handle_timer, but it is not returned by slirp_new and slirp_init until after the first call to .timer_new_opaque (which is in ip6_init). This is a problem for programs that, like QEMU, use more than one Slirp*. Fix them by passing the Slirp* to a callback before slirp_new returns, and initializing the timer afterwards. Signed-off-by: Paolo Bonzini --- src/ip6_icmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ip6_icmp.c') diff --git a/src/ip6_icmp.c b/src/ip6_icmp.c index 181989c..0d7ee69 100644 --- a/src/ip6_icmp.c +++ b/src/ip6_icmp.c @@ -10,7 +10,7 @@ #define NDP_Interval \ g_rand_int_range(slirp->grand, NDP_MinRtrAdvInterval, NDP_MaxRtrAdvInterval) -void icmp6_init(Slirp *slirp) +void icmp6_post_init(Slirp *slirp) { if (!slirp->in6_enabled) { return; -- cgit v1.1