1 /**
2 * @file
3 * Multicast listener discovery
4 *
5 * @defgroup mld6 MLD6
6 * @ingroup ip6
7 * Multicast listener discovery for IPv6. Aims to be compliant with RFC 2710.
8 * No support for MLDv2.\n
9 * Note: The allnodes (ff01::1, ff02::1) group is assumed be received by your
10 * netif since it must always be received for correct IPv6 operation (e.g. SLAAC).
11 * Ensure the netif filters are configured accordingly!\n
12 * The netif flags also need NETIF_FLAG_MLD6 flag set to enable MLD6 on a
13 * netif ("netif->flags |= NETIF_FLAG_MLD6;").\n
14 * To be called from TCPIP thread.
15 */
16
17 /*
18 * Copyright (c) 2010 Inico Technologies Ltd.
19 * All rights reserved.
20 *
21 * Redistribution and use in source and binary forms, with or without modification,
22 * are permitted provided that the following conditions are met:
23 *
24 * 1. Redistributions of source code must retain the above copyright notice,
25 * this list of conditions and the following disclaimer.
26 * 2. Redistributions in binary form must reproduce the above copyright notice,
27 * this list of conditions and the following disclaimer in the documentation
28 * and/or other materials provided with the distribution.
29 * 3. The name of the author may not be used to endorse or promote products
30 * derived from this software without specific prior written permission.
31 *
32 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
33 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
34 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
35 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
36 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
37 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
39 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
41 * OF SUCH DAMAGE.
42 *
43 * This file is part of the lwIP TCP/IP stack.
44 *
45 * Author: Ivan Delamer <delamer@inicotech.com>
46 *
47 *
48 * Please coordinate changes and requests with Ivan Delamer
49 * <delamer@inicotech.com>
50 */
51
52 /* Based on igmp.c implementation of igmp v2 protocol */
53
54 #include "lwip/opt.h"
55
56 #if LWIP_IPV6 && LWIP_IPV6_MLD /* don't build if not configured for use in lwipopts.h */
57
58 #include "lwip/mld6.h"
59 #include "lwip/prot/mld6.h"
60 #include "lwip/icmp6.h"
61 #include "lwip/ip6.h"
62 #include "lwip/ip6_addr.h"
63 #include "lwip/ip.h"
64 #include "lwip/inet_chksum.h"
65 #include "lwip/pbuf.h"
66 #include "lwip/netif.h"
67 #include "lwip/memp.h"
68 #include "lwip/stats.h"
69
70 #include <string.h>
71
72
73 /*
74 * MLD constants
75 */
76 #define MLD6_HL 1
77 #define MLD6_JOIN_DELAYING_MEMBER_TMR_MS (500)
78
79 #define MLD6_GROUP_NON_MEMBER 0
80 #define MLD6_GROUP_DELAYING_MEMBER 1
81 #define MLD6_GROUP_IDLE_MEMBER 2
82
83 /* Forward declarations. */
84 static struct mld_group *mld6_new_group(struct netif *ifp, const ip6_addr_t *addr);
85 static err_t mld6_remove_group(struct netif *netif, struct mld_group *group);
86 static void mld6_delayed_report(struct mld_group *group, u16_t maxresp);
87 static void mld6_send(struct netif *netif, struct mld_group *group, u8_t type);
88
89
90 /**
91 * Stop MLD processing on interface
92 *
93 * @param netif network interface on which stop MLD processing
94 */
95 err_t
mld6_stop(struct netif * netif)96 mld6_stop(struct netif *netif)
97 {
98 struct mld_group *group = netif_mld6_data(netif);
99
100 netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_MLD6, NULL);
101
102 while (group != NULL) {
103 struct mld_group *next = group->next; /* avoid use-after-free below */
104
105 /* disable the group at the MAC level */
106 if (netif->mld_mac_filter != NULL) {
107 netif->mld_mac_filter(netif, &(group->group_address), NETIF_DEL_MAC_FILTER);
108 }
109
110 /* free group */
111 memp_free(MEMP_MLD6_GROUP, group);
112
113 /* move to "next" */
114 group = next;
115 }
116 return ERR_OK;
117 }
118
119 /**
120 * Report MLD memberships for this interface
121 *
122 * @param netif network interface on which report MLD memberships
123 */
124 void
mld6_report_groups(struct netif * netif)125 mld6_report_groups(struct netif *netif)
126 {
127 struct mld_group *group = netif_mld6_data(netif);
128
129 while (group != NULL) {
130 mld6_delayed_report(group, MLD6_JOIN_DELAYING_MEMBER_TMR_MS);
131 group = group->next;
132 }
133 }
134
135 /**
136 * Search for a group that is joined on a netif
137 *
138 * @param ifp the network interface for which to look
139 * @param addr the group ipv6 address to search for
140 * @return a struct mld_group* if the group has been found,
141 * NULL if the group wasn't found.
142 */
143 struct mld_group *
mld6_lookfor_group(struct netif * ifp,const ip6_addr_t * addr)144 mld6_lookfor_group(struct netif *ifp, const ip6_addr_t *addr)
145 {
146 struct mld_group *group = netif_mld6_data(ifp);
147
148 while (group != NULL) {
149 if (ip6_addr_cmp(&(group->group_address), addr)) {
150 return group;
151 }
152 group = group->next;
153 }
154
155 return NULL;
156 }
157
158
159 /**
160 * create a new group
161 *
162 * @param ifp the network interface for which to create
163 * @param addr the new group ipv6
164 * @return a struct mld_group*,
165 * NULL on memory error.
166 */
167 static struct mld_group *
mld6_new_group(struct netif * ifp,const ip6_addr_t * addr)168 mld6_new_group(struct netif *ifp, const ip6_addr_t *addr)
169 {
170 struct mld_group *group;
171
172 group = (struct mld_group *)memp_malloc(MEMP_MLD6_GROUP);
173 if (group != NULL) {
174 ip6_addr_set(&(group->group_address), addr);
175 group->timer = 0; /* Not running */
176 group->group_state = MLD6_GROUP_IDLE_MEMBER;
177 group->last_reporter_flag = 0;
178 group->use = 0;
179 group->next = netif_mld6_data(ifp);
180
181 netif_set_client_data(ifp, LWIP_NETIF_CLIENT_DATA_INDEX_MLD6, group);
182 }
183
184 return group;
185 }
186
187 /**
188 * Remove a group from the mld_group_list, but do not free it yet
189 *
190 * @param group the group to remove
191 * @return ERR_OK if group was removed from the list, an err_t otherwise
192 */
193 static err_t
mld6_remove_group(struct netif * netif,struct mld_group * group)194 mld6_remove_group(struct netif *netif, struct mld_group *group)
195 {
196 err_t err = ERR_OK;
197
198 /* Is it the first group? */
199 if (netif_mld6_data(netif) == group) {
200 netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_MLD6, group->next);
201 } else {
202 /* look for group further down the list */
203 struct mld_group *tmpGroup;
204 for (tmpGroup = netif_mld6_data(netif); tmpGroup != NULL; tmpGroup = tmpGroup->next) {
205 if (tmpGroup->next == group) {
206 tmpGroup->next = group->next;
207 break;
208 }
209 }
210 /* Group not find group */
211 if (tmpGroup == NULL) {
212 err = ERR_ARG;
213 }
214 }
215
216 return err;
217 }
218
219
220 /**
221 * Process an input MLD message. Called by icmp6_input.
222 *
223 * @param p the mld packet, p->payload pointing to the icmpv6 header
224 * @param inp the netif on which this packet was received
225 */
226 void
mld6_input(struct pbuf * p,struct netif * inp)227 mld6_input(struct pbuf *p, struct netif *inp)
228 {
229 struct mld_header *mld_hdr;
230 struct mld_group *group;
231
232 MLD6_STATS_INC(mld6.recv);
233
234 /* Check that mld header fits in packet. */
235 if (p->len < sizeof(struct mld_header)) {
236 /* @todo debug message */
237 pbuf_free(p);
238 MLD6_STATS_INC(mld6.lenerr);
239 MLD6_STATS_INC(mld6.drop);
240 return;
241 }
242
243 mld_hdr = (struct mld_header *)p->payload;
244
245 switch (mld_hdr->type) {
246 case ICMP6_TYPE_MLQ: /* Multicast listener query. */
247 /* Is it a general query? */
248 if (ip6_addr_isallnodes_linklocal(ip6_current_dest_addr()) &&
249 ip6_addr_isany(&(mld_hdr->multicast_address))) {
250 MLD6_STATS_INC(mld6.rx_general);
251 /* Report all groups, except all nodes group, and if-local groups. */
252 group = netif_mld6_data(inp);
253 while (group != NULL) {
254 if ((!(ip6_addr_ismulticast_iflocal(&(group->group_address)))) &&
255 (!(ip6_addr_isallnodes_linklocal(&(group->group_address))))) {
256 mld6_delayed_report(group, lwip_ntohs(mld_hdr->max_resp_delay));
257 }
258 group = group->next;
259 }
260 } else {
261 /* Have we joined this group?
262 * We use IP6 destination address to have a memory aligned copy.
263 * mld_hdr->multicast_address should be the same. */
264 MLD6_STATS_INC(mld6.rx_group);
265 group = mld6_lookfor_group(inp, ip6_current_dest_addr());
266 if (group != NULL) {
267 /* Schedule a report. */
268 mld6_delayed_report(group, lwip_ntohs(mld_hdr->max_resp_delay));
269 }
270 }
271 break; /* ICMP6_TYPE_MLQ */
272 case ICMP6_TYPE_MLR: /* Multicast listener report. */
273 /* Have we joined this group?
274 * We use IP6 destination address to have a memory aligned copy.
275 * mld_hdr->multicast_address should be the same. */
276 MLD6_STATS_INC(mld6.rx_report);
277 group = mld6_lookfor_group(inp, ip6_current_dest_addr());
278 if (group != NULL) {
279 /* If we are waiting to report, cancel it. */
280 if (group->group_state == MLD6_GROUP_DELAYING_MEMBER) {
281 group->timer = 0; /* stopped */
282 group->group_state = MLD6_GROUP_IDLE_MEMBER;
283 group->last_reporter_flag = 0;
284 }
285 }
286 break; /* ICMP6_TYPE_MLR */
287 case ICMP6_TYPE_MLD: /* Multicast listener done. */
288 /* Do nothing, router will query us. */
289 break; /* ICMP6_TYPE_MLD */
290 default:
291 MLD6_STATS_INC(mld6.proterr);
292 MLD6_STATS_INC(mld6.drop);
293 break;
294 }
295
296 pbuf_free(p);
297 }
298
299 /**
300 * @ingroup mld6
301 * Join a group on one or all network interfaces.
302 *
303 * If the group is to be joined on all interfaces, the given group address must
304 * not have a zone set (i.e., it must have its zone index set to IP6_NO_ZONE).
305 * If the group is to be joined on one particular interface, the given group
306 * address may or may not have a zone set.
307 *
308 * @param srcaddr ipv6 address (zoned) of the network interface which should
309 * join a new group. If IP6_ADDR_ANY6, join on all netifs
310 * @param groupaddr the ipv6 address of the group to join (possibly but not
311 * necessarily zoned)
312 * @return ERR_OK if group was joined on the netif(s), an err_t otherwise
313 */
314 err_t
mld6_joingroup(const ip6_addr_t * srcaddr,const ip6_addr_t * groupaddr)315 mld6_joingroup(const ip6_addr_t *srcaddr, const ip6_addr_t *groupaddr)
316 {
317 err_t err = ERR_VAL; /* no matching interface */
318 struct netif *netif;
319
320 LWIP_ASSERT_CORE_LOCKED();
321
322 /* loop through netif's */
323 #ifdef LOSCFG_NET_CONTAINER
324 NETIF_FOREACH(netif, get_root_net_group()) {
325 #else
326 NETIF_FOREACH(netif) {
327 #endif
328 /* Should we join this interface ? */
329 if (ip6_addr_isany(srcaddr) ||
330 netif_get_ip6_addr_match(netif, srcaddr) >= 0) {
331 err = mld6_joingroup_netif(netif, groupaddr);
332 if (err != ERR_OK) {
333 return err;
334 }
335 }
336 }
337
338 return err;
339 }
340
341 /**
342 * @ingroup mld6
343 * Join a group on a network interface.
344 *
345 * @param netif the network interface which should join a new group.
346 * @param groupaddr the ipv6 address of the group to join (possibly but not
347 * necessarily zoned)
348 * @return ERR_OK if group was joined on the netif, an err_t otherwise
349 */
350 err_t
351 mld6_joingroup_netif(struct netif *netif, const ip6_addr_t *groupaddr)
352 {
353 struct mld_group *group;
354 #if LWIP_IPV6_SCOPES
355 ip6_addr_t ip6addr;
356
357 /* If the address has a particular scope but no zone set, use the netif to
358 * set one now. Within the mld6 module, all addresses are properly zoned. */
359 if (ip6_addr_lacks_zone(groupaddr, IP6_MULTICAST)) {
360 ip6_addr_set(&ip6addr, groupaddr);
361 ip6_addr_assign_zone(&ip6addr, IP6_MULTICAST, netif);
362 groupaddr = &ip6addr;
363 }
364 IP6_ADDR_ZONECHECK_NETIF(groupaddr, netif);
365 #endif /* LWIP_IPV6_SCOPES */
366
367 LWIP_ASSERT_CORE_LOCKED();
368
369 /* find group or create a new one if not found */
370 group = mld6_lookfor_group(netif, groupaddr);
371
372 if (group == NULL) {
373 /* Joining a new group. Create a new group entry. */
374 group = mld6_new_group(netif, groupaddr);
375 if (group == NULL) {
376 return ERR_MEM;
377 }
378
379 /* Activate this address on the MAC layer. */
380 if (netif->mld_mac_filter != NULL) {
381 netif->mld_mac_filter(netif, groupaddr, NETIF_ADD_MAC_FILTER);
382 }
383
384 /* Report our membership. */
385 MLD6_STATS_INC(mld6.tx_report);
386 mld6_send(netif, group, ICMP6_TYPE_MLR);
387 mld6_delayed_report(group, MLD6_JOIN_DELAYING_MEMBER_TMR_MS);
388 }
389
390 /* Increment group use */
391 group->use++;
392 return ERR_OK;
393 }
394
395 /**
396 * @ingroup mld6
397 * Leave a group on a network interface.
398 *
399 * Zoning of address follows the same rules as @ref mld6_joingroup.
400 *
401 * @param srcaddr ipv6 address (zoned) of the network interface which should
402 * leave the group. If IP6_ADDR_ANY6, leave on all netifs
403 * @param groupaddr the ipv6 address of the group to leave (possibly, but not
404 * necessarily zoned)
405 * @return ERR_OK if group was left on the netif(s), an err_t otherwise
406 */
407 err_t
408 mld6_leavegroup(const ip6_addr_t *srcaddr, const ip6_addr_t *groupaddr)
409 {
410 err_t err = ERR_VAL; /* no matching interface */
411 struct netif *netif;
412
413 LWIP_ASSERT_CORE_LOCKED();
414
415 /* loop through netif's */
416 #ifdef LOSCFG_NET_CONTAINER
417 NETIF_FOREACH(netif, get_root_net_group()) {
418 #else
419 NETIF_FOREACH(netif) {
420 #endif
421 /* Should we leave this interface ? */
422 if (ip6_addr_isany(srcaddr) ||
423 netif_get_ip6_addr_match(netif, srcaddr) >= 0) {
424 err_t res = mld6_leavegroup_netif(netif, groupaddr);
425 if (err != ERR_OK) {
426 /* Store this result if we have not yet gotten a success */
427 err = res;
428 }
429 }
430 }
431
432 return err;
433 }
434
435 /**
436 * @ingroup mld6
437 * Leave a group on a network interface.
438 *
439 * @param netif the network interface which should leave the group.
440 * @param groupaddr the ipv6 address of the group to leave (possibly, but not
441 * necessarily zoned)
442 * @return ERR_OK if group was left on the netif, an err_t otherwise
443 */
444 err_t
445 mld6_leavegroup_netif(struct netif *netif, const ip6_addr_t *groupaddr)
446 {
447 struct mld_group *group;
448 #if LWIP_IPV6_SCOPES
449 ip6_addr_t ip6addr;
450
451 if (ip6_addr_lacks_zone(groupaddr, IP6_MULTICAST)) {
452 ip6_addr_set(&ip6addr, groupaddr);
453 ip6_addr_assign_zone(&ip6addr, IP6_MULTICAST, netif);
454 groupaddr = &ip6addr;
455 }
456 IP6_ADDR_ZONECHECK_NETIF(groupaddr, netif);
457 #endif /* LWIP_IPV6_SCOPES */
458
459 LWIP_ASSERT_CORE_LOCKED();
460
461 /* find group */
462 group = mld6_lookfor_group(netif, groupaddr);
463
464 if (group != NULL) {
465 /* Leave if there is no other use of the group */
466 if (group->use <= 1) {
467 /* Remove the group from the list */
468 mld6_remove_group(netif, group);
469
470 /* If we are the last reporter for this group */
471 if (group->last_reporter_flag) {
472 MLD6_STATS_INC(mld6.tx_leave);
473 mld6_send(netif, group, ICMP6_TYPE_MLD);
474 }
475
476 /* Disable the group at the MAC level */
477 if (netif->mld_mac_filter != NULL) {
478 netif->mld_mac_filter(netif, groupaddr, NETIF_DEL_MAC_FILTER);
479 }
480
481 /* free group struct */
482 memp_free(MEMP_MLD6_GROUP, group);
483 } else {
484 /* Decrement group use */
485 group->use--;
486 }
487
488 /* Left group */
489 return ERR_OK;
490 }
491
492 /* Group not found */
493 return ERR_VAL;
494 }
495
496
497 /**
498 * Periodic timer for mld processing. Must be called every
499 * MLD6_TMR_INTERVAL milliseconds (100).
500 *
501 * When a delaying member expires, a membership report is sent.
502 */
503 void
504 mld6_tmr(void)
505 {
506 struct netif *netif;
507
508 #ifdef LOSCFG_NET_CONTAINER
509 NETIF_FOREACH(netif, get_root_net_group()) {
510 #else
511 NETIF_FOREACH(netif) {
512 #endif
513 struct mld_group *group = netif_mld6_data(netif);
514
515 while (group != NULL) {
516 if (group->timer > 0) {
517 group->timer--;
518 if (group->timer == 0) {
519 /* If the state is MLD6_GROUP_DELAYING_MEMBER then we send a report for this group */
520 if (group->group_state == MLD6_GROUP_DELAYING_MEMBER) {
521 MLD6_STATS_INC(mld6.tx_report);
522 mld6_send(netif, group, ICMP6_TYPE_MLR);
523 group->group_state = MLD6_GROUP_IDLE_MEMBER;
524 }
525 }
526 }
527 group = group->next;
528 }
529 }
530 }
531
532 #if LWIP_LOWPOWER
533 #include "lwip/lowpower.h"
534
535 u32_t
536 mld6_tmr_tick(void)
537 {
538 struct netif *netif = NULL;
539 u32_t tick = 0;
540
541 #ifdef LOSCFG_NET_CONTAINER
542 NETIF_FOREACH(netif, get_root_net_group())
543 #else
544 NETIF_FOREACH(netif)
545 #endif
546 {
547 struct mld_group *group = netif_mld6_data(netif);
548 while (group != NULL) {
549 if (group->timer > 0) {
550 SET_TMR_TICK(tick, group->timer);
551 }
552 group = group->next;
553 }
554 }
555
556 LWIP_DEBUGF(LOWPOWER_DEBUG, ("%s tmr tick: %u\n", "mld6_tmr_tick", tick));
557 return tick;
558 }
559 #endif
560
561 /**
562 * Schedule a delayed membership report for a group
563 *
564 * @param group the mld_group for which "delaying" membership report
565 * should be sent
566 * @param maxresp_in the max resp delay provided in the query
567 */
568 static void
569 mld6_delayed_report(struct mld_group *group, u16_t maxresp_in)
570 {
571 /* Convert maxresp from milliseconds to tmr ticks */
572 u16_t maxresp = maxresp_in / MLD6_TMR_INTERVAL;
573 if (maxresp == 0) {
574 maxresp = 1;
575 }
576
577 #ifdef LWIP_RAND
578 /* Randomize maxresp. (if LWIP_RAND is supported) */
579 maxresp = (u16_t)(LWIP_RAND() % maxresp);
580 if (maxresp == 0) {
581 maxresp = 1;
582 }
583 #endif /* LWIP_RAND */
584
585 /* Apply timer value if no report has been scheduled already. */
586 if ((group->group_state == MLD6_GROUP_IDLE_MEMBER) ||
587 ((group->group_state == MLD6_GROUP_DELAYING_MEMBER) &&
588 ((group->timer == 0) || (maxresp < group->timer)))) {
589 group->timer = maxresp;
590 group->group_state = MLD6_GROUP_DELAYING_MEMBER;
591 }
592 }
593
594 /**
595 * Send a MLD message (report or done).
596 *
597 * An IPv6 hop-by-hop options header with a router alert option
598 * is prepended.
599 *
600 * @param group the group to report or quit
601 * @param type ICMP6_TYPE_MLR (report) or ICMP6_TYPE_MLD (done)
602 */
603 static void
604 mld6_send(struct netif *netif, struct mld_group *group, u8_t type)
605 {
606 struct mld_header *mld_hdr;
607 struct pbuf *p;
608 const ip6_addr_t *src_addr;
609
610 /* Allocate a packet. Size is MLD header + IPv6 Hop-by-hop options header. */
611 p = pbuf_alloc(PBUF_IP, sizeof(struct mld_header) + MLD6_HBH_HLEN, PBUF_RAM);
612 if (p == NULL) {
613 MLD6_STATS_INC(mld6.memerr);
614 return;
615 }
616
617 /* Move to make room for Hop-by-hop options header. */
618 if (pbuf_remove_header(p, MLD6_HBH_HLEN)) {
619 pbuf_free(p);
620 MLD6_STATS_INC(mld6.lenerr);
621 return;
622 }
623
624 /* Select our source address. */
625 if (!ip6_addr_isvalid(netif_ip6_addr_state(netif, 0))) {
626 /* This is a special case, when we are performing duplicate address detection.
627 * We must join the multicast group, but we don't have a valid address yet. */
628 src_addr = IP6_ADDR_ANY6;
629 } else {
630 /* Use link-local address as source address. */
631 src_addr = netif_ip6_addr(netif, 0);
632 }
633
634 /* MLD message header pointer. */
635 mld_hdr = (struct mld_header *)p->payload;
636
637 /* Set fields. */
638 mld_hdr->type = type;
639 mld_hdr->code = 0;
640 mld_hdr->chksum = 0;
641 mld_hdr->max_resp_delay = 0;
642 mld_hdr->reserved = 0;
643 ip6_addr_copy_to_packed(mld_hdr->multicast_address, group->group_address);
644
645 #if CHECKSUM_GEN_ICMP6
646 IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_ICMP6) {
647 mld_hdr->chksum = ip6_chksum_pseudo(p, IP6_NEXTH_ICMP6, p->len,
648 src_addr, &(group->group_address));
649 }
650 #endif /* CHECKSUM_GEN_ICMP6 */
651
652 /* Add hop-by-hop headers options: router alert with MLD value. */
653 ip6_options_add_hbh_ra(p, IP6_NEXTH_ICMP6, IP6_ROUTER_ALERT_VALUE_MLD);
654
655 if (type == ICMP6_TYPE_MLR) {
656 /* Remember we were the last to report */
657 group->last_reporter_flag = 1;
658 }
659
660 /* Send the packet out. */
661 MLD6_STATS_INC(mld6.xmit);
662 ip6_output_if(p, (ip6_addr_isany(src_addr)) ? NULL : src_addr, &(group->group_address),
663 MLD6_HL, 0, IP6_NEXTH_HOPBYHOP, netif);
664 pbuf_free(p);
665 }
666
667 #endif /* LWIP_IPV6 */
668