[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 04/16] slirp: Adding IPv6, ICMPv6 Echo and NDP a
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 04/16] slirp: Adding IPv6, ICMPv6 Echo and NDP autoconfiguration |
Date: |
Wed, 23 Oct 2013 08:51:21 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9 |
Il 20/10/2013 15:56, Samuel Thibault ha scritto:
> +#define rand_a_b(a, b)\
> + (rand()%(int)(b-a)+a)
> +#define NDP_Interval rand_a_b(NDP_MinRtrAdvInterval, NDP_MaxRtrAdvInterval)
> +
> +static void ra_timer_handler(void *opaque)
> +{
> + timer_mod(ra_timer, qemu_clock_get_s(QEMU_CLOCK_VIRTUAL) + NDP_Interval);
> + ndp_send_ra((Slirp *)opaque);
> +}
> +
> +void icmp6_init(Slirp *slirp)
> +{
> + srand(time(NULL));
> + ra_timer = timer_new_s(QEMU_CLOCK_VIRTUAL, ra_timer_handler, slirp);
> + timer_mod(ra_timer, qemu_clock_get_s(QEMU_CLOCK_VIRTUAL) + NDP_Interval);
> +}
Should the granularity of the timer really be seconds? Or should you
use the existing milli/nanosecond interface and scale the interval, so
that you really get a uniformly distributed random value, even for very
small MaxRtrAdvInterval (e.g. for min=3, max=4 you won't get any other
value than 3 or 4, which is not really uniformly distributed).
Paolo
- Re: [Qemu-devel] [PATCH 16/16] qapi-schema, qemu-options & slirp: Adding Qemu options for IPv6 addresses, (continued)
- Re: [Qemu-devel] [PATCH 16/16] qapi-schema, qemu-options & slirp: Adding Qemu options for IPv6 addresses, Samuel Thibault, 2013/10/22
- Re: [Qemu-devel] [PATCH 16/16] qapi-schema, qemu-options & slirp: Adding Qemu options for IPv6 addresses, Eric Blake, 2013/10/22
- Re: [Qemu-devel] [PATCH 16/16] qapi-schema, qemu-options & slirp: Adding Qemu options for IPv6 addresses, Samuel Thibault, 2013/10/22
- Re: [Qemu-devel] [PATCH 16/16] qapi-schema, qemu-options & slirp: Adding Qemu options for IPv6 addresses, Eric Blake, 2013/10/22
- Re: [Qemu-devel] [PATCH 16/16] qapi-schema, qemu-options & slirp: Adding Qemu options for IPv6 addresses, Eric Blake, 2013/10/22
- Re: [Qemu-devel] [PATCH 16/16] qapi-schema, qemu-options & slirp: Adding Qemu options for IPv6 addresses, Samuel Thibault, 2013/10/22
- Re: [Qemu-devel] [PATCH 16/16] qapi-schema, qemu-options & slirp: Adding Qemu options for IPv6 addresses, Eric Blake, 2013/10/22
- Re: [Qemu-devel] [PATCH 16/16] qapi-schema, qemu-options & slirp: Adding Qemu options for IPv6 addresses, Samuel Thibault, 2013/10/22
- Re: [Qemu-devel] [PATCH 16/16] qapi-schema, qemu-options & slirp: Adding Qemu options for IPv6 addresses, Eric Blake, 2013/10/22
[Qemu-devel] [PATCH 04/16] slirp: Adding IPv6, ICMPv6 Echo and NDP autoconfiguration, Samuel Thibault, 2013/10/20
[Qemu-devel] [PATCH 14/16] slirp: Handle IPv6 in TCP functions, Samuel Thibault, 2013/10/20
[Qemu-devel] [PATCH 02/16] slirp: Generalizing and neutralizing code before adding IPv6 stuff, Samuel Thibault, 2013/10/20