diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2019-01-17 15:43:58 +0400 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-02-07 15:49:08 +0200 |
commit | 3e0fad3aa5f9f36566ac2815a54288d214e58689 (patch) | |
tree | f2714d8506fe29bcaaaa4edabe341ee8befddc34 /slirp/ip6_icmp.c | |
parent | deaeb3f71d1fdf199d5b949e8575303486e3dec8 (diff) |
slirp: pass opaque to all callbacks
This is friendlier for FFI bindings.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'slirp/ip6_icmp.c')
-rw-r--r-- | slirp/ip6_icmp.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/slirp/ip6_icmp.c b/slirp/ip6_icmp.c index 2a432ebbd4..c1e3d30470 100644 --- a/slirp/ip6_icmp.c +++ b/slirp/ip6_icmp.c @@ -14,7 +14,8 @@ static void ra_timer_handler(void *opaque) Slirp *slirp = opaque; slirp->cb->timer_mod(slirp->ra_timer, - slirp->cb->clock_get_ns() / SCALE_MS + NDP_Interval); + slirp->cb->clock_get_ns(slirp->opaque) / SCALE_MS + NDP_Interval, + slirp->opaque); ndp_send_ra(slirp); } @@ -24,9 +25,10 @@ void icmp6_init(Slirp *slirp) return; } - slirp->ra_timer = slirp->cb->timer_new(ra_timer_handler, slirp); + slirp->ra_timer = slirp->cb->timer_new(ra_timer_handler, slirp, slirp->opaque); slirp->cb->timer_mod(slirp->ra_timer, - slirp->cb->clock_get_ns() / SCALE_MS + NDP_Interval); + slirp->cb->clock_get_ns(slirp->opaque) / SCALE_MS + NDP_Interval, + slirp->opaque); } void icmp6_cleanup(Slirp *slirp) @@ -35,7 +37,7 @@ void icmp6_cleanup(Slirp *slirp) return; } - slirp->cb->timer_free(slirp->ra_timer); + slirp->cb->timer_free(slirp->ra_timer, slirp->opaque); } static void icmp6_send_echoreply(struct mbuf *m, Slirp *slirp, struct ip6 *ip, @@ -334,7 +336,8 @@ static void ndp_input(struct mbuf *m, Slirp *slirp, struct ip6 *ip, case ICMP6_NDP_RA: DEBUG_CALL(" type = Router Advertisement"); - slirp->cb->guest_error("Warning: guest sent NDP RA, but shouldn't"); + slirp->cb->guest_error("Warning: guest sent NDP RA, but shouldn't", + slirp->opaque); break; case ICMP6_NDP_NS: @@ -368,7 +371,7 @@ static void ndp_input(struct mbuf *m, Slirp *slirp, struct ip6 *ip, case ICMP6_NDP_REDIRECT: DEBUG_CALL(" type = Redirect"); slirp->cb->guest_error( - "Warning: guest sent NDP REDIRECT, but shouldn't"); + "Warning: guest sent NDP REDIRECT, but shouldn't", slirp->opaque); break; } } |