minor: fixed coding style in igmp.c

This commit is contained in:
goldsimon 2015-09-30 14:37:37 +02:00
parent ba71ac78d9
commit 3dd0977635

View File

@ -345,8 +345,9 @@ igmp_remove_group(struct igmp_group *group)
} }
} }
/* Group not found in the global igmp_group_list */ /* Group not found in the global igmp_group_list */
if (tmpGroup == NULL) if (tmpGroup == NULL) {
err = ERR_ARG; err = ERR_ARG;
}
} }
/* free group */ /* free group */
memp_free(MEMP_IGMP_GROUP, group); memp_free(MEMP_IGMP_GROUP, group);
@ -406,72 +407,69 @@ igmp_input(struct pbuf *p, struct netif *inp, const ip4_addr_t *dest)
/* NOW ACT ON THE INCOMING MESSAGE TYPE... */ /* NOW ACT ON THE INCOMING MESSAGE TYPE... */
switch (igmp->igmp_msgtype) { switch (igmp->igmp_msgtype) {
case IGMP_MEMB_QUERY: { case IGMP_MEMB_QUERY:
/* IGMP_MEMB_QUERY to the "all systems" address ? */ /* IGMP_MEMB_QUERY to the "all systems" address ? */
if ((ip4_addr_cmp(dest, &allsystems)) && ip4_addr_isany(&igmp->igmp_group_address)) { if ((ip4_addr_cmp(dest, &allsystems)) && ip4_addr_isany(&igmp->igmp_group_address)) {
/* THIS IS THE GENERAL QUERY */ /* THIS IS THE GENERAL QUERY */
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: General IGMP_MEMB_QUERY on \"ALL SYSTEMS\" address (224.0.0.1) [igmp_maxresp=%i]\n", (int)(igmp->igmp_maxresp))); LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: General IGMP_MEMB_QUERY on \"ALL SYSTEMS\" address (224.0.0.1) [igmp_maxresp=%i]\n", (int)(igmp->igmp_maxresp)));
if (igmp->igmp_maxresp == 0) { if (igmp->igmp_maxresp == 0) {
IGMP_STATS_INC(igmp.rx_v1); IGMP_STATS_INC(igmp.rx_v1);
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: got an all hosts query with time== 0 - this is V1 and not implemented - treat as v2\n")); LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: got an all hosts query with time== 0 - this is V1 and not implemented - treat as v2\n"));
igmp->igmp_maxresp = IGMP_V1_DELAYING_MEMBER_TMR; igmp->igmp_maxresp = IGMP_V1_DELAYING_MEMBER_TMR;
} else { } else {
IGMP_STATS_INC(igmp.rx_general); IGMP_STATS_INC(igmp.rx_general);
} }
groupref = igmp_group_list; groupref = igmp_group_list;
while (groupref) { while (groupref) {
/* Do not send messages on the all systems group address! */ /* Do not send messages on the all systems group address! */
if ((groupref->netif == inp) && (!(ip4_addr_cmp(&(groupref->group_address), &allsystems)))) { if ((groupref->netif == inp) && (!(ip4_addr_cmp(&(groupref->group_address), &allsystems)))) {
igmp_delaying_member(groupref, igmp->igmp_maxresp); igmp_delaying_member(groupref, igmp->igmp_maxresp);
} }
groupref = groupref->next; groupref = groupref->next;
} }
} else { } else {
/* IGMP_MEMB_QUERY to a specific group ? */ /* IGMP_MEMB_QUERY to a specific group ? */
if (!ip4_addr_isany(&igmp->igmp_group_address)) { if (!ip4_addr_isany(&igmp->igmp_group_address)) {
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: IGMP_MEMB_QUERY to a specific group ")); LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: IGMP_MEMB_QUERY to a specific group "));
ip4_addr_debug_print(IGMP_DEBUG, &igmp->igmp_group_address); ip4_addr_debug_print(IGMP_DEBUG, &igmp->igmp_group_address);
if (ip4_addr_cmp(dest, &allsystems)) { if (ip4_addr_cmp(dest, &allsystems)) {
ip4_addr_t groupaddr; ip4_addr_t groupaddr;
LWIP_DEBUGF(IGMP_DEBUG, (" using \"ALL SYSTEMS\" address (224.0.0.1) [igmp_maxresp=%i]\n", (int)(igmp->igmp_maxresp))); LWIP_DEBUGF(IGMP_DEBUG, (" using \"ALL SYSTEMS\" address (224.0.0.1) [igmp_maxresp=%i]\n", (int)(igmp->igmp_maxresp)));
/* we first need to re-look for the group since we used dest last time */ /* we first need to re-look for the group since we used dest last time */
ip4_addr_copy(groupaddr, igmp->igmp_group_address); ip4_addr_copy(groupaddr, igmp->igmp_group_address);
group = igmp_lookfor_group(inp, &groupaddr); group = igmp_lookfor_group(inp, &groupaddr);
} else { } else {
LWIP_DEBUGF(IGMP_DEBUG, (" with the group address as destination [igmp_maxresp=%i]\n", (int)(igmp->igmp_maxresp))); LWIP_DEBUGF(IGMP_DEBUG, (" with the group address as destination [igmp_maxresp=%i]\n", (int)(igmp->igmp_maxresp)));
} }
if (group != NULL) { if (group != NULL) {
IGMP_STATS_INC(igmp.rx_group); IGMP_STATS_INC(igmp.rx_group);
igmp_delaying_member(group, igmp->igmp_maxresp); igmp_delaying_member(group, igmp->igmp_maxresp);
} else { } else {
IGMP_STATS_INC(igmp.drop); IGMP_STATS_INC(igmp.drop);
} }
} else { } else {
IGMP_STATS_INC(igmp.proterr); IGMP_STATS_INC(igmp.proterr);
} }
} }
break; break;
} case IGMP_V2_MEMB_REPORT:
case IGMP_V2_MEMB_REPORT: { LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: IGMP_V2_MEMB_REPORT\n"));
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: IGMP_V2_MEMB_REPORT\n")); IGMP_STATS_INC(igmp.rx_report);
IGMP_STATS_INC(igmp.rx_report); if (group->group_state == IGMP_GROUP_DELAYING_MEMBER) {
if (group->group_state == IGMP_GROUP_DELAYING_MEMBER) { /* This is on a specific group we have already looked up */
/* This is on a specific group we have already looked up */ group->timer = 0; /* stopped */
group->timer = 0; /* stopped */ group->group_state = IGMP_GROUP_IDLE_MEMBER;
group->group_state = IGMP_GROUP_IDLE_MEMBER; group->last_reporter_flag = 0;
group->last_reporter_flag = 0; }
} break;
break; default:
} LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: unexpected msg %d in state %d on group %p on if %p\n",
default: { igmp->igmp_msgtype, group->group_state, (void*)&group, (void*)group->netif));
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: unexpected msg %d in state %d on group %p on if %p\n", IGMP_STATS_INC(igmp.proterr);
igmp->igmp_msgtype, group->group_state, (void*)&group, (void*)group->netif)); break;
IGMP_STATS_INC(igmp.proterr);
break;
}
} }
pbuf_free(p); pbuf_free(p);
@ -488,7 +486,7 @@ igmp_input(struct pbuf *p, struct netif *inp, const ip4_addr_t *dest)
err_t err_t
igmp_joingroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr) igmp_joingroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr)
{ {
err_t err = ERR_VAL; /* no matching interface */ err_t err = ERR_VAL; /* no matching interface */
struct netif *netif; struct netif *netif;
/* make sure it is multicast address */ /* make sure it is multicast address */
@ -521,7 +519,8 @@ igmp_joingroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr)
* @param groupaddr the ip address of the group which to join * @param groupaddr the ip address of the group which to join
* @return ERR_OK if group was joined on the netif, an err_t otherwise * @return ERR_OK if group was joined on the netif, an err_t otherwise
*/ */
err_t igmp_joingroup_netif(struct netif *netif, const ip4_addr_t *groupaddr) err_t
igmp_joingroup_netif(struct netif *netif, const ip4_addr_t *groupaddr)
{ {
struct igmp_group *group; struct igmp_group *group;
@ -581,7 +580,7 @@ err_t igmp_joingroup_netif(struct netif *netif, const ip4_addr_t *groupaddr)
err_t err_t
igmp_leavegroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr) igmp_leavegroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr)
{ {
err_t err = ERR_VAL; /* no matching interface */ err_t err = ERR_VAL; /* no matching interface */
struct netif *netif; struct netif *netif;
/* make sure it is multicast address */ /* make sure it is multicast address */
@ -613,7 +612,8 @@ igmp_leavegroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr)
* @param groupaddr the ip address of the group which to leave * @param groupaddr the ip address of the group which to leave
* @return ERR_OK if group was left on the netif, an err_t otherwise * @return ERR_OK if group was left on the netif, an err_t otherwise
*/ */
err_t igmp_leavegroup_netif(struct netif *netif, const ip4_addr_t *groupaddr) err_t
igmp_leavegroup_netif(struct netif *netif, const ip4_addr_t *groupaddr)
{ {
struct igmp_group *group; struct igmp_group *group;