mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-01 04:12:07 +00:00
Fixed bug #28798 (Error in "Max Response Time" processing) and another bug when LWIP_RAND() returns zero.
This commit is contained in:
parent
b0b4290c29
commit
b156d392cb
@ -87,6 +87,10 @@ HISTORY
|
||||
|
||||
++ Bugfixes:
|
||||
|
||||
2010-02-08: Simon Goldschmidt (Stéphane Lesage)
|
||||
* igmp.c: Fixed bug #28798 (Error in "Max Response Time" processing) and
|
||||
another bug when LWIP_RAND() returns zero.
|
||||
|
||||
2010-02-04: Simon Goldschmidt
|
||||
* nearly every file: Use macros defined in ip_addr.h (some of them new)
|
||||
to work with IP addresses (preparation for bug #27352 - Change ip_addr
|
||||
|
@ -347,6 +347,7 @@ igmp_input(struct pbuf *p, struct netif *inp, ip_addr_t *dest)
|
||||
struct igmp_group* group;
|
||||
struct igmp_group* groupref;
|
||||
|
||||
|
||||
/* Note that the length CAN be greater than 8 but only 8 are used - All are included in the checksum */
|
||||
iphdr = p->payload;
|
||||
if (pbuf_header(p, -(s16_t)(IPH_HL(iphdr) * 4)) || (p->len < IGMP_MINLEN)) {
|
||||
@ -427,7 +428,6 @@ igmp_input(struct pbuf *p, struct netif *inp, ip_addr_t *dest)
|
||||
}
|
||||
case IGMP_V2_MEMB_REPORT: {
|
||||
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: IGMP_V2_MEMB_REPORT\n"));
|
||||
|
||||
IGMP_STATS_INC(igmp.report_rxed);
|
||||
if (group->group_state == IGMP_GROUP_DELAYING_MEMBER) {
|
||||
/* This is on a specific group we have already looked up */
|
||||
@ -601,8 +601,8 @@ igmp_tmr(void)
|
||||
struct igmp_group *group = igmp_group_list;
|
||||
|
||||
while (group != NULL) {
|
||||
if (group->timer != 0) {
|
||||
group->timer -= 1;
|
||||
if (group->timer > 0) {
|
||||
group->timer--;
|
||||
if (group->timer == 0) {
|
||||
igmp_timeout(group);
|
||||
}
|
||||
@ -640,7 +640,8 @@ igmp_timeout(struct igmp_group *group)
|
||||
void
|
||||
igmp_start_timer(struct igmp_group *group, u8_t max_time)
|
||||
{
|
||||
group->timer = LWIP_RAND() % max_time;
|
||||
/* ensure the value is > 0 */
|
||||
group->timer = (LWIP_RAND() % (max_time - 1)) + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -663,9 +664,14 @@ igmp_stop_timer(struct igmp_group *group)
|
||||
void
|
||||
igmp_delaying_member(struct igmp_group *group, u8_t maxresp)
|
||||
{
|
||||
u8_t maxresphalf = maxresp / 2;
|
||||
if (maxresphalf == 0) {
|
||||
maxresphalf = 1;
|
||||
}
|
||||
if ((group->group_state == IGMP_GROUP_IDLE_MEMBER) ||
|
||||
((group->group_state == IGMP_GROUP_DELAYING_MEMBER) && (maxresp > group->timer))) {
|
||||
igmp_start_timer(group, (maxresp)/2);
|
||||
((group->group_state == IGMP_GROUP_DELAYING_MEMBER) &&
|
||||
((group->timer == 0) || (maxresphalf < group->timer)))) {
|
||||
igmp_start_timer(group, maxresphalf);
|
||||
group->group_state = IGMP_GROUP_DELAYING_MEMBER;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user