Lines Matching +full:interface +full:- +full:node

1 // SPDX-License-Identifier: GPL-2.0
54 #include "hard-interface.h"
59 #include "translation-table.h"
65 * batadv_mcast_start_timer() - schedule the multicast periodic worker
66 * @bat_priv: the bat priv with all the mesh interface information
70 queue_delayed_work(batadv_event_workqueue, &bat_priv->mcast.work, in batadv_mcast_start_timer()
75 * batadv_mcast_get_bridge() - get the bridge on top of the meshif if it exists
76 * @mesh_iface: netdev struct of the mesh interface
78 * If the given mesh interface has a bridge on top then the refcount
100 * batadv_mcast_mla_rtr_flags_meshif_get_ipv4() - get mcast router flags from
101 * node for IPv4
102 * @dev: the interface to check
104 * Checks the presence of an IPv4 multicast router on this node.
121 * batadv_mcast_mla_rtr_flags_meshif_get_ipv6() - get mcast router flags from
122 * node for IPv6
123 * @dev: the interface to check
125 * Checks the presence of an IPv6 multicast router on this node.
136 if (in6_dev && atomic_read(&in6_dev->cnf.mc_forwarding)) in batadv_mcast_mla_rtr_flags_meshif_get_ipv6()
150 * batadv_mcast_mla_rtr_flags_meshif_get() - get mcast router flags from node
151 * @bat_priv: the bat priv with all the mesh interface information
152 * @bridge: bridge interface on top of the mesh_iface if present,
156 * node.
167 struct net_device *dev = bridge ? bridge : bat_priv->mesh_iface; in batadv_mcast_mla_rtr_flags_meshif_get()
181 * batadv_mcast_mla_rtr_flags_bridge_get() - get mcast router flags from bridge
182 * @bat_priv: the bat priv with all the mesh interface information
183 * @bridge: bridge interface on top of the mesh_iface if present,
197 struct net_device *dev = bat_priv->mesh_iface; in batadv_mcast_mla_rtr_flags_bridge_get()
212 * batadv_mcast_mla_rtr_flags_get() - get multicast router flags
213 * @bat_priv: the bat priv with all the mesh interface information
214 * @bridge: bridge interface on top of the mesh_iface if present,
218 * node or behind its bridge.
238 * batadv_mcast_mla_forw_flags_get() - get multicast forwarding flags
239 * @bat_priv: the bat priv with all the mesh interface information
252 if (hard_iface->if_status != BATADV_IF_ACTIVE) in batadv_mcast_mla_forw_flags_get()
255 if (hard_iface->mesh_iface != bat_priv->mesh_iface) in batadv_mcast_mla_forw_flags_get()
258 if (hard_iface->net_dev->mtu < IPV6_MIN_MTU) { in batadv_mcast_mla_forw_flags_get()
269 * batadv_mcast_mla_flags_get() - get the new multicast flags
270 * @bat_priv: the bat priv with all the mesh interface information
278 struct net_device *dev = bat_priv->mesh_iface; in batadv_mcast_mla_flags_get()
301 pr_warn_once("No bridge IGMP snooping compiled - multicast optimizations disabled\n"); in batadv_mcast_mla_flags_get()
303 qr4->exists = br_multicast_has_querier_anywhere(dev, ETH_P_IP); in batadv_mcast_mla_flags_get()
304 qr4->shadowing = br_multicast_has_querier_adjacent(dev, ETH_P_IP); in batadv_mcast_mla_flags_get()
306 qr6->exists = br_multicast_has_querier_anywhere(dev, ETH_P_IPV6); in batadv_mcast_mla_flags_get()
307 qr6->shadowing = br_multicast_has_querier_adjacent(dev, ETH_P_IPV6); in batadv_mcast_mla_flags_get()
320 if (!qr4->exists || qr4->shadowing) { in batadv_mcast_mla_flags_get()
325 if (!qr6->exists || qr6->shadowing) { in batadv_mcast_mla_flags_get()
334 * batadv_mcast_mla_is_duplicate() - check whether an address is in a list
347 if (batadv_compare_eth(mcast_entry->addr, mcast_addr)) in batadv_mcast_mla_is_duplicate()
354 * batadv_mcast_mla_meshif_get_ipv4() - get meshif IPv4 multicast listeners
360 * on this kernel on the given mesh interface, dev, in
362 * your multicast receiving applications run directly on this node.
364 * Return: -ENOMEM on memory allocation error or the number of
378 if (flags->tvlv_flags & BATADV_MCAST_WANT_ALL_IPV4) in batadv_mcast_mla_meshif_get_ipv4()
389 for (pmc = rcu_dereference(in_dev->mc_list); pmc; in batadv_mcast_mla_meshif_get_ipv4()
390 pmc = rcu_dereference(pmc->next_rcu)) { in batadv_mcast_mla_meshif_get_ipv4()
391 if (flags->tvlv_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES && in batadv_mcast_mla_meshif_get_ipv4()
392 ipv4_is_local_multicast(pmc->multiaddr)) in batadv_mcast_mla_meshif_get_ipv4()
395 if (!(flags->tvlv_flags & BATADV_MCAST_WANT_NO_RTR4) && in batadv_mcast_mla_meshif_get_ipv4()
396 !ipv4_is_local_multicast(pmc->multiaddr)) in batadv_mcast_mla_meshif_get_ipv4()
399 ip_eth_mc_map(pmc->multiaddr, mcast_addr); in batadv_mcast_mla_meshif_get_ipv4()
406 ret = -ENOMEM; in batadv_mcast_mla_meshif_get_ipv4()
410 ether_addr_copy(new->addr, mcast_addr); in batadv_mcast_mla_meshif_get_ipv4()
411 hlist_add_head(&new->list, mcast_list); in batadv_mcast_mla_meshif_get_ipv4()
420 * batadv_mcast_mla_meshif_get_ipv6() - get meshif IPv6 multicast listeners
426 * on this kernel on the given mesh interface, dev, in
428 * your multicast receiving applications run directly on this node.
430 * Return: -ENOMEM on memory allocation error or the number of
445 if (flags->tvlv_flags & BATADV_MCAST_WANT_ALL_IPV6) in batadv_mcast_mla_meshif_get_ipv6()
456 for (pmc6 = rcu_dereference(in6_dev->mc_list); in batadv_mcast_mla_meshif_get_ipv6()
458 pmc6 = rcu_dereference(pmc6->next)) { in batadv_mcast_mla_meshif_get_ipv6()
459 if (IPV6_ADDR_MC_SCOPE(&pmc6->mca_addr) < in batadv_mcast_mla_meshif_get_ipv6()
463 if (flags->tvlv_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES && in batadv_mcast_mla_meshif_get_ipv6()
464 ipv6_addr_is_ll_all_nodes(&pmc6->mca_addr)) in batadv_mcast_mla_meshif_get_ipv6()
467 if (!(flags->tvlv_flags & BATADV_MCAST_WANT_NO_RTR6) && in batadv_mcast_mla_meshif_get_ipv6()
468 IPV6_ADDR_MC_SCOPE(&pmc6->mca_addr) > in batadv_mcast_mla_meshif_get_ipv6()
472 ipv6_eth_mc_map(&pmc6->mca_addr, mcast_addr); in batadv_mcast_mla_meshif_get_ipv6()
479 ret = -ENOMEM; in batadv_mcast_mla_meshif_get_ipv6()
483 ether_addr_copy(new->addr, mcast_addr); in batadv_mcast_mla_meshif_get_ipv6()
484 hlist_add_head(&new->list, mcast_list); in batadv_mcast_mla_meshif_get_ipv6()
502 * batadv_mcast_mla_meshif_get() - get meshif multicast listeners
508 * on this kernel on the given mesh interface, dev, in
510 * your multicast receiving applications run directly on this node.
512 * If there is a bridge interface on top of dev, collect from that one
514 * will(/should) register to the bridge interface instead of an
517 * Return: -ENOMEM on memory allocation error or the number of
548 * batadv_mcast_mla_br_addr_cpy() - copy a bridge multicast address
549 * @dst: destination to write to - a multicast MAC address
550 * @src: source to read from - a multicast IP address
561 if (src->proto == htons(ETH_P_IP)) in batadv_mcast_mla_br_addr_cpy()
562 ip_eth_mc_map(src->dst.ip4, dst); in batadv_mcast_mla_br_addr_cpy()
564 else if (src->proto == htons(ETH_P_IPV6)) in batadv_mcast_mla_br_addr_cpy()
565 ipv6_eth_mc_map(&src->dst.ip6, dst); in batadv_mcast_mla_br_addr_cpy()
572 * batadv_mcast_mla_bridge_get() - get bridged-in multicast listeners
578 * on foreign, non-mesh devices which we gave access to our mesh via
579 * a bridge on top of the given mesh interface, dev, in the given
582 * Return: -ENOMEM on memory allocation error or the number of
591 u8 tvlv_flags = flags->tvlv_flags; in batadv_mcast_mla_bridge_get()
604 if (br_ip_entry->addr.proto == htons(ETH_P_IP)) { in batadv_mcast_mla_bridge_get()
609 ipv4_is_local_multicast(br_ip_entry->addr.dst.ip4)) in batadv_mcast_mla_bridge_get()
613 !ipv4_is_local_multicast(br_ip_entry->addr.dst.ip4)) in batadv_mcast_mla_bridge_get()
618 if (br_ip_entry->addr.proto == htons(ETH_P_IPV6)) { in batadv_mcast_mla_bridge_get()
623 ipv6_addr_is_ll_all_nodes(&br_ip_entry->addr.dst.ip6)) in batadv_mcast_mla_bridge_get()
627 IPV6_ADDR_MC_SCOPE(&br_ip_entry->addr.dst.ip6) > in batadv_mcast_mla_bridge_get()
633 batadv_mcast_mla_br_addr_cpy(mcast_addr, &br_ip_entry->addr); in batadv_mcast_mla_bridge_get()
639 ret = -ENOMEM; in batadv_mcast_mla_bridge_get()
643 ether_addr_copy(new->addr, mcast_addr); in batadv_mcast_mla_bridge_get()
644 hlist_add_head(&new->list, mcast_list); in batadv_mcast_mla_bridge_get()
649 list_del(&br_ip_entry->list); in batadv_mcast_mla_bridge_get()
657 * batadv_mcast_mla_list_free() - free a list of multicast addresses
668 hlist_del(&mcast_entry->list); in batadv_mcast_mla_list_free()
674 * batadv_mcast_mla_tt_retract() - clean up multicast listener announcements
675 * @bat_priv: the bat priv with all the mesh interface information
689 hlist_for_each_entry_safe(mcast_entry, tmp, &bat_priv->mcast.mla_list, in batadv_mcast_mla_tt_retract()
692 batadv_mcast_mla_is_duplicate(mcast_entry->addr, in batadv_mcast_mla_tt_retract()
696 batadv_tt_local_remove(bat_priv, mcast_entry->addr, in batadv_mcast_mla_tt_retract()
700 hlist_del(&mcast_entry->list); in batadv_mcast_mla_tt_retract()
706 * batadv_mcast_mla_tt_add() - add multicast listener announcements
707 * @bat_priv: the bat priv with all the mesh interface information
723 if (batadv_mcast_mla_is_duplicate(mcast_entry->addr, in batadv_mcast_mla_tt_add()
724 &bat_priv->mcast.mla_list)) in batadv_mcast_mla_tt_add()
727 if (!batadv_tt_local_add(bat_priv->mesh_iface, in batadv_mcast_mla_tt_add()
728 mcast_entry->addr, BATADV_NO_FLAGS, in batadv_mcast_mla_tt_add()
732 hlist_del(&mcast_entry->list); in batadv_mcast_mla_tt_add()
733 hlist_add_head(&mcast_entry->list, &bat_priv->mcast.mla_list); in batadv_mcast_mla_tt_add()
738 * batadv_mcast_querier_log() - debug output regarding the querier status on
740 * @bat_priv: the bat priv with all the mesh interface information
752 * forward listener reports to the querier, therefore batman-adv and
753 * the bridge will potentially not see these listeners - the querier is
757 * mesh interface.
764 if (!old_state->exists && new_state->exists) in batadv_mcast_querier_log()
765 batadv_info(bat_priv->mesh_iface, "%s Querier appeared\n", in batadv_mcast_querier_log()
767 else if (old_state->exists && !new_state->exists) in batadv_mcast_querier_log()
768 batadv_info(bat_priv->mesh_iface, in batadv_mcast_querier_log()
769 "%s Querier disappeared - multicast optimizations disabled\n", in batadv_mcast_querier_log()
771 else if (!bat_priv->mcast.mla_flags.bridged && !new_state->exists) in batadv_mcast_querier_log()
772 batadv_info(bat_priv->mesh_iface, in batadv_mcast_querier_log()
773 "No %s Querier present - multicast optimizations disabled\n", in batadv_mcast_querier_log()
776 if (new_state->exists) { in batadv_mcast_querier_log()
777 if ((!old_state->shadowing && new_state->shadowing) || in batadv_mcast_querier_log()
778 (!old_state->exists && new_state->shadowing)) in batadv_mcast_querier_log()
782 else if (old_state->shadowing && !new_state->shadowing) in batadv_mcast_querier_log()
790 * batadv_mcast_bridge_log() - debug output for topology changes in bridged
792 * @bat_priv: the bat priv with all the mesh interface information
795 * If no bridges are ever used on this node, then this function does nothing.
800 * More precisely, it outputs information when a bridge interface is added or
801 * removed from a mesh interface. And when a bridge is present, it further
803 * multicast flags this node is going to set.
809 struct batadv_mcast_mla_flags *old_flags = &bat_priv->mcast.mla_flags; in batadv_mcast_bridge_log()
811 if (!old_flags->bridged && new_flags->bridged) in batadv_mcast_bridge_log()
813 "Bridge added: Setting Unsnoopables(U)-flag\n"); in batadv_mcast_bridge_log()
814 else if (old_flags->bridged && !new_flags->bridged) in batadv_mcast_bridge_log()
816 "Bridge removed: Unsetting Unsnoopables(U)-flag\n"); in batadv_mcast_bridge_log()
818 if (new_flags->bridged) { in batadv_mcast_bridge_log()
820 &old_flags->querier_ipv4, in batadv_mcast_bridge_log()
821 &new_flags->querier_ipv4); in batadv_mcast_bridge_log()
823 &old_flags->querier_ipv6, in batadv_mcast_bridge_log()
824 &new_flags->querier_ipv6); in batadv_mcast_bridge_log()
829 * batadv_mcast_flags_log() - output debug information about mcast flag changes
830 * @bat_priv: the bat priv with all the mesh interface information
833 * Whenever the multicast TVLV flags this node announces change, this function
838 bool old_enabled = bat_priv->mcast.mla_flags.enabled; in batadv_mcast_flags_log()
839 u8 old_flags = bat_priv->mcast.mla_flags.tvlv_flags; in batadv_mcast_flags_log()
862 * batadv_mcast_mla_flags_update() - update multicast flags
863 * @bat_priv: the bat priv with all the mesh interface information
875 if (!memcmp(flags, &bat_priv->mcast.mla_flags, sizeof(*flags))) in batadv_mcast_mla_flags_update()
879 batadv_mcast_flags_log(bat_priv, flags->tvlv_flags); in batadv_mcast_mla_flags_update()
881 mcast_data.flags = flags->tvlv_flags; in batadv_mcast_mla_flags_update()
887 bat_priv->mcast.mla_flags = *flags; in batadv_mcast_mla_flags_update()
891 * __batadv_mcast_mla_update() - update the own MLAs
892 * @bat_priv: the bat priv with all the mesh interface information
897 * Note that non-conflicting reads and writes to bat_priv->mcast.mla_list
899 * ensured by the non-parallel execution of the worker this function
904 struct net_device *mesh_iface = bat_priv->mesh_iface; in __batadv_mcast_mla_update()
919 spin_lock(&bat_priv->mcast.mla_lock); in __batadv_mcast_mla_update()
923 spin_unlock(&bat_priv->mcast.mla_lock); in __batadv_mcast_mla_update()
930 * batadv_mcast_mla_update() - update the own MLAs
953 * batadv_mcast_is_report_ipv4() - check for IGMP reports
967 switch (igmp_hdr(skb)->type) { in batadv_mcast_is_report_ipv4()
978 * batadv_mcast_forw_mode_check_ipv4() - check for optimized forwarding
980 * @bat_priv: the bat priv with all the mesh interface information
988 * Return: If so then 0. Otherwise -EINVAL or -ENOMEM in case of memory
998 /* We might fail due to out-of-memory -> drop it */ in batadv_mcast_forw_mode_check_ipv4()
1000 return -ENOMEM; in batadv_mcast_forw_mode_check_ipv4()
1003 return -EINVAL; in batadv_mcast_forw_mode_check_ipv4()
1007 /* link-local multicast listeners behind a bridge are in batadv_mcast_forw_mode_check_ipv4()
1010 if (ipv4_is_local_multicast(iphdr->daddr)) in batadv_mcast_forw_mode_check_ipv4()
1019 * batadv_mcast_is_report_ipv6() - check for MLD reports
1033 switch (icmp6_hdr(skb)->icmp6_type) { in batadv_mcast_is_report_ipv6()
1043 * batadv_mcast_forw_mode_check_ipv6() - check for optimized forwarding
1045 * @bat_priv: the bat priv with all the mesh interface information
1053 * Return: If so then 0. Otherwise -EINVAL is or -ENOMEM if we are out of memory
1062 /* We might fail due to out-of-memory -> drop it */ in batadv_mcast_forw_mode_check_ipv6()
1064 return -ENOMEM; in batadv_mcast_forw_mode_check_ipv6()
1067 return -EINVAL; in batadv_mcast_forw_mode_check_ipv6()
1071 if (IPV6_ADDR_MC_SCOPE(&ip6hdr->daddr) < IPV6_ADDR_SCOPE_LINKLOCAL) in batadv_mcast_forw_mode_check_ipv6()
1072 return -EINVAL; in batadv_mcast_forw_mode_check_ipv6()
1074 /* link-local-all-nodes multicast listeners behind a bridge are in batadv_mcast_forw_mode_check_ipv6()
1077 if (ipv6_addr_is_ll_all_nodes(&ip6hdr->daddr)) in batadv_mcast_forw_mode_check_ipv6()
1079 else if (IPV6_ADDR_MC_SCOPE(&ip6hdr->daddr) > IPV6_ADDR_SCOPE_LINKLOCAL) in batadv_mcast_forw_mode_check_ipv6()
1086 * batadv_mcast_forw_mode_check() - check for optimized forwarding potential
1087 * @bat_priv: the bat priv with all the mesh interface information
1095 * Return: If so then 0. Otherwise -EINVAL is or -ENOMEM if we are out of memory
1104 if (!atomic_read(&bat_priv->multicast_mode)) in batadv_mcast_forw_mode_check()
1105 return -EINVAL; in batadv_mcast_forw_mode_check()
1107 switch (ntohs(ethhdr->h_proto)) { in batadv_mcast_forw_mode_check()
1114 return -EINVAL; in batadv_mcast_forw_mode_check()
1120 return -EINVAL; in batadv_mcast_forw_mode_check()
1125 * batadv_mcast_forw_want_all_ip_count() - count nodes with unspecific mcast
1127 * @bat_priv: the bat priv with all the mesh interface information
1137 switch (ntohs(ethhdr->h_proto)) { in batadv_mcast_forw_want_all_ip_count()
1139 return atomic_read(&bat_priv->mcast.num_want_all_ipv4); in batadv_mcast_forw_want_all_ip_count()
1141 return atomic_read(&bat_priv->mcast.num_want_all_ipv6); in batadv_mcast_forw_want_all_ip_count()
1149 * batadv_mcast_forw_rtr_count() - count nodes with a multicast router
1150 * @bat_priv: the bat priv with all the mesh interface information
1163 return atomic_read(&bat_priv->mcast.num_want_all_rtr4); in batadv_mcast_forw_rtr_count()
1165 return atomic_read(&bat_priv->mcast.num_want_all_rtr6); in batadv_mcast_forw_rtr_count()
1172 * batadv_mcast_forw_mode_by_count() - get forwarding mode by count
1173 * @bat_priv: the bat priv with all the mesh interface information
1181 * complete batman-adv multicast header.
1187 * would still fit into an 1280 bytes batman-adv multicast packet
1189 * the full batman-adv multicast packet header.
1190 * BATADV_FORW_UCASTS: If the packet cannot be sent in a batman-adv
1191 * multicast packet and the amount of batman-adv unicast packets needed
1201 u8 own_tvlv_flags = bat_priv->mcast.mla_flags.tvlv_flags; in batadv_mcast_forw_mode_by_count()
1203 if (!atomic_read(&bat_priv->mcast.num_no_mc_ptype_capa) && in batadv_mcast_forw_mode_by_count()
1205 skb->len + mcast_hdrlen <= IPV6_MIN_MTU && in batadv_mcast_forw_mode_by_count()
1209 if (count <= atomic_read(&bat_priv->multicast_fanout)) in batadv_mcast_forw_mode_by_count()
1216 * batadv_mcast_forw_mode() - check on how to forward a multicast packet
1217 * @bat_priv: the bat priv with all the mesh interface information
1235 if (ret == -ENOMEM) in batadv_mcast_forw_mode()
1242 tt_count = batadv_tt_global_hash_count(bat_priv, ethhdr->h_dest, in batadv_mcast_forw_mode()
1246 atomic_read(&bat_priv->mcast.num_want_all_unsnoopables); in batadv_mcast_forw_mode()
1261 * batadv_mcast_forw_send_orig() - send a multicast packet to an originator
1262 * @bat_priv: the bat priv with all the mesh interface information
1274 /* Avoid sending multicast-in-unicast packets to other BLA in batadv_mcast_forw_send_orig()
1275 * gateways - they already got the frame from the LAN side in batadv_mcast_forw_send_orig()
1280 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, vid)) { in batadv_mcast_forw_send_orig()
1290 * batadv_mcast_forw_tt() - forwards a packet to multicast listeners
1291 * @bat_priv: the bat priv with all the mesh interface information
1297 * via a batman-adv unicast packet for each such destination node.
1312 const u8 *addr = eth_hdr(skb)->h_dest; in batadv_mcast_forw_tt()
1319 hlist_for_each_entry_rcu(orig_entry, &tt_global->orig_list, list) { in batadv_mcast_forw_tt()
1327 orig_entry->orig_node); in batadv_mcast_forw_tt()
1338 * batadv_mcast_forw_want_all_ipv4() - forward to nodes with want-all-ipv4
1339 * @bat_priv: the bat priv with all the mesh interface information
1343 * Sends copies of a frame with multicast destination to any node with a
1345 * batman-adv unicast packet for each such destination node.
1360 &bat_priv->mcast.want_all_ipv4_list, in batadv_mcast_forw_want_all_ipv4()
1375 * batadv_mcast_forw_want_all_ipv6() - forward to nodes with want-all-ipv6
1376 * @bat_priv: the bat priv with all the mesh interface information
1380 * Sends copies of a frame with multicast destination to any node with a
1382 * batman-adv unicast packet for each such destination node.
1397 &bat_priv->mcast.want_all_ipv6_list, in batadv_mcast_forw_want_all_ipv6()
1412 * batadv_mcast_forw_want_all() - forward packet to nodes in a want-all list
1413 * @bat_priv: the bat priv with all the mesh interface information
1417 * Sends copies of a frame with multicast destination to any node with a
1419 * transmission is performed via a batman-adv unicast packet for each such
1420 * destination node.
1429 switch (ntohs(eth_hdr(skb)->h_proto)) { in batadv_mcast_forw_want_all()
1441 * batadv_mcast_forw_want_all_rtr4() - forward to nodes with want-all-rtr4
1442 * @bat_priv: the bat priv with all the mesh interface information
1446 * Sends copies of a frame with multicast destination to any node with a
1448 * batman-adv unicast packet for each such destination node.
1463 &bat_priv->mcast.want_all_rtr4_list, in batadv_mcast_forw_want_all_rtr4()
1478 * batadv_mcast_forw_want_all_rtr6() - forward to nodes with want-all-rtr6
1479 * @bat_priv: the bat priv with all the mesh interface information
1483 * Sends copies of a frame with multicast destination to any node with a
1485 * batman-adv unicast packet for each such destination node.
1500 &bat_priv->mcast.want_all_rtr6_list, in batadv_mcast_forw_want_all_rtr6()
1515 * batadv_mcast_forw_want_rtr() - forward packet to nodes in a want-all-rtr list
1516 * @bat_priv: the bat priv with all the mesh interface information
1520 * Sends copies of a frame with multicast destination to any node with a
1522 * transmission is performed via a batman-adv unicast packet for each such
1523 * destination node.
1532 switch (ntohs(eth_hdr(skb)->h_proto)) { in batadv_mcast_forw_want_rtr()
1544 * batadv_mcast_forw_send() - send packet to any detected multicast recipient
1545 * @bat_priv: the bat priv with all the mesh interface information
1550 * Sends copies of a frame with multicast destination to any node that signaled
1552 * want-all flags. A transmission is performed via a batman-adv unicast packet
1553 * for each such destination node.
1592 * batadv_mcast_want_unsnoop_update() - update unsnoop counter and list
1593 * @bat_priv: the bat priv with all the mesh interface information
1601 * Caller needs to hold orig->mcast_handler_lock.
1607 struct hlist_node *node = &orig->mcast_want_all_unsnoopables_node; in batadv_mcast_want_unsnoop_update() local
1608 struct hlist_head *head = &bat_priv->mcast.want_all_unsnoopables_list; in batadv_mcast_want_unsnoop_update()
1610 lockdep_assert_held(&orig->mcast_handler_lock); in batadv_mcast_want_unsnoop_update()
1614 !(orig->mcast_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES)) { in batadv_mcast_want_unsnoop_update()
1615 atomic_inc(&bat_priv->mcast.num_want_all_unsnoopables); in batadv_mcast_want_unsnoop_update()
1617 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
1619 WARN_ON(!hlist_unhashed(node)); in batadv_mcast_want_unsnoop_update()
1621 hlist_add_head_rcu(node, head); in batadv_mcast_want_unsnoop_update()
1622 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
1625 orig->mcast_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES) { in batadv_mcast_want_unsnoop_update()
1626 atomic_dec(&bat_priv->mcast.num_want_all_unsnoopables); in batadv_mcast_want_unsnoop_update()
1628 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
1630 WARN_ON(hlist_unhashed(node)); in batadv_mcast_want_unsnoop_update()
1632 hlist_del_init_rcu(node); in batadv_mcast_want_unsnoop_update()
1633 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
1638 * batadv_mcast_want_ipv4_update() - update want-all-ipv4 counter and list
1639 * @bat_priv: the bat priv with all the mesh interface information
1646 * Caller needs to hold orig->mcast_handler_lock.
1652 struct hlist_node *node = &orig->mcast_want_all_ipv4_node; in batadv_mcast_want_ipv4_update() local
1653 struct hlist_head *head = &bat_priv->mcast.want_all_ipv4_list; in batadv_mcast_want_ipv4_update()
1655 lockdep_assert_held(&orig->mcast_handler_lock); in batadv_mcast_want_ipv4_update()
1659 !(orig->mcast_flags & BATADV_MCAST_WANT_ALL_IPV4)) { in batadv_mcast_want_ipv4_update()
1660 atomic_inc(&bat_priv->mcast.num_want_all_ipv4); in batadv_mcast_want_ipv4_update()
1662 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
1664 WARN_ON(!hlist_unhashed(node)); in batadv_mcast_want_ipv4_update()
1666 hlist_add_head_rcu(node, head); in batadv_mcast_want_ipv4_update()
1667 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
1670 orig->mcast_flags & BATADV_MCAST_WANT_ALL_IPV4) { in batadv_mcast_want_ipv4_update()
1671 atomic_dec(&bat_priv->mcast.num_want_all_ipv4); in batadv_mcast_want_ipv4_update()
1673 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
1675 WARN_ON(hlist_unhashed(node)); in batadv_mcast_want_ipv4_update()
1677 hlist_del_init_rcu(node); in batadv_mcast_want_ipv4_update()
1678 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
1683 * batadv_mcast_want_ipv6_update() - update want-all-ipv6 counter and list
1684 * @bat_priv: the bat priv with all the mesh interface information
1691 * Caller needs to hold orig->mcast_handler_lock.
1697 struct hlist_node *node = &orig->mcast_want_all_ipv6_node; in batadv_mcast_want_ipv6_update() local
1698 struct hlist_head *head = &bat_priv->mcast.want_all_ipv6_list; in batadv_mcast_want_ipv6_update()
1700 lockdep_assert_held(&orig->mcast_handler_lock); in batadv_mcast_want_ipv6_update()
1704 !(orig->mcast_flags & BATADV_MCAST_WANT_ALL_IPV6)) { in batadv_mcast_want_ipv6_update()
1705 atomic_inc(&bat_priv->mcast.num_want_all_ipv6); in batadv_mcast_want_ipv6_update()
1707 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
1709 WARN_ON(!hlist_unhashed(node)); in batadv_mcast_want_ipv6_update()
1711 hlist_add_head_rcu(node, head); in batadv_mcast_want_ipv6_update()
1712 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
1715 orig->mcast_flags & BATADV_MCAST_WANT_ALL_IPV6) { in batadv_mcast_want_ipv6_update()
1716 atomic_dec(&bat_priv->mcast.num_want_all_ipv6); in batadv_mcast_want_ipv6_update()
1718 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
1720 WARN_ON(hlist_unhashed(node)); in batadv_mcast_want_ipv6_update()
1722 hlist_del_init_rcu(node); in batadv_mcast_want_ipv6_update()
1723 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
1728 * batadv_mcast_want_rtr4_update() - update want-all-rtr4 counter and list
1729 * @bat_priv: the bat priv with all the mesh interface information
1736 * Caller needs to hold orig->mcast_handler_lock.
1742 struct hlist_node *node = &orig->mcast_want_all_rtr4_node; in batadv_mcast_want_rtr4_update() local
1743 struct hlist_head *head = &bat_priv->mcast.want_all_rtr4_list; in batadv_mcast_want_rtr4_update()
1745 lockdep_assert_held(&orig->mcast_handler_lock); in batadv_mcast_want_rtr4_update()
1749 orig->mcast_flags & BATADV_MCAST_WANT_NO_RTR4) { in batadv_mcast_want_rtr4_update()
1750 atomic_inc(&bat_priv->mcast.num_want_all_rtr4); in batadv_mcast_want_rtr4_update()
1752 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_rtr4_update()
1754 WARN_ON(!hlist_unhashed(node)); in batadv_mcast_want_rtr4_update()
1756 hlist_add_head_rcu(node, head); in batadv_mcast_want_rtr4_update()
1757 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_rtr4_update()
1760 !(orig->mcast_flags & BATADV_MCAST_WANT_NO_RTR4)) { in batadv_mcast_want_rtr4_update()
1761 atomic_dec(&bat_priv->mcast.num_want_all_rtr4); in batadv_mcast_want_rtr4_update()
1763 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_rtr4_update()
1765 WARN_ON(hlist_unhashed(node)); in batadv_mcast_want_rtr4_update()
1767 hlist_del_init_rcu(node); in batadv_mcast_want_rtr4_update()
1768 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_rtr4_update()
1773 * batadv_mcast_want_rtr6_update() - update want-all-rtr6 counter and list
1774 * @bat_priv: the bat priv with all the mesh interface information
1781 * Caller needs to hold orig->mcast_handler_lock.
1787 struct hlist_node *node = &orig->mcast_want_all_rtr6_node; in batadv_mcast_want_rtr6_update() local
1788 struct hlist_head *head = &bat_priv->mcast.want_all_rtr6_list; in batadv_mcast_want_rtr6_update()
1790 lockdep_assert_held(&orig->mcast_handler_lock); in batadv_mcast_want_rtr6_update()
1794 orig->mcast_flags & BATADV_MCAST_WANT_NO_RTR6) { in batadv_mcast_want_rtr6_update()
1795 atomic_inc(&bat_priv->mcast.num_want_all_rtr6); in batadv_mcast_want_rtr6_update()
1797 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_rtr6_update()
1799 WARN_ON(!hlist_unhashed(node)); in batadv_mcast_want_rtr6_update()
1801 hlist_add_head_rcu(node, head); in batadv_mcast_want_rtr6_update()
1802 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_rtr6_update()
1805 !(orig->mcast_flags & BATADV_MCAST_WANT_NO_RTR6)) { in batadv_mcast_want_rtr6_update()
1806 atomic_dec(&bat_priv->mcast.num_want_all_rtr6); in batadv_mcast_want_rtr6_update()
1808 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_rtr6_update()
1810 WARN_ON(hlist_unhashed(node)); in batadv_mcast_want_rtr6_update()
1812 hlist_del_init_rcu(node); in batadv_mcast_want_rtr6_update()
1813 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_rtr6_update()
1818 * batadv_mcast_have_mc_ptype_update() - update multicast packet type counter
1819 * @bat_priv: the bat priv with all the mesh interface information
1830 lockdep_assert_held(&orig->mcast_handler_lock); in batadv_mcast_have_mc_ptype_update()
1834 orig->mcast_flags & BATADV_MCAST_HAVE_MC_PTYPE_CAPA) in batadv_mcast_have_mc_ptype_update()
1835 atomic_inc(&bat_priv->mcast.num_no_mc_ptype_capa); in batadv_mcast_have_mc_ptype_update()
1838 !(orig->mcast_flags & BATADV_MCAST_HAVE_MC_PTYPE_CAPA)) in batadv_mcast_have_mc_ptype_update()
1839 atomic_dec(&bat_priv->mcast.num_no_mc_ptype_capa); in batadv_mcast_have_mc_ptype_update()
1843 * batadv_mcast_tvlv_flags_get() - get multicast flags from an OGM TVLV
1874 * batadv_mcast_tvlv_ogm_handler() - process incoming multicast tvlv container
1875 * @bat_priv: the bat priv with all the mesh interface information
1893 spin_lock_bh(&orig->mcast_handler_lock); in batadv_mcast_tvlv_ogm_handler()
1896 !test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities)) { in batadv_mcast_tvlv_ogm_handler()
1897 set_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities); in batadv_mcast_tvlv_ogm_handler()
1899 test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities)) { in batadv_mcast_tvlv_ogm_handler()
1900 clear_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities); in batadv_mcast_tvlv_ogm_handler()
1903 set_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capa_initialized); in batadv_mcast_tvlv_ogm_handler()
1912 orig->mcast_flags = mcast_flags; in batadv_mcast_tvlv_ogm_handler()
1913 spin_unlock_bh(&orig->mcast_handler_lock); in batadv_mcast_tvlv_ogm_handler()
1917 * batadv_mcast_init() - initialize the multicast optimizations structures
1918 * @bat_priv: the bat priv with all the mesh interface information
1930 INIT_DELAYED_WORK(&bat_priv->mcast.work, batadv_mcast_mla_update); in batadv_mcast_init()
1935 * batadv_mcast_mesh_info_put() - put multicast info into a netlink message
1937 * @bat_priv: the bat priv with all the mesh interface information
1944 u32 flags = bat_priv->mcast.mla_flags.tvlv_flags; in batadv_mcast_mesh_info_put()
1947 if (bat_priv->mcast.mla_flags.bridged) { in batadv_mcast_mesh_info_put()
1950 if (bat_priv->mcast.mla_flags.querier_ipv4.exists) in batadv_mcast_mesh_info_put()
1952 if (bat_priv->mcast.mla_flags.querier_ipv6.exists) in batadv_mcast_mesh_info_put()
1954 if (bat_priv->mcast.mla_flags.querier_ipv4.shadowing) in batadv_mcast_mesh_info_put()
1956 if (bat_priv->mcast.mla_flags.querier_ipv6.shadowing) in batadv_mcast_mesh_info_put()
1962 return -EMSGSIZE; in batadv_mcast_mesh_info_put()
1968 * batadv_mcast_flags_dump_entry() - dump one entry of the multicast flags table
1984 hdr = genlmsg_put(msg, portid, cb->nlh->nlmsg_seq, in batadv_mcast_flags_dump_entry()
1988 return -ENOBUFS; in batadv_mcast_flags_dump_entry()
1993 orig_node->orig)) { in batadv_mcast_flags_dump_entry()
1995 return -EMSGSIZE; in batadv_mcast_flags_dump_entry()
1999 &orig_node->capabilities)) { in batadv_mcast_flags_dump_entry()
2001 orig_node->mcast_flags)) { in batadv_mcast_flags_dump_entry()
2003 return -EMSGSIZE; in batadv_mcast_flags_dump_entry()
2012 * batadv_mcast_flags_dump_bucket() - dump one bucket of the multicast flags
2032 spin_lock_bh(&hash->list_locks[bucket]); in batadv_mcast_flags_dump_bucket()
2033 cb->seq = atomic_read(&hash->generation) << 1 | 1; in batadv_mcast_flags_dump_bucket()
2035 hlist_for_each_entry(orig_node, &hash->table[bucket], hash_entry) { in batadv_mcast_flags_dump_bucket()
2037 &orig_node->capa_initialized)) in batadv_mcast_flags_dump_bucket()
2044 spin_unlock_bh(&hash->list_locks[bucket]); in batadv_mcast_flags_dump_bucket()
2047 return -EMSGSIZE; in batadv_mcast_flags_dump_bucket()
2053 spin_unlock_bh(&hash->list_locks[bucket]); in batadv_mcast_flags_dump_bucket()
2059 * __batadv_mcast_flags_dump() - dump multicast flags table to a netlink socket
2063 * @bat_priv: the bat priv with all the mesh interface information
2074 struct batadv_hashtable *hash = bat_priv->orig_hash; in __batadv_mcast_flags_dump()
2078 while (bucket_tmp < hash->size) { in __batadv_mcast_flags_dump()
2090 return msg->len; in __batadv_mcast_flags_dump()
2094 * batadv_mcast_netlink_get_primary() - get primary interface from netlink
2097 * @primary_if: the primary interface pointer to return the result in
2117 if (!hard_iface || hard_iface->if_status != BATADV_IF_ACTIVE) { in batadv_mcast_netlink_get_primary()
2118 ret = -ENOENT; in batadv_mcast_netlink_get_primary()
2134 * batadv_mcast_flags_dump() - dump multicast flags table to a netlink socket
2143 int portid = NETLINK_CB(cb->skb).portid; in batadv_mcast_flags_dump()
2145 long *bucket = &cb->args[0]; in batadv_mcast_flags_dump()
2146 long *idx = &cb->args[1]; in batadv_mcast_flags_dump()
2153 bat_priv = netdev_priv(primary_if->mesh_iface); in batadv_mcast_flags_dump()
2161 * batadv_mcast_free() - free the multicast optimizations structures
2162 * @bat_priv: the bat priv with all the mesh interface information
2166 cancel_delayed_work_sync(&bat_priv->mcast.work); in batadv_mcast_free()
2177 * batadv_mcast_purge_orig() - reset originator global mcast state modifications
2182 struct batadv_priv *bat_priv = orig->bat_priv; in batadv_mcast_purge_orig()
2184 spin_lock_bh(&orig->mcast_handler_lock); in batadv_mcast_purge_orig()
2196 spin_unlock_bh(&orig->mcast_handler_lock); in batadv_mcast_purge_orig()