• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /barrelfish-2018-10-04/lib/lwip2/src/core/ipv4/

Lines Matching refs:group

55 A query for a specific group address (as opposed to ALLHOSTS)
100 static err_t igmp_remove_group(struct netif* netif, struct igmp_group *group);
101 static void igmp_timeout(struct netif *netif, struct igmp_group *group);
102 static void igmp_start_timer(struct igmp_group *group, u8_t max_time);
103 static void igmp_delaying_member(struct igmp_group *group, u8_t maxresp);
105 static void igmp_send(struct netif *netif, struct igmp_group *group, u8_t type);
130 struct igmp_group* group;
134 group = igmp_lookup_group(netif, &allsystems);
136 if (group != NULL) {
137 group->group_state = IGMP_GROUP_IDLE_MEMBER;
138 group->use++;
162 struct igmp_group *group = netif_igmp_data(netif);
166 while (group != NULL) {
167 struct igmp_group *next = group->next; /* avoid use-after-free below */
169 /* disable the group at the MAC level */
172 ip4_addr_debug_print(IGMP_DEBUG, &group->group_address);
174 netif->igmp_mac_filter(netif, &(group->group_address), NETIF_DEL_MAC_FILTER);
177 /* free group */
178 memp_free(MEMP_IGMP_GROUP, group);
181 group = next;
194 struct igmp_group *group = netif_igmp_data(netif);
198 /* Skip the first group in the list, it is always the allsystems group added in igmp_start() */
199 if(group != NULL) {
200 group = group->next;
203 while (group != NULL) {
204 igmp_delaying_member(group, IGMP_JOIN_DELAYING_MEMBER_TMR);
205 group = group->next;
210 * Search for a group in the global igmp_group_list
213 * @param addr the group ip address to search for
214 * @return a struct igmp_group* if the group has been found,
215 * NULL if the group wasn't found.
220 struct igmp_group *group = netif_igmp_data(ifp);
222 while (group != NULL) {
223 if (ip4_addr_cmp(&(group->group_address), addr)) {
224 return group;
226 group = group->next;
230 * 'group' (which is also NULL at this point).
236 * Search for a specific igmp group and create a new one if not found-
239 * @param addr the group ip address to search
246 struct igmp_group *group;
249 /* Search if the group already exists */
250 group = igmp_lookfor_group(ifp, addr);
251 if (group != NULL) {
253 return group;
257 group = (struct igmp_group *)memp_malloc(MEMP_IGMP_GROUP);
258 if (group != NULL) {
259 ip4_addr_set(&(group->group_address), addr);
260 group->timer = 0; /* Not running */
261 group->group_state = IGMP_GROUP_NON_MEMBER;
262 group->last_reporter_flag = 0;
263 group->use = 0;
265 /* Ensure allsystems group is always first in list */
268 LWIP_ASSERT("igmp_lookup_group: first group must be allsystems",
270 group->next = NULL;
271 netif_set_client_data(ifp, LWIP_NETIF_CLIENT_DATA_INDEX_IGMP, group);
274 LWIP_ASSERT("igmp_lookup_group: all except first group must not be allsystems",
276 group->next = list_head->next;
277 list_head->next = group;
281 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_lookup_group: %sallocated a new group with address ", (group?"":"impossible to ")));
285 return group;
289 * Remove a group in the global igmp_group_list, but don't free it yet
291 * @param group the group to remove from the global igmp_group_list
292 * @return ERR_OK if group was removed from the list, an err_t otherwise
295 igmp_remove_group(struct netif* netif, struct igmp_group *group)
300 /* Skip the first group in the list, it is always the allsystems group added in igmp_start() */
302 if (tmp_group->next == group) {
303 tmp_group->next = group->next;
326 struct igmp_group* group;
354 /* Packet is ok so find an existing group */
355 group = igmp_lookfor_group(inp, dest); /* use the destination IP address of incoming packet */
357 /* If group can be found or create... */
358 if (!group) {
383 /* Do not send messages on the all systems group address! */
384 /* Skip the first group in the list, it is always the allsystems group added in igmp_start() */
394 /* IGMP_MEMB_QUERY to a specific group ? */
396 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: IGMP_MEMB_QUERY to a specific group "));
401 /* we first need to re-look for the group since we used dest last time */
403 group = igmp_lookfor_group(inp, &groupaddr);
405 LWIP_DEBUGF(IGMP_DEBUG, (" with the group address as destination [igmp_maxresp=%i]\n", (int)(igmp->igmp_maxresp)));
408 if (group != NULL) {
410 igmp_delaying_member(group, igmp->igmp_maxresp);
422 if (group->group_state == IGMP_GROUP_DELAYING_MEMBER) {
423 /* This is on a specific group we have already looked up */
424 group->timer = 0; /* stopped */
425 group->group_state = IGMP_GROUP_IDLE_MEMBER;
426 group->last_reporter_flag = 0;
430 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: unexpected msg %d in state %d on group %p on if %p\n",
431 igmp->igmp_msgtype, group->group_state, (void*)&group, (void*)inp));
442 * Join a group on one network interface.
444 * @param ifaddr ip address of the network interface which should join a new group
445 * @param groupaddr the ip address of the group which to join
446 * @return ERR_OK if group was joined on the netif(s), an err_t otherwise
479 * Join a group on one network interface.
481 * @param netif the network interface which should join a new group
482 * @param groupaddr the ip address of the group which to join
483 * @return ERR_OK if group was joined on the netif, an err_t otherwise
488 struct igmp_group *group;
497 /* find group or create a new one if not found */
498 group = igmp_lookup_group(netif, groupaddr);
500 if (group != NULL) {
501 /* This should create a new group, check the state to make sure */
502 if (group->group_state != IGMP_GROUP_NON_MEMBER) {
503 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_joingroup_netif: join to group not in state IGMP_GROUP_NON_MEMBER\n"));
505 /* OK - it was new group */
506 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_joingroup_netif: join to new group: "));
510 /* If first use of the group, allow the group at the MAC level */
511 if ((group->use==0) && (netif->igmp_mac_filter != NULL)) {
519 igmp_send(netif, group, IGMP_V2_MEMB_REPORT);
521 igmp_start_timer(group, IGMP_JOIN_DELAYING_MEMBER_TMR);
524 group->group_state = IGMP_GROUP_DELAYING_MEMBER;
526 /* Increment group use */
527 group->use++;
531 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_joingroup_netif: Not enough memory to join to group\n"));
538 * Leave a group on one network interface.
540 * @param ifaddr ip address of the network interface which should leave a group
541 * @param groupaddr the ip address of the group which to leave
542 * @return ERR_OK if group was left on the netif(s), an err_t otherwise
574 * Leave a group on one network interface.
576 * @param netif the network interface which should leave a group
577 * @param groupaddr the ip address of the group which to leave
578 * @return ERR_OK if group was left on the netif, an err_t otherwise
583 struct igmp_group *group;
592 /* find group */
593 group = igmp_lookfor_group(netif, groupaddr);
595 if (group != NULL) {
597 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_leavegroup_netif: Leaving group: "));
601 /* If there is no other use of the group */
602 if (group->use <= 1) {
603 /* Remove the group from the list */
604 igmp_remove_group(netif, group);
606 /* If we are the last reporter for this group */
607 if (group->last_reporter_flag) {
608 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_leavegroup_netif: sending leaving group\n"));
610 igmp_send(netif, group, IGMP_LEAVE_GROUP);
613 /* Disable the group at the MAC level */
621 /* Free group struct */
622 memp_free(MEMP_IGMP_GROUP, group);
624 /* Decrement group use */
625 group->use--;
629 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_leavegroup_netif: not member of group\n"));
644 struct igmp_group *group = netif_igmp_data(netif);
646 while (group != NULL) {
647 if (group->timer > 0) {
648 group->timer--;
649 if (group->timer == 0) {
650 igmp_timeout(netif, group);
653 group = group->next;
660 * Called if a timeout for one group is reached.
661 * Sends a report for this group.
663 * @param group an igmp_group for which a timeout is reached
666 igmp_timeout(struct netif *netif, struct igmp_group *group)
668 /* If the state is IGMP_GROUP_DELAYING_MEMBER then we send a report for this group
669 (unless it is the allsystems group) */
670 if ((group->group_state == IGMP_GROUP_DELAYING_MEMBER) &&
671 (!(ip4_addr_cmp(&(group->group_address), &allsystems)))) {
672 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_timeout: report membership for group with address "));
673 ip4_addr_debug_print(IGMP_DEBUG, &(group->group_address));
676 group->group_state = IGMP_GROUP_IDLE_MEMBER;
679 igmp_send(netif, group, IGMP_V2_MEMB_REPORT);
684 * Start a timer for an igmp group
686 * @param group the igmp_group for which to start a timer
691 igmp_start_timer(struct igmp_group *group, u8_t max_time)
694 group->timer = max_time > 2 ? (LWIP_RAND() % max_time) : 1;
697 group->timer = max_time / 2;
700 if (group->timer == 0) {
701 group->timer = 1;
706 * Delaying membership report for a group if necessary
708 * @param group the igmp_group for which "delaying" membership report
712 igmp_delaying_member(struct igmp_group *group, u8_t maxresp)
714 if ((group->group_state == IGMP_GROUP_IDLE_MEMBER) ||
715 ((group->group_state == IGMP_GROUP_DELAYING_MEMBER) &&
716 ((group->timer == 0) || (maxresp < group->timer)))) {
717 igmp_start_timer(group, maxresp);
718 group->group_state = IGMP_GROUP_DELAYING_MEMBER;
751 * Send an igmp packet to a specific group.
753 * @param group the group to which to send the packet
757 igmp_send(struct netif *netif, struct igmp_group *group, u8_t type)
774 dest = &(group->group_address);
775 ip4_addr_copy(igmp->igmp_group_address, group->group_address);
776 group->last_reporter_flag = 1; /* Remember we were the last to report */
780 ip4_addr_copy(igmp->igmp_group_address, group->group_address);