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

1 // SPDX-License-Identifier: GPL-2.0
54 #include "hard-interface.h"
59 #include "soft-interface.h"
60 #include "translation-table.h"
66 * batadv_mcast_start_timer() - schedule the multicast periodic worker
67 * @bat_priv: the bat priv with all the soft interface information
71 queue_delayed_work(batadv_event_workqueue, &bat_priv->mcast.work, in batadv_mcast_start_timer()
76 * batadv_mcast_get_bridge() - get the bridge on top of the softif if it exists
77 * @soft_iface: netdev struct of the mesh interface
79 * If the given soft interface has a bridge on top then the refcount
92 } while (upper && !(upper->priv_flags & IFF_EBRIDGE)); in batadv_mcast_get_bridge()
101 * batadv_mcast_mla_rtr_flags_softif_get_ipv4() - get mcast router flags from
102 * node for IPv4
103 * @dev: the interface to check
105 * Checks the presence of an IPv4 multicast router on this node.
122 * batadv_mcast_mla_rtr_flags_softif_get_ipv6() - get mcast router flags from
123 * node for IPv6
124 * @dev: the interface to check
126 * Checks the presence of an IPv6 multicast router on this node.
137 if (in6_dev && in6_dev->cnf.mc_forwarding) in batadv_mcast_mla_rtr_flags_softif_get_ipv6()
151 * batadv_mcast_mla_rtr_flags_softif_get() - get mcast router flags from node
152 * @bat_priv: the bat priv with all the soft interface information
153 * @bridge: bridge interface on top of the soft_iface if present,
157 * node.
168 struct net_device *dev = bridge ? bridge : bat_priv->soft_iface; in batadv_mcast_mla_rtr_flags_softif_get()
182 * batadv_mcast_mla_rtr_flags_bridge_get() - get mcast router flags from bridge
183 * @bat_priv: the bat priv with all the soft interface information
184 * @bridge: bridge interface on top of the soft_iface if present,
198 struct net_device *dev = bat_priv->soft_iface; in batadv_mcast_mla_rtr_flags_bridge_get()
213 * batadv_mcast_mla_rtr_flags_get() - get multicast router flags
214 * @bat_priv: the bat priv with all the soft interface information
215 * @bridge: bridge interface on top of the soft_iface if present,
219 * node or behind its bridge.
239 * batadv_mcast_mla_flags_get() - get the new multicast flags
240 * @bat_priv: the bat priv with all the soft interface information
248 struct net_device *dev = bat_priv->soft_iface; in batadv_mcast_mla_flags_get()
270 pr_warn_once("No bridge IGMP snooping compiled - multicast optimizations disabled\n"); in batadv_mcast_mla_flags_get()
272 qr4->exists = br_multicast_has_querier_anywhere(dev, ETH_P_IP); in batadv_mcast_mla_flags_get()
273 qr4->shadowing = br_multicast_has_querier_adjacent(dev, ETH_P_IP); in batadv_mcast_mla_flags_get()
275 qr6->exists = br_multicast_has_querier_anywhere(dev, ETH_P_IPV6); in batadv_mcast_mla_flags_get()
276 qr6->shadowing = br_multicast_has_querier_adjacent(dev, ETH_P_IPV6); in batadv_mcast_mla_flags_get()
289 if (!qr4->exists || qr4->shadowing) { in batadv_mcast_mla_flags_get()
294 if (!qr6->exists || qr6->shadowing) { in batadv_mcast_mla_flags_get()
303 * batadv_mcast_mla_is_duplicate() - check whether an address is in a list
316 if (batadv_compare_eth(mcast_entry->addr, mcast_addr)) in batadv_mcast_mla_is_duplicate()
323 * batadv_mcast_mla_softif_get_ipv4() - get softif IPv4 multicast listeners
329 * on this kernel on the given soft interface, dev, in
331 * your multicast receiving applications run directly on this node.
333 * Return: -ENOMEM on memory allocation error or the number of
347 if (flags->tvlv_flags & BATADV_MCAST_WANT_ALL_IPV4) in batadv_mcast_mla_softif_get_ipv4()
358 for (pmc = rcu_dereference(in_dev->mc_list); pmc; in batadv_mcast_mla_softif_get_ipv4()
359 pmc = rcu_dereference(pmc->next_rcu)) { in batadv_mcast_mla_softif_get_ipv4()
360 if (flags->tvlv_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES && in batadv_mcast_mla_softif_get_ipv4()
361 ipv4_is_local_multicast(pmc->multiaddr)) in batadv_mcast_mla_softif_get_ipv4()
364 if (!(flags->tvlv_flags & BATADV_MCAST_WANT_NO_RTR4) && in batadv_mcast_mla_softif_get_ipv4()
365 !ipv4_is_local_multicast(pmc->multiaddr)) in batadv_mcast_mla_softif_get_ipv4()
368 ip_eth_mc_map(pmc->multiaddr, mcast_addr); in batadv_mcast_mla_softif_get_ipv4()
375 ret = -ENOMEM; in batadv_mcast_mla_softif_get_ipv4()
379 ether_addr_copy(new->addr, mcast_addr); in batadv_mcast_mla_softif_get_ipv4()
380 hlist_add_head(&new->list, mcast_list); in batadv_mcast_mla_softif_get_ipv4()
389 * batadv_mcast_mla_softif_get_ipv6() - get softif IPv6 multicast listeners
395 * on this kernel on the given soft interface, dev, in
397 * your multicast receiving applications run directly on this node.
399 * Return: -ENOMEM on memory allocation error or the number of
414 if (flags->tvlv_flags & BATADV_MCAST_WANT_ALL_IPV6) in batadv_mcast_mla_softif_get_ipv6()
425 for (pmc6 = rcu_dereference(in6_dev->mc_list); in batadv_mcast_mla_softif_get_ipv6()
427 pmc6 = rcu_dereference(pmc6->next)) { in batadv_mcast_mla_softif_get_ipv6()
428 if (IPV6_ADDR_MC_SCOPE(&pmc6->mca_addr) < in batadv_mcast_mla_softif_get_ipv6()
432 if (flags->tvlv_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES && in batadv_mcast_mla_softif_get_ipv6()
433 ipv6_addr_is_ll_all_nodes(&pmc6->mca_addr)) in batadv_mcast_mla_softif_get_ipv6()
436 if (!(flags->tvlv_flags & BATADV_MCAST_WANT_NO_RTR6) && in batadv_mcast_mla_softif_get_ipv6()
437 IPV6_ADDR_MC_SCOPE(&pmc6->mca_addr) > in batadv_mcast_mla_softif_get_ipv6()
441 ipv6_eth_mc_map(&pmc6->mca_addr, mcast_addr); in batadv_mcast_mla_softif_get_ipv6()
448 ret = -ENOMEM; in batadv_mcast_mla_softif_get_ipv6()
452 ether_addr_copy(new->addr, mcast_addr); in batadv_mcast_mla_softif_get_ipv6()
453 hlist_add_head(&new->list, mcast_list); in batadv_mcast_mla_softif_get_ipv6()
471 * batadv_mcast_mla_softif_get() - get softif multicast listeners
477 * on this kernel on the given soft interface, dev, in
479 * your multicast receiving applications run directly on this node.
481 * If there is a bridge interface on top of dev, collect from that one
483 * will(/should) register to the bridge interface instead of an
486 * Return: -ENOMEM on memory allocation error or the number of
517 * batadv_mcast_mla_br_addr_cpy() - copy a bridge multicast address
518 * @dst: destination to write to - a multicast MAC address
519 * @src: source to read from - a multicast IP address
530 if (src->proto == htons(ETH_P_IP)) in batadv_mcast_mla_br_addr_cpy()
531 ip_eth_mc_map(src->dst.ip4, dst); in batadv_mcast_mla_br_addr_cpy()
533 else if (src->proto == htons(ETH_P_IPV6)) in batadv_mcast_mla_br_addr_cpy()
534 ipv6_eth_mc_map(&src->dst.ip6, dst); in batadv_mcast_mla_br_addr_cpy()
541 * batadv_mcast_mla_bridge_get() - get bridged-in multicast listeners
547 * on foreign, non-mesh devices which we gave access to our mesh via
548 * a bridge on top of the given soft interface, dev, in the given
551 * Return: -ENOMEM on memory allocation error or the number of
560 u8 tvlv_flags = flags->tvlv_flags; in batadv_mcast_mla_bridge_get()
573 if (br_ip_entry->addr.proto == htons(ETH_P_IP)) { in batadv_mcast_mla_bridge_get()
578 ipv4_is_local_multicast(br_ip_entry->addr.dst.ip4)) in batadv_mcast_mla_bridge_get()
582 !ipv4_is_local_multicast(br_ip_entry->addr.dst.ip4)) in batadv_mcast_mla_bridge_get()
587 if (br_ip_entry->addr.proto == htons(ETH_P_IPV6)) { in batadv_mcast_mla_bridge_get()
592 ipv6_addr_is_ll_all_nodes(&br_ip_entry->addr.dst.ip6)) in batadv_mcast_mla_bridge_get()
596 IPV6_ADDR_MC_SCOPE(&br_ip_entry->addr.dst.ip6) > in batadv_mcast_mla_bridge_get()
602 batadv_mcast_mla_br_addr_cpy(mcast_addr, &br_ip_entry->addr); in batadv_mcast_mla_bridge_get()
608 ret = -ENOMEM; in batadv_mcast_mla_bridge_get()
612 ether_addr_copy(new->addr, mcast_addr); in batadv_mcast_mla_bridge_get()
613 hlist_add_head(&new->list, mcast_list); in batadv_mcast_mla_bridge_get()
618 list_del(&br_ip_entry->list); in batadv_mcast_mla_bridge_get()
626 * batadv_mcast_mla_list_free() - free a list of multicast addresses
637 hlist_del(&mcast_entry->list); in batadv_mcast_mla_list_free()
643 * batadv_mcast_mla_tt_retract() - clean up multicast listener announcements
644 * @bat_priv: the bat priv with all the soft interface information
658 hlist_for_each_entry_safe(mcast_entry, tmp, &bat_priv->mcast.mla_list, in batadv_mcast_mla_tt_retract()
661 batadv_mcast_mla_is_duplicate(mcast_entry->addr, in batadv_mcast_mla_tt_retract()
665 batadv_tt_local_remove(bat_priv, mcast_entry->addr, in batadv_mcast_mla_tt_retract()
669 hlist_del(&mcast_entry->list); in batadv_mcast_mla_tt_retract()
675 * batadv_mcast_mla_tt_add() - add multicast listener announcements
676 * @bat_priv: the bat priv with all the soft interface information
692 if (batadv_mcast_mla_is_duplicate(mcast_entry->addr, in batadv_mcast_mla_tt_add()
693 &bat_priv->mcast.mla_list)) in batadv_mcast_mla_tt_add()
696 if (!batadv_tt_local_add(bat_priv->soft_iface, in batadv_mcast_mla_tt_add()
697 mcast_entry->addr, BATADV_NO_FLAGS, in batadv_mcast_mla_tt_add()
701 hlist_del(&mcast_entry->list); in batadv_mcast_mla_tt_add()
702 hlist_add_head(&mcast_entry->list, &bat_priv->mcast.mla_list); in batadv_mcast_mla_tt_add()
707 * batadv_mcast_querier_log() - debug output regarding the querier status on
709 * @bat_priv: the bat priv with all the soft interface information
721 * forward listener reports to the querier, therefore batman-adv and
722 * the bridge will potentially not see these listeners - the querier is
726 * soft interface.
733 if (!old_state->exists && new_state->exists) in batadv_mcast_querier_log()
734 batadv_info(bat_priv->soft_iface, "%s Querier appeared\n", in batadv_mcast_querier_log()
736 else if (old_state->exists && !new_state->exists) in batadv_mcast_querier_log()
737 batadv_info(bat_priv->soft_iface, in batadv_mcast_querier_log()
738 "%s Querier disappeared - multicast optimizations disabled\n", in batadv_mcast_querier_log()
740 else if (!bat_priv->mcast.mla_flags.bridged && !new_state->exists) in batadv_mcast_querier_log()
741 batadv_info(bat_priv->soft_iface, in batadv_mcast_querier_log()
742 "No %s Querier present - multicast optimizations disabled\n", in batadv_mcast_querier_log()
745 if (new_state->exists) { in batadv_mcast_querier_log()
746 if ((!old_state->shadowing && new_state->shadowing) || in batadv_mcast_querier_log()
747 (!old_state->exists && new_state->shadowing)) in batadv_mcast_querier_log()
751 else if (old_state->shadowing && !new_state->shadowing) in batadv_mcast_querier_log()
759 * batadv_mcast_bridge_log() - debug output for topology changes in bridged
761 * @bat_priv: the bat priv with all the soft interface information
764 * If no bridges are ever used on this node, then this function does nothing.
769 * More precisely, it outputs information when a bridge interface is added or
770 * removed from a soft interface. And when a bridge is present, it further
772 * multicast flags this node is going to set.
778 struct batadv_mcast_mla_flags *old_flags = &bat_priv->mcast.mla_flags; in batadv_mcast_bridge_log()
780 if (!old_flags->bridged && new_flags->bridged) in batadv_mcast_bridge_log()
782 "Bridge added: Setting Unsnoopables(U)-flag\n"); in batadv_mcast_bridge_log()
783 else if (old_flags->bridged && !new_flags->bridged) in batadv_mcast_bridge_log()
785 "Bridge removed: Unsetting Unsnoopables(U)-flag\n"); in batadv_mcast_bridge_log()
787 if (new_flags->bridged) { in batadv_mcast_bridge_log()
789 &old_flags->querier_ipv4, in batadv_mcast_bridge_log()
790 &new_flags->querier_ipv4); in batadv_mcast_bridge_log()
792 &old_flags->querier_ipv6, in batadv_mcast_bridge_log()
793 &new_flags->querier_ipv6); in batadv_mcast_bridge_log()
798 * batadv_mcast_flags_log() - output debug information about mcast flag changes
799 * @bat_priv: the bat priv with all the soft interface information
802 * Whenever the multicast TVLV flags this node announces change, this function
807 bool old_enabled = bat_priv->mcast.mla_flags.enabled; in batadv_mcast_flags_log()
808 u8 old_flags = bat_priv->mcast.mla_flags.tvlv_flags; in batadv_mcast_flags_log()
829 * batadv_mcast_mla_flags_update() - update multicast flags
830 * @bat_priv: the bat priv with all the soft interface information
842 if (!memcmp(flags, &bat_priv->mcast.mla_flags, sizeof(*flags))) in batadv_mcast_mla_flags_update()
846 batadv_mcast_flags_log(bat_priv, flags->tvlv_flags); in batadv_mcast_mla_flags_update()
848 mcast_data.flags = flags->tvlv_flags; in batadv_mcast_mla_flags_update()
854 bat_priv->mcast.mla_flags = *flags; in batadv_mcast_mla_flags_update()
858 * __batadv_mcast_mla_update() - update the own MLAs
859 * @bat_priv: the bat priv with all the soft interface information
864 * Note that non-conflicting reads and writes to bat_priv->mcast.mla_list
866 * ensured by the non-parallel execution of the worker this function
871 struct net_device *soft_iface = bat_priv->soft_iface; in __batadv_mcast_mla_update()
886 spin_lock(&bat_priv->mcast.mla_lock); in __batadv_mcast_mla_update()
890 spin_unlock(&bat_priv->mcast.mla_lock); in __batadv_mcast_mla_update()
897 * batadv_mcast_mla_update() - update the own MLAs
920 * batadv_mcast_is_report_ipv4() - check for IGMP reports
934 switch (igmp_hdr(skb)->type) { in batadv_mcast_is_report_ipv4()
945 * batadv_mcast_forw_mode_check_ipv4() - check for optimized forwarding
947 * @bat_priv: the bat priv with all the soft interface information
955 * Return: If so then 0. Otherwise -EINVAL or -ENOMEM in case of memory
965 /* We might fail due to out-of-memory -> drop it */ in batadv_mcast_forw_mode_check_ipv4()
967 return -ENOMEM; in batadv_mcast_forw_mode_check_ipv4()
970 return -EINVAL; in batadv_mcast_forw_mode_check_ipv4()
974 /* link-local multicast listeners behind a bridge are in batadv_mcast_forw_mode_check_ipv4()
977 if (ipv4_is_local_multicast(iphdr->daddr)) in batadv_mcast_forw_mode_check_ipv4()
986 * batadv_mcast_is_report_ipv6() - check for MLD reports
1000 switch (icmp6_hdr(skb)->icmp6_type) { in batadv_mcast_is_report_ipv6()
1010 * batadv_mcast_forw_mode_check_ipv6() - check for optimized forwarding
1012 * @bat_priv: the bat priv with all the soft interface information
1020 * Return: If so then 0. Otherwise -EINVAL is or -ENOMEM if we are out of memory
1029 /* We might fail due to out-of-memory -> drop it */ in batadv_mcast_forw_mode_check_ipv6()
1031 return -ENOMEM; in batadv_mcast_forw_mode_check_ipv6()
1034 return -EINVAL; in batadv_mcast_forw_mode_check_ipv6()
1038 if (IPV6_ADDR_MC_SCOPE(&ip6hdr->daddr) < IPV6_ADDR_SCOPE_LINKLOCAL) in batadv_mcast_forw_mode_check_ipv6()
1039 return -EINVAL; in batadv_mcast_forw_mode_check_ipv6()
1041 /* link-local-all-nodes multicast listeners behind a bridge are in batadv_mcast_forw_mode_check_ipv6()
1044 if (ipv6_addr_is_ll_all_nodes(&ip6hdr->daddr)) in batadv_mcast_forw_mode_check_ipv6()
1046 else if (IPV6_ADDR_MC_SCOPE(&ip6hdr->daddr) > IPV6_ADDR_SCOPE_LINKLOCAL) in batadv_mcast_forw_mode_check_ipv6()
1053 * batadv_mcast_forw_mode_check() - check for optimized forwarding potential
1054 * @bat_priv: the bat priv with all the soft interface information
1062 * Return: If so then 0. Otherwise -EINVAL is or -ENOMEM if we are out of memory
1071 if (!atomic_read(&bat_priv->multicast_mode)) in batadv_mcast_forw_mode_check()
1072 return -EINVAL; in batadv_mcast_forw_mode_check()
1074 switch (ntohs(ethhdr->h_proto)) { in batadv_mcast_forw_mode_check()
1081 return -EINVAL; in batadv_mcast_forw_mode_check()
1087 return -EINVAL; in batadv_mcast_forw_mode_check()
1092 * batadv_mcast_forw_want_all_ip_count() - count nodes with unspecific mcast
1094 * @bat_priv: the bat priv with all the soft interface information
1104 switch (ntohs(ethhdr->h_proto)) { in batadv_mcast_forw_want_all_ip_count()
1106 return atomic_read(&bat_priv->mcast.num_want_all_ipv4); in batadv_mcast_forw_want_all_ip_count()
1108 return atomic_read(&bat_priv->mcast.num_want_all_ipv6); in batadv_mcast_forw_want_all_ip_count()
1116 * batadv_mcast_forw_rtr_count() - count nodes with a multicast router
1117 * @bat_priv: the bat priv with all the soft interface information
1130 return atomic_read(&bat_priv->mcast.num_want_all_rtr4); in batadv_mcast_forw_rtr_count()
1132 return atomic_read(&bat_priv->mcast.num_want_all_rtr6); in batadv_mcast_forw_rtr_count()
1139 * batadv_mcast_forw_tt_node_get() - get a multicast tt node
1140 * @bat_priv: the bat priv with all the soft interface information
1150 return batadv_transtable_search(bat_priv, NULL, ethhdr->h_dest, in batadv_mcast_forw_tt_node_get()
1155 * batadv_mcast_forw_ipv4_node_get() - get a node with an ipv4 flag
1156 * @bat_priv: the bat priv with all the soft interface information
1168 &bat_priv->mcast.want_all_ipv4_list, in batadv_mcast_forw_ipv4_node_get()
1170 if (!kref_get_unless_zero(&tmp_orig_node->refcount)) in batadv_mcast_forw_ipv4_node_get()
1182 * batadv_mcast_forw_ipv6_node_get() - get a node with an ipv6 flag
1183 * @bat_priv: the bat priv with all the soft interface information
1195 &bat_priv->mcast.want_all_ipv6_list, in batadv_mcast_forw_ipv6_node_get()
1197 if (!kref_get_unless_zero(&tmp_orig_node->refcount)) in batadv_mcast_forw_ipv6_node_get()
1209 * batadv_mcast_forw_ip_node_get() - get a node with an ipv4/ipv6 flag
1210 * @bat_priv: the bat priv with all the soft interface information
1221 switch (ntohs(ethhdr->h_proto)) { in batadv_mcast_forw_ip_node_get()
1233 * batadv_mcast_forw_unsnoop_node_get() - get a node with an unsnoopable flag
1234 * @bat_priv: the bat priv with all the soft interface information
1246 &bat_priv->mcast.want_all_unsnoopables_list, in batadv_mcast_forw_unsnoop_node_get()
1248 if (!kref_get_unless_zero(&tmp_orig_node->refcount)) in batadv_mcast_forw_unsnoop_node_get()
1260 * batadv_mcast_forw_rtr4_node_get() - get a node with an ipv4 mcast router flag
1261 * @bat_priv: the bat priv with all the soft interface information
1273 &bat_priv->mcast.want_all_rtr4_list, in batadv_mcast_forw_rtr4_node_get()
1275 if (!kref_get_unless_zero(&tmp_orig_node->refcount)) in batadv_mcast_forw_rtr4_node_get()
1287 * batadv_mcast_forw_rtr6_node_get() - get a node with an ipv6 mcast router flag
1288 * @bat_priv: the bat priv with all the soft interface information
1300 &bat_priv->mcast.want_all_rtr6_list, in batadv_mcast_forw_rtr6_node_get()
1302 if (!kref_get_unless_zero(&tmp_orig_node->refcount)) in batadv_mcast_forw_rtr6_node_get()
1314 * batadv_mcast_forw_rtr_node_get() - get a node with an ipv4/ipv6 router flag
1315 * @bat_priv: the bat priv with all the soft interface information
1326 switch (ntohs(ethhdr->h_proto)) { in batadv_mcast_forw_rtr_node_get()
1338 * batadv_mcast_forw_mode() - check on how to forward a multicast packet
1339 * @bat_priv: the bat priv with all the soft interface information
1360 if (ret == -ENOMEM) in batadv_mcast_forw_mode()
1367 tt_count = batadv_tt_global_hash_count(bat_priv, ethhdr->h_dest, in batadv_mcast_forw_mode()
1371 atomic_read(&bat_priv->mcast.num_want_all_unsnoopables); in batadv_mcast_forw_mode()
1395 mcast_fanout = atomic_read(&bat_priv->multicast_fanout); in batadv_mcast_forw_mode()
1405 * batadv_mcast_forw_send_orig() - send a multicast packet to an originator
1406 * @bat_priv: the bat priv with all the soft interface information
1418 /* Avoid sending multicast-in-unicast packets to other BLA in batadv_mcast_forw_send_orig()
1419 * gateways - they already got the frame from the LAN side in batadv_mcast_forw_send_orig()
1424 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, vid)) { in batadv_mcast_forw_send_orig()
1434 * batadv_mcast_forw_tt() - forwards a packet to multicast listeners
1435 * @bat_priv: the bat priv with all the soft interface information
1441 * via a batman-adv unicast packet for each such destination node.
1456 const u8 *addr = eth_hdr(skb)->h_dest; in batadv_mcast_forw_tt()
1463 hlist_for_each_entry_rcu(orig_entry, &tt_global->orig_list, list) { in batadv_mcast_forw_tt()
1471 orig_entry->orig_node); in batadv_mcast_forw_tt()
1482 * batadv_mcast_forw_want_all_ipv4() - forward to nodes with want-all-ipv4
1483 * @bat_priv: the bat priv with all the soft interface information
1487 * Sends copies of a frame with multicast destination to any node with a
1489 * batman-adv unicast packet for each such destination node.
1504 &bat_priv->mcast.want_all_ipv4_list, in batadv_mcast_forw_want_all_ipv4()
1519 * batadv_mcast_forw_want_all_ipv6() - forward to nodes with want-all-ipv6
1520 * @bat_priv: the bat priv with all the soft interface information
1524 * Sends copies of a frame with multicast destination to any node with a
1526 * batman-adv unicast packet for each such destination node.
1541 &bat_priv->mcast.want_all_ipv6_list, in batadv_mcast_forw_want_all_ipv6()
1556 * batadv_mcast_forw_want_all() - forward packet to nodes in a want-all list
1557 * @bat_priv: the bat priv with all the soft interface information
1561 * Sends copies of a frame with multicast destination to any node with a
1563 * transmission is performed via a batman-adv unicast packet for each such
1564 * destination node.
1573 switch (ntohs(eth_hdr(skb)->h_proto)) { in batadv_mcast_forw_want_all()
1585 * batadv_mcast_forw_want_all_rtr4() - forward to nodes with want-all-rtr4
1586 * @bat_priv: the bat priv with all the soft interface information
1590 * Sends copies of a frame with multicast destination to any node with a
1592 * batman-adv unicast packet for each such destination node.
1607 &bat_priv->mcast.want_all_rtr4_list, in batadv_mcast_forw_want_all_rtr4()
1622 * batadv_mcast_forw_want_all_rtr6() - forward to nodes with want-all-rtr6
1623 * @bat_priv: the bat priv with all the soft interface information
1627 * Sends copies of a frame with multicast destination to any node with a
1629 * batman-adv unicast packet for each such destination node.
1644 &bat_priv->mcast.want_all_rtr6_list, in batadv_mcast_forw_want_all_rtr6()
1659 * batadv_mcast_forw_want_rtr() - forward packet to nodes in a want-all-rtr list
1660 * @bat_priv: the bat priv with all the soft interface information
1664 * Sends copies of a frame with multicast destination to any node with a
1666 * transmission is performed via a batman-adv unicast packet for each such
1667 * destination node.
1676 switch (ntohs(eth_hdr(skb)->h_proto)) { in batadv_mcast_forw_want_rtr()
1688 * batadv_mcast_forw_send() - send packet to any detected multicast recipient
1689 * @bat_priv: the bat priv with all the soft interface information
1693 * Sends copies of a frame with multicast destination to any node that signaled
1695 * want-all flags. A transmission is performed via a batman-adv unicast packet
1696 * for each such destination node.
1731 * batadv_mcast_want_unsnoop_update() - update unsnoop counter and list
1732 * @bat_priv: the bat priv with all the soft interface information
1740 * Caller needs to hold orig->mcast_handler_lock.
1746 struct hlist_node *node = &orig->mcast_want_all_unsnoopables_node; in batadv_mcast_want_unsnoop_update() local
1747 struct hlist_head *head = &bat_priv->mcast.want_all_unsnoopables_list; in batadv_mcast_want_unsnoop_update()
1749 lockdep_assert_held(&orig->mcast_handler_lock); in batadv_mcast_want_unsnoop_update()
1753 !(orig->mcast_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES)) { in batadv_mcast_want_unsnoop_update()
1754 atomic_inc(&bat_priv->mcast.num_want_all_unsnoopables); in batadv_mcast_want_unsnoop_update()
1756 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
1758 WARN_ON(!hlist_unhashed(node)); in batadv_mcast_want_unsnoop_update()
1760 hlist_add_head_rcu(node, head); in batadv_mcast_want_unsnoop_update()
1761 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
1764 orig->mcast_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES) { in batadv_mcast_want_unsnoop_update()
1765 atomic_dec(&bat_priv->mcast.num_want_all_unsnoopables); in batadv_mcast_want_unsnoop_update()
1767 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
1769 WARN_ON(hlist_unhashed(node)); in batadv_mcast_want_unsnoop_update()
1771 hlist_del_init_rcu(node); in batadv_mcast_want_unsnoop_update()
1772 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_unsnoop_update()
1777 * batadv_mcast_want_ipv4_update() - update want-all-ipv4 counter and list
1778 * @bat_priv: the bat priv with all the soft interface information
1785 * Caller needs to hold orig->mcast_handler_lock.
1791 struct hlist_node *node = &orig->mcast_want_all_ipv4_node; in batadv_mcast_want_ipv4_update() local
1792 struct hlist_head *head = &bat_priv->mcast.want_all_ipv4_list; in batadv_mcast_want_ipv4_update()
1794 lockdep_assert_held(&orig->mcast_handler_lock); in batadv_mcast_want_ipv4_update()
1798 !(orig->mcast_flags & BATADV_MCAST_WANT_ALL_IPV4)) { in batadv_mcast_want_ipv4_update()
1799 atomic_inc(&bat_priv->mcast.num_want_all_ipv4); in batadv_mcast_want_ipv4_update()
1801 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
1803 WARN_ON(!hlist_unhashed(node)); in batadv_mcast_want_ipv4_update()
1805 hlist_add_head_rcu(node, head); in batadv_mcast_want_ipv4_update()
1806 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
1809 orig->mcast_flags & BATADV_MCAST_WANT_ALL_IPV4) { in batadv_mcast_want_ipv4_update()
1810 atomic_dec(&bat_priv->mcast.num_want_all_ipv4); in batadv_mcast_want_ipv4_update()
1812 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
1814 WARN_ON(hlist_unhashed(node)); in batadv_mcast_want_ipv4_update()
1816 hlist_del_init_rcu(node); in batadv_mcast_want_ipv4_update()
1817 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv4_update()
1822 * batadv_mcast_want_ipv6_update() - update want-all-ipv6 counter and list
1823 * @bat_priv: the bat priv with all the soft interface information
1830 * Caller needs to hold orig->mcast_handler_lock.
1836 struct hlist_node *node = &orig->mcast_want_all_ipv6_node; in batadv_mcast_want_ipv6_update() local
1837 struct hlist_head *head = &bat_priv->mcast.want_all_ipv6_list; in batadv_mcast_want_ipv6_update()
1839 lockdep_assert_held(&orig->mcast_handler_lock); in batadv_mcast_want_ipv6_update()
1843 !(orig->mcast_flags & BATADV_MCAST_WANT_ALL_IPV6)) { in batadv_mcast_want_ipv6_update()
1844 atomic_inc(&bat_priv->mcast.num_want_all_ipv6); in batadv_mcast_want_ipv6_update()
1846 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
1848 WARN_ON(!hlist_unhashed(node)); in batadv_mcast_want_ipv6_update()
1850 hlist_add_head_rcu(node, head); in batadv_mcast_want_ipv6_update()
1851 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
1854 orig->mcast_flags & BATADV_MCAST_WANT_ALL_IPV6) { in batadv_mcast_want_ipv6_update()
1855 atomic_dec(&bat_priv->mcast.num_want_all_ipv6); in batadv_mcast_want_ipv6_update()
1857 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
1859 WARN_ON(hlist_unhashed(node)); in batadv_mcast_want_ipv6_update()
1861 hlist_del_init_rcu(node); in batadv_mcast_want_ipv6_update()
1862 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_ipv6_update()
1867 * batadv_mcast_want_rtr4_update() - update want-all-rtr4 counter and list
1868 * @bat_priv: the bat priv with all the soft interface information
1875 * Caller needs to hold orig->mcast_handler_lock.
1881 struct hlist_node *node = &orig->mcast_want_all_rtr4_node; in batadv_mcast_want_rtr4_update() local
1882 struct hlist_head *head = &bat_priv->mcast.want_all_rtr4_list; in batadv_mcast_want_rtr4_update()
1884 lockdep_assert_held(&orig->mcast_handler_lock); in batadv_mcast_want_rtr4_update()
1888 orig->mcast_flags & BATADV_MCAST_WANT_NO_RTR4) { in batadv_mcast_want_rtr4_update()
1889 atomic_inc(&bat_priv->mcast.num_want_all_rtr4); in batadv_mcast_want_rtr4_update()
1891 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_rtr4_update()
1893 WARN_ON(!hlist_unhashed(node)); in batadv_mcast_want_rtr4_update()
1895 hlist_add_head_rcu(node, head); in batadv_mcast_want_rtr4_update()
1896 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_rtr4_update()
1899 !(orig->mcast_flags & BATADV_MCAST_WANT_NO_RTR4)) { in batadv_mcast_want_rtr4_update()
1900 atomic_dec(&bat_priv->mcast.num_want_all_rtr4); in batadv_mcast_want_rtr4_update()
1902 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_rtr4_update()
1904 WARN_ON(hlist_unhashed(node)); in batadv_mcast_want_rtr4_update()
1906 hlist_del_init_rcu(node); in batadv_mcast_want_rtr4_update()
1907 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_rtr4_update()
1912 * batadv_mcast_want_rtr6_update() - update want-all-rtr6 counter and list
1913 * @bat_priv: the bat priv with all the soft interface information
1920 * Caller needs to hold orig->mcast_handler_lock.
1926 struct hlist_node *node = &orig->mcast_want_all_rtr6_node; in batadv_mcast_want_rtr6_update() local
1927 struct hlist_head *head = &bat_priv->mcast.want_all_rtr6_list; in batadv_mcast_want_rtr6_update()
1929 lockdep_assert_held(&orig->mcast_handler_lock); in batadv_mcast_want_rtr6_update()
1933 orig->mcast_flags & BATADV_MCAST_WANT_NO_RTR6) { in batadv_mcast_want_rtr6_update()
1934 atomic_inc(&bat_priv->mcast.num_want_all_rtr6); in batadv_mcast_want_rtr6_update()
1936 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_rtr6_update()
1938 WARN_ON(!hlist_unhashed(node)); in batadv_mcast_want_rtr6_update()
1940 hlist_add_head_rcu(node, head); in batadv_mcast_want_rtr6_update()
1941 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_rtr6_update()
1944 !(orig->mcast_flags & BATADV_MCAST_WANT_NO_RTR6)) { in batadv_mcast_want_rtr6_update()
1945 atomic_dec(&bat_priv->mcast.num_want_all_rtr6); in batadv_mcast_want_rtr6_update()
1947 spin_lock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_rtr6_update()
1949 WARN_ON(hlist_unhashed(node)); in batadv_mcast_want_rtr6_update()
1951 hlist_del_init_rcu(node); in batadv_mcast_want_rtr6_update()
1952 spin_unlock_bh(&bat_priv->mcast.want_lists_lock); in batadv_mcast_want_rtr6_update()
1957 * batadv_mcast_tvlv_flags_get() - get multicast flags from an OGM TVLV
1988 * batadv_mcast_tvlv_ogm_handler() - process incoming multicast tvlv container
1989 * @bat_priv: the bat priv with all the soft interface information
2007 spin_lock_bh(&orig->mcast_handler_lock); in batadv_mcast_tvlv_ogm_handler()
2010 !test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities)) { in batadv_mcast_tvlv_ogm_handler()
2011 set_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities); in batadv_mcast_tvlv_ogm_handler()
2013 test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities)) { in batadv_mcast_tvlv_ogm_handler()
2014 clear_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities); in batadv_mcast_tvlv_ogm_handler()
2017 set_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capa_initialized); in batadv_mcast_tvlv_ogm_handler()
2025 orig->mcast_flags = mcast_flags; in batadv_mcast_tvlv_ogm_handler()
2026 spin_unlock_bh(&orig->mcast_handler_lock); in batadv_mcast_tvlv_ogm_handler()
2030 * batadv_mcast_init() - initialize the multicast optimizations structures
2031 * @bat_priv: the bat priv with all the soft interface information
2039 INIT_DELAYED_WORK(&bat_priv->mcast.work, batadv_mcast_mla_update); in batadv_mcast_init()
2044 * batadv_mcast_mesh_info_put() - put multicast info into a netlink message
2046 * @bat_priv: the bat priv with all the soft interface information
2053 u32 flags = bat_priv->mcast.mla_flags.tvlv_flags; in batadv_mcast_mesh_info_put()
2056 if (bat_priv->mcast.mla_flags.bridged) { in batadv_mcast_mesh_info_put()
2059 if (bat_priv->mcast.mla_flags.querier_ipv4.exists) in batadv_mcast_mesh_info_put()
2061 if (bat_priv->mcast.mla_flags.querier_ipv6.exists) in batadv_mcast_mesh_info_put()
2063 if (bat_priv->mcast.mla_flags.querier_ipv4.shadowing) in batadv_mcast_mesh_info_put()
2065 if (bat_priv->mcast.mla_flags.querier_ipv6.shadowing) in batadv_mcast_mesh_info_put()
2071 return -EMSGSIZE; in batadv_mcast_mesh_info_put()
2077 * batadv_mcast_flags_dump_entry() - dump one entry of the multicast flags table
2093 hdr = genlmsg_put(msg, portid, cb->nlh->nlmsg_seq, in batadv_mcast_flags_dump_entry()
2097 return -ENOBUFS; in batadv_mcast_flags_dump_entry()
2102 orig_node->orig)) { in batadv_mcast_flags_dump_entry()
2104 return -EMSGSIZE; in batadv_mcast_flags_dump_entry()
2108 &orig_node->capabilities)) { in batadv_mcast_flags_dump_entry()
2110 orig_node->mcast_flags)) { in batadv_mcast_flags_dump_entry()
2112 return -EMSGSIZE; in batadv_mcast_flags_dump_entry()
2121 * batadv_mcast_flags_dump_bucket() - dump one bucket of the multicast flags
2141 spin_lock_bh(&hash->list_locks[bucket]); in batadv_mcast_flags_dump_bucket()
2142 cb->seq = atomic_read(&hash->generation) << 1 | 1; in batadv_mcast_flags_dump_bucket()
2144 hlist_for_each_entry(orig_node, &hash->table[bucket], hash_entry) { in batadv_mcast_flags_dump_bucket()
2146 &orig_node->capa_initialized)) in batadv_mcast_flags_dump_bucket()
2153 spin_unlock_bh(&hash->list_locks[bucket]); in batadv_mcast_flags_dump_bucket()
2156 return -EMSGSIZE; in batadv_mcast_flags_dump_bucket()
2162 spin_unlock_bh(&hash->list_locks[bucket]); in batadv_mcast_flags_dump_bucket()
2168 * __batadv_mcast_flags_dump() - dump multicast flags table to a netlink socket
2172 * @bat_priv: the bat priv with all the soft interface information
2183 struct batadv_hashtable *hash = bat_priv->orig_hash; in __batadv_mcast_flags_dump()
2187 while (bucket_tmp < hash->size) { in __batadv_mcast_flags_dump()
2199 return msg->len; in __batadv_mcast_flags_dump()
2203 * batadv_mcast_netlink_get_primary() - get primary interface from netlink
2206 * @primary_if: the primary interface pointer to return the result in
2215 struct net *net = sock_net(cb->skb->sk); in batadv_mcast_netlink_get_primary()
2221 ifindex = batadv_netlink_get_ifindex(cb->nlh, BATADV_ATTR_MESH_IFINDEX); in batadv_mcast_netlink_get_primary()
2223 return -EINVAL; in batadv_mcast_netlink_get_primary()
2227 ret = -ENODEV; in batadv_mcast_netlink_get_primary()
2234 if (!hard_iface || hard_iface->if_status != BATADV_IF_ACTIVE) { in batadv_mcast_netlink_get_primary()
2235 ret = -ENOENT; in batadv_mcast_netlink_get_primary()
2251 * batadv_mcast_flags_dump() - dump multicast flags table to a netlink socket
2260 int portid = NETLINK_CB(cb->skb).portid; in batadv_mcast_flags_dump()
2262 long *bucket = &cb->args[0]; in batadv_mcast_flags_dump()
2263 long *idx = &cb->args[1]; in batadv_mcast_flags_dump()
2270 bat_priv = netdev_priv(primary_if->soft_iface); in batadv_mcast_flags_dump()
2278 * batadv_mcast_free() - free the multicast optimizations structures
2279 * @bat_priv: the bat priv with all the soft interface information
2283 cancel_delayed_work_sync(&bat_priv->mcast.work); in batadv_mcast_free()
2293 * batadv_mcast_purge_orig() - reset originator global mcast state modifications
2298 struct batadv_priv *bat_priv = orig->bat_priv; in batadv_mcast_purge_orig()
2300 spin_lock_bh(&orig->mcast_handler_lock); in batadv_mcast_purge_orig()
2310 spin_unlock_bh(&orig->mcast_handler_lock); in batadv_mcast_purge_orig()