Unverified Commit f7b48b92 authored by Johan Ström's avatar Johan Ström Committed by GitHub
Browse files

Fix IGMP timer (#3476)

LWIP_RAND() return type is int, value returned is sometimes negative.
This causes timer to sometimes (often) go outside of max_time, which in turn causes IGMP snoopers or IGMP routers to drop the subscription
parent 77e53590
...@@ -731,7 +731,7 @@ igmp_start_timer(struct igmp_group *group, u8_t max_time) ...@@ -731,7 +731,7 @@ igmp_start_timer(struct igmp_group *group, u8_t max_time)
if(max_time == 1) if(max_time == 1)
group->timer = 1; group->timer = 1;
else else
group->timer = (LWIP_RAND() % (max_time - 1)) + 1; group->timer = (u16_t) ((unsigned int)LWIP_RAND() % (max_time - 1)) + 1;
} }
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment