Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
lwip_mld6.c
00001 /** 00002 * @file 00003 * Multicast listener discovery 00004 * 00005 * @defgroup mld6 MLD6 00006 * @ingroup ip6 00007 * Multicast listener discovery for IPv6. Aims to be compliant with RFC 2710. 00008 * No support for MLDv2.\n 00009 * Note: The allnodes (ff01::1, ff02::1) group is assumed be received by your 00010 * netif since it must always be received for correct IPv6 operation (e.g. SLAAC). 00011 * Ensure the netif filters are configured accordingly!\n 00012 * The netif flags also need NETIF_FLAG_MLD6 flag set to enable MLD6 on a 00013 * netif ("netif->flags |= NETIF_FLAG_MLD6;").\n 00014 * To be called from TCPIP thread. 00015 */ 00016 00017 /* 00018 * Copyright (c) 2010 Inico Technologies Ltd. 00019 * All rights reserved. 00020 * 00021 * Redistribution and use in source and binary forms, with or without modification, 00022 * are permitted provided that the following conditions are met: 00023 * 00024 * 1. Redistributions of source code must retain the above copyright notice, 00025 * this list of conditions and the following disclaimer. 00026 * 2. Redistributions in binary form must reproduce the above copyright notice, 00027 * this list of conditions and the following disclaimer in the documentation 00028 * and/or other materials provided with the distribution. 00029 * 3. The name of the author may not be used to endorse or promote products 00030 * derived from this software without specific prior written permission. 00031 * 00032 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00033 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00034 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00035 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00036 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00037 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00038 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00039 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00040 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00041 * OF SUCH DAMAGE. 00042 * 00043 * This file is part of the lwIP TCP/IP stack. 00044 * 00045 * Author: Ivan Delamer <delamer@inicotech.com> 00046 * 00047 * 00048 * Please coordinate changes and requests with Ivan Delamer 00049 * <delamer@inicotech.com> 00050 */ 00051 00052 /* Based on igmp.c implementation of igmp v2 protocol */ 00053 00054 #include "lwip/opt.h" 00055 00056 #if LWIP_IPV6 && LWIP_IPV6_MLD /* don't build if not configured for use in lwipopts.h */ 00057 00058 #include "lwip/mld6.h" 00059 #include "lwip/prot/mld6.h" 00060 #include "lwip/icmp6.h" 00061 #include "lwip/ip6.h" 00062 #include "lwip/ip6_addr.h" 00063 #include "lwip/ip.h" 00064 #include "lwip/inet_chksum.h" 00065 #include "lwip/pbuf.h" 00066 #include "lwip/netif.h" 00067 #include "lwip/memp.h" 00068 #include "lwip/stats.h" 00069 00070 #include <string.h> 00071 00072 00073 /* 00074 * MLD constants 00075 */ 00076 #define MLD6_HL 1 00077 #define MLD6_JOIN_DELAYING_MEMBER_TMR_MS (500) 00078 00079 #define MLD6_GROUP_NON_MEMBER 0 00080 #define MLD6_GROUP_DELAYING_MEMBER 1 00081 #define MLD6_GROUP_IDLE_MEMBER 2 00082 00083 /* Forward declarations. */ 00084 static struct mld_group *mld6_new_group(struct netif *ifp, const ip6_addr_t *addr); 00085 static err_t mld6_remove_group(struct netif *netif, struct mld_group *group); 00086 static void mld6_delayed_report(struct mld_group *group, u16_t maxresp); 00087 static void mld6_send(struct netif *netif, struct mld_group *group, u8_t type); 00088 00089 00090 /** 00091 * Stop MLD processing on interface 00092 * 00093 * @param netif network interface on which stop MLD processing 00094 */ 00095 err_t 00096 mld6_stop(struct netif *netif) 00097 { 00098 struct mld_group *group = netif_mld6_data(netif); 00099 00100 netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_MLD6, NULL); 00101 00102 while (group != NULL) { 00103 struct mld_group *next = group->next; /* avoid use-after-free below */ 00104 00105 /* disable the group at the MAC level */ 00106 if (netif->mld_mac_filter != NULL) { 00107 netif->mld_mac_filter(netif, &(group->group_address), NETIF_DEL_MAC_FILTER); 00108 } 00109 00110 /* free group */ 00111 memp_free(MEMP_MLD6_GROUP, group); 00112 00113 /* move to "next" */ 00114 group = next; 00115 } 00116 return ERR_OK; 00117 } 00118 00119 /** 00120 * Report MLD memberships for this interface 00121 * 00122 * @param netif network interface on which report MLD memberships 00123 */ 00124 void 00125 mld6_report_groups(struct netif *netif) 00126 { 00127 struct mld_group *group = netif_mld6_data(netif); 00128 00129 while (group != NULL) { 00130 mld6_delayed_report(group, MLD6_JOIN_DELAYING_MEMBER_TMR_MS); 00131 group = group->next; 00132 } 00133 } 00134 00135 /** 00136 * Search for a group that is joined on a netif 00137 * 00138 * @param ifp the network interface for which to look 00139 * @param addr the group ipv6 address to search for 00140 * @return a struct mld_group* if the group has been found, 00141 * NULL if the group wasn't found. 00142 */ 00143 struct mld_group * 00144 mld6_lookfor_group(struct netif *ifp, const ip6_addr_t *addr) 00145 { 00146 struct mld_group *group = netif_mld6_data(ifp); 00147 00148 while (group != NULL) { 00149 if (ip6_addr_cmp(&(group->group_address), addr)) { 00150 return group; 00151 } 00152 group = group->next; 00153 } 00154 00155 return NULL; 00156 } 00157 00158 00159 /** 00160 * create a new group 00161 * 00162 * @param ifp the network interface for which to create 00163 * @param addr the new group ipv6 00164 * @return a struct mld_group*, 00165 * NULL on memory error. 00166 */ 00167 static struct mld_group * 00168 mld6_new_group(struct netif *ifp, const ip6_addr_t *addr) 00169 { 00170 struct mld_group *group; 00171 00172 group = (struct mld_group *)memp_malloc(MEMP_MLD6_GROUP); 00173 if (group != NULL) { 00174 ip6_addr_set(&(group->group_address), addr); 00175 group->timer = 0; /* Not running */ 00176 group->group_state = MLD6_GROUP_IDLE_MEMBER; 00177 group->last_reporter_flag = 0; 00178 group->use = 0; 00179 group->next = netif_mld6_data(ifp); 00180 00181 netif_set_client_data(ifp, LWIP_NETIF_CLIENT_DATA_INDEX_MLD6, group); 00182 } 00183 00184 return group; 00185 } 00186 00187 /** 00188 * Remove a group from the mld_group_list, but do not free it yet 00189 * 00190 * @param group the group to remove 00191 * @return ERR_OK if group was removed from the list, an err_t otherwise 00192 */ 00193 static err_t 00194 mld6_remove_group(struct netif *netif, struct mld_group *group) 00195 { 00196 err_t err = ERR_OK; 00197 00198 /* Is it the first group? */ 00199 if (netif_mld6_data(netif) == group) { 00200 netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_MLD6, group->next); 00201 } else { 00202 /* look for group further down the list */ 00203 struct mld_group *tmpGroup; 00204 for (tmpGroup = netif_mld6_data(netif); tmpGroup != NULL; tmpGroup = tmpGroup->next) { 00205 if (tmpGroup->next == group) { 00206 tmpGroup->next = group->next; 00207 break; 00208 } 00209 } 00210 /* Group not find group */ 00211 if (tmpGroup == NULL) { 00212 err = ERR_ARG; 00213 } 00214 } 00215 00216 return err; 00217 } 00218 00219 00220 /** 00221 * Process an input MLD message. Called by icmp6_input. 00222 * 00223 * @param p the mld packet, p->payload pointing to the icmpv6 header 00224 * @param inp the netif on which this packet was received 00225 */ 00226 void 00227 mld6_input(struct pbuf *p, struct netif *inp) 00228 { 00229 struct mld_header *mld_hdr; 00230 struct mld_group *group; 00231 00232 MLD6_STATS_INC(mld6.recv); 00233 00234 /* Check that mld header fits in packet. */ 00235 if (p->len < sizeof(struct mld_header)) { 00236 /* @todo debug message */ 00237 pbuf_free(p); 00238 MLD6_STATS_INC(mld6.lenerr); 00239 MLD6_STATS_INC(mld6.drop); 00240 return; 00241 } 00242 00243 mld_hdr = (struct mld_header *)p->payload; 00244 00245 switch (mld_hdr->type) { 00246 case ICMP6_TYPE_MLQ: /* Multicast listener query. */ 00247 /* Is it a general query? */ 00248 if (ip6_addr_isallnodes_linklocal(ip6_current_dest_addr()) && 00249 ip6_addr_isany(&(mld_hdr->multicast_address))) { 00250 MLD6_STATS_INC(mld6.rx_general); 00251 /* Report all groups, except all nodes group, and if-local groups. */ 00252 group = netif_mld6_data(inp); 00253 while (group != NULL) { 00254 if ((!(ip6_addr_ismulticast_iflocal(&(group->group_address)))) && 00255 (!(ip6_addr_isallnodes_linklocal(&(group->group_address))))) { 00256 mld6_delayed_report(group, mld_hdr->max_resp_delay); 00257 } 00258 group = group->next; 00259 } 00260 } else { 00261 /* Have we joined this group? 00262 * We use IP6 destination address to have a memory aligned copy. 00263 * mld_hdr->multicast_address should be the same. */ 00264 MLD6_STATS_INC(mld6.rx_group); 00265 group = mld6_lookfor_group(inp, ip6_current_dest_addr()); 00266 if (group != NULL) { 00267 /* Schedule a report. */ 00268 mld6_delayed_report(group, mld_hdr->max_resp_delay); 00269 } 00270 } 00271 break; /* ICMP6_TYPE_MLQ */ 00272 case ICMP6_TYPE_MLR: /* Multicast listener report. */ 00273 /* Have we joined this group? 00274 * We use IP6 destination address to have a memory aligned copy. 00275 * mld_hdr->multicast_address should be the same. */ 00276 MLD6_STATS_INC(mld6.rx_report); 00277 group = mld6_lookfor_group(inp, ip6_current_dest_addr()); 00278 if (group != NULL) { 00279 /* If we are waiting to report, cancel it. */ 00280 if (group->group_state == MLD6_GROUP_DELAYING_MEMBER) { 00281 group->timer = 0; /* stopped */ 00282 group->group_state = MLD6_GROUP_IDLE_MEMBER; 00283 group->last_reporter_flag = 0; 00284 } 00285 } 00286 break; /* ICMP6_TYPE_MLR */ 00287 case ICMP6_TYPE_MLD: /* Multicast listener done. */ 00288 /* Do nothing, router will query us. */ 00289 break; /* ICMP6_TYPE_MLD */ 00290 default: 00291 MLD6_STATS_INC(mld6.proterr); 00292 MLD6_STATS_INC(mld6.drop); 00293 break; 00294 } 00295 00296 pbuf_free(p); 00297 } 00298 00299 /** 00300 * @ingroup mld6 00301 * Join a group on one or all network interfaces. 00302 * 00303 * If the group is to be joined on all interfaces, the given group address must 00304 * not have a zone set (i.e., it must have its zone index set to IP6_NO_ZONE). 00305 * If the group is to be joined on one particular interface, the given group 00306 * address may or may not have a zone set. 00307 * 00308 * @param srcaddr ipv6 address (zoned) of the network interface which should 00309 * join a new group. If IP6_ADDR_ANY6, join on all netifs 00310 * @param groupaddr the ipv6 address of the group to join (possibly but not 00311 * necessarily zoned) 00312 * @return ERR_OK if group was joined on the netif(s), an err_t otherwise 00313 */ 00314 err_t 00315 mld6_joingroup(const ip6_addr_t *srcaddr, const ip6_addr_t *groupaddr) 00316 { 00317 err_t err = ERR_VAL; /* no matching interface */ 00318 struct netif *netif; 00319 00320 LWIP_ASSERT_CORE_LOCKED(); 00321 00322 /* loop through netif's */ 00323 NETIF_FOREACH(netif) { 00324 /* Should we join this interface ? */ 00325 if (ip6_addr_isany(srcaddr) || 00326 netif_get_ip6_addr_match(netif, srcaddr) >= 0) { 00327 err = mld6_joingroup_netif(netif, groupaddr); 00328 if (err != ERR_OK) { 00329 return err; 00330 } 00331 } 00332 } 00333 00334 return err; 00335 } 00336 00337 /** 00338 * @ingroup mld6 00339 * Join a group on a network interface. 00340 * 00341 * @param netif the network interface which should join a new group. 00342 * @param groupaddr the ipv6 address of the group to join (possibly but not 00343 * necessarily zoned) 00344 * @return ERR_OK if group was joined on the netif, an err_t otherwise 00345 */ 00346 err_t 00347 mld6_joingroup_netif(struct netif *netif, const ip6_addr_t *groupaddr) 00348 { 00349 struct mld_group *group; 00350 #if LWIP_IPV6_SCOPES 00351 ip6_addr_t ip6addr; 00352 00353 /* If the address has a particular scope but no zone set, use the netif to 00354 * set one now. Within the mld6 module, all addresses are properly zoned. */ 00355 if (ip6_addr_lacks_zone(groupaddr, IP6_MULTICAST)) { 00356 ip6_addr_set(&ip6addr, groupaddr); 00357 ip6_addr_assign_zone(&ip6addr, IP6_MULTICAST, netif); 00358 groupaddr = &ip6addr; 00359 } 00360 IP6_ADDR_ZONECHECK_NETIF(groupaddr, netif); 00361 #endif /* LWIP_IPV6_SCOPES */ 00362 00363 LWIP_ASSERT_CORE_LOCKED(); 00364 00365 /* find group or create a new one if not found */ 00366 group = mld6_lookfor_group(netif, groupaddr); 00367 00368 if (group == NULL) { 00369 /* Joining a new group. Create a new group entry. */ 00370 group = mld6_new_group(netif, groupaddr); 00371 if (group == NULL) { 00372 return ERR_MEM; 00373 } 00374 00375 /* Activate this address on the MAC layer. */ 00376 if (netif->mld_mac_filter != NULL) { 00377 netif->mld_mac_filter(netif, groupaddr, NETIF_ADD_MAC_FILTER); 00378 } 00379 00380 /* Report our membership. */ 00381 MLD6_STATS_INC(mld6.tx_report); 00382 mld6_send(netif, group, ICMP6_TYPE_MLR); 00383 mld6_delayed_report(group, MLD6_JOIN_DELAYING_MEMBER_TMR_MS); 00384 } 00385 00386 /* Increment group use */ 00387 group->use++; 00388 return ERR_OK; 00389 } 00390 00391 /** 00392 * @ingroup mld6 00393 * Leave a group on a network interface. 00394 * 00395 * Zoning of address follows the same rules as @ref mld6_joingroup. 00396 * 00397 * @param srcaddr ipv6 address (zoned) of the network interface which should 00398 * leave the group. If IP6_ADDR_ANY6, leave on all netifs 00399 * @param groupaddr the ipv6 address of the group to leave (possibly, but not 00400 * necessarily zoned) 00401 * @return ERR_OK if group was left on the netif(s), an err_t otherwise 00402 */ 00403 err_t 00404 mld6_leavegroup(const ip6_addr_t *srcaddr, const ip6_addr_t *groupaddr) 00405 { 00406 err_t err = ERR_VAL; /* no matching interface */ 00407 struct netif *netif; 00408 00409 LWIP_ASSERT_CORE_LOCKED(); 00410 00411 /* loop through netif's */ 00412 NETIF_FOREACH(netif) { 00413 /* Should we leave this interface ? */ 00414 if (ip6_addr_isany(srcaddr) || 00415 netif_get_ip6_addr_match(netif, srcaddr) >= 0) { 00416 err_t res = mld6_leavegroup_netif(netif, groupaddr); 00417 if (err != ERR_OK) { 00418 /* Store this result if we have not yet gotten a success */ 00419 err = res; 00420 } 00421 } 00422 } 00423 00424 return err; 00425 } 00426 00427 /** 00428 * @ingroup mld6 00429 * Leave a group on a network interface. 00430 * 00431 * @param netif the network interface which should leave the group. 00432 * @param groupaddr the ipv6 address of the group to leave (possibly, but not 00433 * necessarily zoned) 00434 * @return ERR_OK if group was left on the netif, an err_t otherwise 00435 */ 00436 err_t 00437 mld6_leavegroup_netif(struct netif *netif, const ip6_addr_t *groupaddr) 00438 { 00439 struct mld_group *group; 00440 #if LWIP_IPV6_SCOPES 00441 ip6_addr_t ip6addr; 00442 00443 if (ip6_addr_lacks_zone(groupaddr, IP6_MULTICAST)) { 00444 ip6_addr_set(&ip6addr, groupaddr); 00445 ip6_addr_assign_zone(&ip6addr, IP6_MULTICAST, netif); 00446 groupaddr = &ip6addr; 00447 } 00448 IP6_ADDR_ZONECHECK_NETIF(groupaddr, netif); 00449 #endif /* LWIP_IPV6_SCOPES */ 00450 00451 LWIP_ASSERT_CORE_LOCKED(); 00452 00453 /* find group */ 00454 group = mld6_lookfor_group(netif, groupaddr); 00455 00456 if (group != NULL) { 00457 /* Leave if there is no other use of the group */ 00458 if (group->use <= 1) { 00459 /* Remove the group from the list */ 00460 mld6_remove_group(netif, group); 00461 00462 /* If we are the last reporter for this group */ 00463 if (group->last_reporter_flag) { 00464 MLD6_STATS_INC(mld6.tx_leave); 00465 mld6_send(netif, group, ICMP6_TYPE_MLD); 00466 } 00467 00468 /* Disable the group at the MAC level */ 00469 if (netif->mld_mac_filter != NULL) { 00470 netif->mld_mac_filter(netif, groupaddr, NETIF_DEL_MAC_FILTER); 00471 } 00472 00473 /* free group struct */ 00474 memp_free(MEMP_MLD6_GROUP, group); 00475 } else { 00476 /* Decrement group use */ 00477 group->use--; 00478 } 00479 00480 /* Left group */ 00481 return ERR_OK; 00482 } 00483 00484 /* Group not found */ 00485 return ERR_VAL; 00486 } 00487 00488 00489 /** 00490 * Periodic timer for mld processing. Must be called every 00491 * MLD6_TMR_INTERVAL milliseconds (100). 00492 * 00493 * When a delaying member expires, a membership report is sent. 00494 */ 00495 void 00496 mld6_tmr(void) 00497 { 00498 struct netif *netif; 00499 00500 NETIF_FOREACH(netif) { 00501 struct mld_group *group = netif_mld6_data(netif); 00502 00503 while (group != NULL) { 00504 if (group->timer > 0) { 00505 group->timer--; 00506 if (group->timer == 0) { 00507 /* If the state is MLD6_GROUP_DELAYING_MEMBER then we send a report for this group */ 00508 if (group->group_state == MLD6_GROUP_DELAYING_MEMBER) { 00509 MLD6_STATS_INC(mld6.tx_report); 00510 mld6_send(netif, group, ICMP6_TYPE_MLR); 00511 group->group_state = MLD6_GROUP_IDLE_MEMBER; 00512 } 00513 } 00514 } 00515 group = group->next; 00516 } 00517 } 00518 } 00519 00520 /** 00521 * Schedule a delayed membership report for a group 00522 * 00523 * @param group the mld_group for which "delaying" membership report 00524 * should be sent 00525 * @param maxresp_in the max resp delay provided in the query 00526 */ 00527 static void 00528 mld6_delayed_report(struct mld_group *group, u16_t maxresp_in) 00529 { 00530 /* Convert maxresp from milliseconds to tmr ticks */ 00531 u16_t maxresp = maxresp_in / MLD6_TMR_INTERVAL; 00532 if (maxresp == 0) { 00533 maxresp = 1; 00534 } 00535 00536 #ifdef LWIP_RAND 00537 /* Randomize maxresp. (if LWIP_RAND is supported) */ 00538 maxresp = (u16_t)(LWIP_RAND() % maxresp); 00539 if (maxresp == 0) { 00540 maxresp = 1; 00541 } 00542 #endif /* LWIP_RAND */ 00543 00544 /* Apply timer value if no report has been scheduled already. */ 00545 if ((group->group_state == MLD6_GROUP_IDLE_MEMBER) || 00546 ((group->group_state == MLD6_GROUP_DELAYING_MEMBER) && 00547 ((group->timer == 0) || (maxresp < group->timer)))) { 00548 group->timer = maxresp; 00549 group->group_state = MLD6_GROUP_DELAYING_MEMBER; 00550 } 00551 } 00552 00553 /** 00554 * Send a MLD message (report or done). 00555 * 00556 * An IPv6 hop-by-hop options header with a router alert option 00557 * is prepended. 00558 * 00559 * @param group the group to report or quit 00560 * @param type ICMP6_TYPE_MLR (report) or ICMP6_TYPE_MLD (done) 00561 */ 00562 static void 00563 mld6_send(struct netif *netif, struct mld_group *group, u8_t type) 00564 { 00565 struct mld_header *mld_hdr; 00566 struct pbuf *p; 00567 const ip6_addr_t *src_addr; 00568 00569 /* Allocate a packet. Size is MLD header + IPv6 Hop-by-hop options header. */ 00570 p = pbuf_alloc(PBUF_IP, sizeof(struct mld_header) + MLD6_HBH_HLEN, PBUF_RAM); 00571 if (p == NULL) { 00572 MLD6_STATS_INC(mld6.memerr); 00573 return; 00574 } 00575 00576 /* Move to make room for Hop-by-hop options header. */ 00577 if (pbuf_remove_header(p, MLD6_HBH_HLEN)) { 00578 pbuf_free(p); 00579 MLD6_STATS_INC(mld6.lenerr); 00580 return; 00581 } 00582 00583 /* Select our source address. */ 00584 if (!ip6_addr_isvalid(netif_ip6_addr_state(netif, 0))) { 00585 /* This is a special case, when we are performing duplicate address detection. 00586 * We must join the multicast group, but we don't have a valid address yet. */ 00587 src_addr = IP6_ADDR_ANY6; 00588 } else { 00589 /* Use link-local address as source address. */ 00590 src_addr = netif_ip6_addr(netif, 0); 00591 } 00592 00593 /* MLD message header pointer. */ 00594 mld_hdr = (struct mld_header *)p->payload; 00595 00596 /* Set fields. */ 00597 mld_hdr->type = type; 00598 mld_hdr->code = 0; 00599 mld_hdr->chksum = 0; 00600 mld_hdr->max_resp_delay = 0; 00601 mld_hdr->reserved = 0; 00602 ip6_addr_copy_to_packed(mld_hdr->multicast_address, group->group_address); 00603 00604 #if CHECKSUM_GEN_ICMP6 00605 IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_ICMP6) { 00606 mld_hdr->chksum = ip6_chksum_pseudo(p, IP6_NEXTH_ICMP6, p->len, 00607 src_addr, &(group->group_address)); 00608 } 00609 #endif /* CHECKSUM_GEN_ICMP6 */ 00610 00611 /* Add hop-by-hop headers options: router alert with MLD value. */ 00612 ip6_options_add_hbh_ra(p, IP6_NEXTH_ICMP6, IP6_ROUTER_ALERT_VALUE_MLD); 00613 00614 if (type == ICMP6_TYPE_MLR) { 00615 /* Remember we were the last to report */ 00616 group->last_reporter_flag = 1; 00617 } 00618 00619 /* Send the packet out. */ 00620 MLD6_STATS_INC(mld6.xmit); 00621 ip6_output_if(p, (ip6_addr_isany(src_addr)) ? NULL : src_addr, &(group->group_address), 00622 MLD6_HL, 0, IP6_NEXTH_HOPBYHOP, netif); 00623 pbuf_free(p); 00624 } 00625 00626 #endif /* LWIP_IPV6 */
Generated on Tue Jul 12 2022 13:54:29 by
1.7.2