From 5e8ee7e006284fe8f507d4bbf32029c0fef438ca Mon Sep 17 00:00:00 2001 From: Simon Goldschmidt Date: Sat, 3 Sep 2011 22:27:30 +0200 Subject: [PATCH] Make LWIP_RAND optional (useful for small targets) --- src/core/ipv4/igmp.c | 2 ++ src/core/ipv6/mld6.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/ipv4/igmp.c b/src/core/ipv4/igmp.c index 22a1e161..bd52744f 100644 --- a/src/core/ipv4/igmp.c +++ b/src/core/ipv4/igmp.c @@ -699,8 +699,10 @@ igmp_start_timer(struct igmp_group *group, u8_t max_time) if (max_time == 0) { max_time = 1; } +#ifdef LWIP_RAND /* ensure the random value is > 0 */ group->timer = (LWIP_RAND() % (max_time - 1)) + 1; +#endif /* LWIP_RAND */ } /** diff --git a/src/core/ipv6/mld6.c b/src/core/ipv6/mld6.c index 9db25bab..1cb2dd9c 100644 --- a/src/core/ipv6/mld6.c +++ b/src/core/ipv6/mld6.c @@ -493,8 +493,10 @@ mld6_delayed_report(struct mld_group *group, u16_t maxresp) maxresp = 1; } - /* Randomize maxresp. */ +#ifdef LWIP_RAND + /* Randomize maxresp. (if LWIP_RAND is supported) */ maxresp = (LWIP_RAND() % (maxresp - 1)) + 1; +#endif /* LWIP_RAND */ /* Apply timer value if no report has been scheduled already. */ if ((group->group_state == MLD6_GROUP_IDLE_MEMBER) ||