aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/multicast.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/batman-adv/multicast.c')
-rw-r--r--net/batman-adv/multicast.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c
index 75fa5013af72..8caa2c72efa3 100644
--- a/net/batman-adv/multicast.c
+++ b/net/batman-adv/multicast.c
@@ -1,4 +1,4 @@
1/* Copyright (C) 2014-2015 B.A.T.M.A.N. contributors: 1/* Copyright (C) 2014-2016 B.A.T.M.A.N. contributors:
2 * 2 *
3 * Linus Lüssing 3 * Linus Lüssing
4 * 4 *
@@ -30,6 +30,7 @@
30#include <linux/in.h> 30#include <linux/in.h>
31#include <linux/ip.h> 31#include <linux/ip.h>
32#include <linux/ipv6.h> 32#include <linux/ipv6.h>
33#include <linux/kref.h>
33#include <linux/list.h> 34#include <linux/list.h>
34#include <linux/lockdep.h> 35#include <linux/lockdep.h>
35#include <linux/netdevice.h> 36#include <linux/netdevice.h>
@@ -55,7 +56,7 @@
55 * Collect multicast addresses of the local multicast listeners 56 * Collect multicast addresses of the local multicast listeners
56 * on the given soft interface, dev, in the given mcast_list. 57 * on the given soft interface, dev, in the given mcast_list.
57 * 58 *
58 * Returns -ENOMEM on memory allocation error or the number of 59 * Return: -ENOMEM on memory allocation error or the number of
59 * items added to the mcast_list otherwise. 60 * items added to the mcast_list otherwise.
60 */ 61 */
61static int batadv_mcast_mla_softif_get(struct net_device *dev, 62static int batadv_mcast_mla_softif_get(struct net_device *dev,
@@ -87,7 +88,7 @@ static int batadv_mcast_mla_softif_get(struct net_device *dev,
87 * @mcast_addr: the multicast address to check 88 * @mcast_addr: the multicast address to check
88 * @mcast_list: the list with multicast addresses to search in 89 * @mcast_list: the list with multicast addresses to search in
89 * 90 *
90 * Returns true if the given address is already in the given list. 91 * Return: true if the given address is already in the given list.
91 * Otherwise returns false. 92 * Otherwise returns false.
92 */ 93 */
93static bool batadv_mcast_mla_is_duplicate(u8 *mcast_addr, 94static bool batadv_mcast_mla_is_duplicate(u8 *mcast_addr,
@@ -195,8 +196,9 @@ static void batadv_mcast_mla_tt_add(struct batadv_priv *bat_priv,
195 * batadv_mcast_has_bridge - check whether the soft-iface is bridged 196 * batadv_mcast_has_bridge - check whether the soft-iface is bridged
196 * @bat_priv: the bat priv with all the soft interface information 197 * @bat_priv: the bat priv with all the soft interface information
197 * 198 *
198 * Checks whether there is a bridge on top of our soft interface. Returns 199 * Checks whether there is a bridge on top of our soft interface.
199 * true if so, false otherwise. 200 *
201 * Return: true if there is a bridge, false otherwise.
200 */ 202 */
201static bool batadv_mcast_has_bridge(struct batadv_priv *bat_priv) 203static bool batadv_mcast_has_bridge(struct batadv_priv *bat_priv)
202{ 204{
@@ -218,7 +220,7 @@ static bool batadv_mcast_has_bridge(struct batadv_priv *bat_priv)
218 * Updates the own multicast tvlv with our current multicast related settings, 220 * Updates the own multicast tvlv with our current multicast related settings,
219 * capabilities and inabilities. 221 * capabilities and inabilities.
220 * 222 *
221 * Returns true if the tvlv container is registered afterwards. Otherwise 223 * Return: true if the tvlv container is registered afterwards. Otherwise
222 * returns false. 224 * returns false.
223 */ 225 */
224static bool batadv_mcast_mla_tvlv_update(struct batadv_priv *bat_priv) 226static bool batadv_mcast_mla_tvlv_update(struct batadv_priv *bat_priv)
@@ -289,8 +291,8 @@ out:
289 * Checks whether the given IPv4 packet has the potential to be forwarded with a 291 * Checks whether the given IPv4 packet has the potential to be forwarded with a
290 * mode more optimal than classic flooding. 292 * mode more optimal than classic flooding.
291 * 293 *
292 * If so then returns 0. Otherwise -EINVAL is returned or -ENOMEM in case of 294 * Return: If so then 0. Otherwise -EINVAL or -ENOMEM in case of memory
293 * memory allocation failure. 295 * allocation failure.
294 */ 296 */
295static int batadv_mcast_forw_mode_check_ipv4(struct batadv_priv *bat_priv, 297static int batadv_mcast_forw_mode_check_ipv4(struct batadv_priv *bat_priv,
296 struct sk_buff *skb, 298 struct sk_buff *skb,
@@ -327,8 +329,7 @@ static int batadv_mcast_forw_mode_check_ipv4(struct batadv_priv *bat_priv,
327 * Checks whether the given IPv6 packet has the potential to be forwarded with a 329 * Checks whether the given IPv6 packet has the potential to be forwarded with a
328 * mode more optimal than classic flooding. 330 * mode more optimal than classic flooding.
329 * 331 *
330 * If so then returns 0. Otherwise -EINVAL is returned or -ENOMEM if we are out 332 * Return: If so then 0. Otherwise -EINVAL is or -ENOMEM if we are out of memory
331 * of memory.
332 */ 333 */
333static int batadv_mcast_forw_mode_check_ipv6(struct batadv_priv *bat_priv, 334static int batadv_mcast_forw_mode_check_ipv6(struct batadv_priv *bat_priv,
334 struct sk_buff *skb, 335 struct sk_buff *skb,
@@ -366,8 +367,7 @@ static int batadv_mcast_forw_mode_check_ipv6(struct batadv_priv *bat_priv,
366 * Checks whether the given multicast ethernet frame has the potential to be 367 * Checks whether the given multicast ethernet frame has the potential to be
367 * forwarded with a mode more optimal than classic flooding. 368 * forwarded with a mode more optimal than classic flooding.
368 * 369 *
369 * If so then returns 0. Otherwise -EINVAL is returned or -ENOMEM if we are out 370 * Return: If so then 0. Otherwise -EINVAL is or -ENOMEM if we are out of memory
370 * of memory.
371 */ 371 */
372static int batadv_mcast_forw_mode_check(struct batadv_priv *bat_priv, 372static int batadv_mcast_forw_mode_check(struct batadv_priv *bat_priv,
373 struct sk_buff *skb, 373 struct sk_buff *skb,
@@ -398,7 +398,7 @@ static int batadv_mcast_forw_mode_check(struct batadv_priv *bat_priv,
398 * @bat_priv: the bat priv with all the soft interface information 398 * @bat_priv: the bat priv with all the soft interface information
399 * @ethhdr: ethernet header of a packet 399 * @ethhdr: ethernet header of a packet
400 * 400 *
401 * Returns the number of nodes which want all IPv4 multicast traffic if the 401 * Return: the number of nodes which want all IPv4 multicast traffic if the
402 * given ethhdr is from an IPv4 packet or the number of nodes which want all 402 * given ethhdr is from an IPv4 packet or the number of nodes which want all
403 * IPv6 traffic if it matches an IPv6 packet. 403 * IPv6 traffic if it matches an IPv6 packet.
404 */ 404 */
@@ -421,7 +421,7 @@ static int batadv_mcast_forw_want_all_ip_count(struct batadv_priv *bat_priv,
421 * @bat_priv: the bat priv with all the soft interface information 421 * @bat_priv: the bat priv with all the soft interface information
422 * @ethhdr: the ether header containing the multicast destination 422 * @ethhdr: the ether header containing the multicast destination
423 * 423 *
424 * Returns an orig_node matching the multicast address provided by ethhdr 424 * Return: an orig_node matching the multicast address provided by ethhdr
425 * via a translation table lookup. This increases the returned nodes refcount. 425 * via a translation table lookup. This increases the returned nodes refcount.
426 */ 426 */
427static struct batadv_orig_node * 427static struct batadv_orig_node *
@@ -436,7 +436,7 @@ batadv_mcast_forw_tt_node_get(struct batadv_priv *bat_priv,
436 * batadv_mcast_want_forw_ipv4_node_get - get a node with an ipv4 flag 436 * batadv_mcast_want_forw_ipv4_node_get - get a node with an ipv4 flag
437 * @bat_priv: the bat priv with all the soft interface information 437 * @bat_priv: the bat priv with all the soft interface information
438 * 438 *
439 * Returns an orig_node which has the BATADV_MCAST_WANT_ALL_IPV4 flag set and 439 * Return: an orig_node which has the BATADV_MCAST_WANT_ALL_IPV4 flag set and
440 * increases its refcount. 440 * increases its refcount.
441 */ 441 */
442static struct batadv_orig_node * 442static struct batadv_orig_node *
@@ -448,7 +448,7 @@ batadv_mcast_forw_ipv4_node_get(struct batadv_priv *bat_priv)
448 hlist_for_each_entry_rcu(tmp_orig_node, 448 hlist_for_each_entry_rcu(tmp_orig_node,
449 &bat_priv->mcast.want_all_ipv4_list, 449 &bat_priv->mcast.want_all_ipv4_list,
450 mcast_want_all_ipv4_node) { 450 mcast_want_all_ipv4_node) {
451 if (!atomic_inc_not_zero(&tmp_orig_node->refcount)) 451 if (!kref_get_unless_zero(&tmp_orig_node->refcount))
452 continue; 452 continue;
453 453
454 orig_node = tmp_orig_node; 454 orig_node = tmp_orig_node;
@@ -463,7 +463,7 @@ batadv_mcast_forw_ipv4_node_get(struct batadv_priv *bat_priv)
463 * batadv_mcast_want_forw_ipv6_node_get - get a node with an ipv6 flag 463 * batadv_mcast_want_forw_ipv6_node_get - get a node with an ipv6 flag
464 * @bat_priv: the bat priv with all the soft interface information 464 * @bat_priv: the bat priv with all the soft interface information
465 * 465 *
466 * Returns an orig_node which has the BATADV_MCAST_WANT_ALL_IPV6 flag set 466 * Return: an orig_node which has the BATADV_MCAST_WANT_ALL_IPV6 flag set
467 * and increases its refcount. 467 * and increases its refcount.
468 */ 468 */
469static struct batadv_orig_node * 469static struct batadv_orig_node *
@@ -475,7 +475,7 @@ batadv_mcast_forw_ipv6_node_get(struct batadv_priv *bat_priv)
475 hlist_for_each_entry_rcu(tmp_orig_node, 475 hlist_for_each_entry_rcu(tmp_orig_node,
476 &bat_priv->mcast.want_all_ipv6_list, 476 &bat_priv->mcast.want_all_ipv6_list,
477 mcast_want_all_ipv6_node) { 477 mcast_want_all_ipv6_node) {
478 if (!atomic_inc_not_zero(&tmp_orig_node->refcount)) 478 if (!kref_get_unless_zero(&tmp_orig_node->refcount))
479 continue; 479 continue;
480 480
481 orig_node = tmp_orig_node; 481 orig_node = tmp_orig_node;
@@ -491,7 +491,7 @@ batadv_mcast_forw_ipv6_node_get(struct batadv_priv *bat_priv)
491 * @bat_priv: the bat priv with all the soft interface information 491 * @bat_priv: the bat priv with all the soft interface information
492 * @ethhdr: an ethernet header to determine the protocol family from 492 * @ethhdr: an ethernet header to determine the protocol family from
493 * 493 *
494 * Returns an orig_node which has the BATADV_MCAST_WANT_ALL_IPV4 or 494 * Return: an orig_node which has the BATADV_MCAST_WANT_ALL_IPV4 or
495 * BATADV_MCAST_WANT_ALL_IPV6 flag, depending on the provided ethhdr, set and 495 * BATADV_MCAST_WANT_ALL_IPV6 flag, depending on the provided ethhdr, set and
496 * increases its refcount. 496 * increases its refcount.
497 */ 497 */
@@ -514,7 +514,7 @@ batadv_mcast_forw_ip_node_get(struct batadv_priv *bat_priv,
514 * batadv_mcast_want_forw_unsnoop_node_get - get a node with an unsnoopable flag 514 * batadv_mcast_want_forw_unsnoop_node_get - get a node with an unsnoopable flag
515 * @bat_priv: the bat priv with all the soft interface information 515 * @bat_priv: the bat priv with all the soft interface information
516 * 516 *
517 * Returns an orig_node which has the BATADV_MCAST_WANT_ALL_UNSNOOPABLES flag 517 * Return: an orig_node which has the BATADV_MCAST_WANT_ALL_UNSNOOPABLES flag
518 * set and increases its refcount. 518 * set and increases its refcount.
519 */ 519 */
520static struct batadv_orig_node * 520static struct batadv_orig_node *
@@ -526,7 +526,7 @@ batadv_mcast_forw_unsnoop_node_get(struct batadv_priv *bat_priv)
526 hlist_for_each_entry_rcu(tmp_orig_node, 526 hlist_for_each_entry_rcu(tmp_orig_node,
527 &bat_priv->mcast.want_all_unsnoopables_list, 527 &bat_priv->mcast.want_all_unsnoopables_list,
528 mcast_want_all_unsnoopables_node) { 528 mcast_want_all_unsnoopables_node) {
529 if (!atomic_inc_not_zero(&tmp_orig_node->refcount)) 529 if (!kref_get_unless_zero(&tmp_orig_node->refcount))
530 continue; 530 continue;
531 531
532 orig_node = tmp_orig_node; 532 orig_node = tmp_orig_node;
@@ -543,7 +543,7 @@ batadv_mcast_forw_unsnoop_node_get(struct batadv_priv *bat_priv)
543 * @skb: The multicast packet to check 543 * @skb: The multicast packet to check
544 * @orig: an originator to be set to forward the skb to 544 * @orig: an originator to be set to forward the skb to
545 * 545 *
546 * Returns the forwarding mode as enum batadv_forw_mode and in case of 546 * Return: the forwarding mode as enum batadv_forw_mode and in case of
547 * BATADV_FORW_SINGLE set the orig to the single originator the skb 547 * BATADV_FORW_SINGLE set the orig to the single originator the skb
548 * should be forwarded to. 548 * should be forwarded to.
549 */ 549 */