Commit 9d1eb21b authored by David S. Miller's avatar David S. Miller

Merge tag 'batman-adv-for-davem' of git://git.open-mesh.org/linux-merge

Antonio Quartulli says:

====================
This batch of patches includes a number of corrections and
improvements for our kernel-doc. These changes also make sure
that our doc is now properly processed by the kernel-doc
parsing tool.

Other than that you have a patch updating all the copyright
lines to 2016 and another patch switching the URLs in our
readme, Kconfig and MAINTAINERS file from "http" to "https".
Both by Sven Eckelmann.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents e6359193 7b5e7396
...@@ -187,7 +187,7 @@ interfaces to the kernel module settings. ...@@ -187,7 +187,7 @@ interfaces to the kernel module settings.
For more information, please see the manpage (man batctl). For more information, please see the manpage (man batctl).
batctl is available on http://www.open-mesh.org/ batctl is available on https://www.open-mesh.org/
CONTACT CONTACT
......
...@@ -2147,7 +2147,7 @@ M: Marek Lindner <mareklindner@neomailbox.ch> ...@@ -2147,7 +2147,7 @@ M: Marek Lindner <mareklindner@neomailbox.ch>
M: Simon Wunderlich <sw@simonwunderlich.de> M: Simon Wunderlich <sw@simonwunderlich.de>
M: Antonio Quartulli <a@unstable.cc> M: Antonio Quartulli <a@unstable.cc>
L: b.a.t.m.a.n@lists.open-mesh.org L: b.a.t.m.a.n@lists.open-mesh.org
W: http://www.open-mesh.org/ W: https://www.open-mesh.org/
S: Maintained S: Maintained
F: net/batman-adv/ F: net/batman-adv/
......
...@@ -12,7 +12,7 @@ config BATMAN_ADV ...@@ -12,7 +12,7 @@ config BATMAN_ADV
B.A.T.M.A.N. (better approach to mobile ad-hoc networking) is B.A.T.M.A.N. (better approach to mobile ad-hoc networking) is
a routing protocol for multi-hop ad-hoc mesh networks. The a routing protocol for multi-hop ad-hoc mesh networks. The
networks may be wired or wireless. See networks may be wired or wireless. See
http://www.open-mesh.org/ for more information and user space https://www.open-mesh.org/ for more information and user space
tools. tools.
config BATMAN_ADV_BLA config BATMAN_ADV_BLA
......
# #
# Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: # Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
# #
# Marek Lindner, Simon Wunderlich # Marek Lindner, Simon Wunderlich
# #
......
/* Copyright (C) 2011-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2011-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
* *
......
/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
* *
...@@ -88,7 +88,7 @@ static void batadv_ring_buffer_set(u8 lq_recv[], u8 *lq_index, u8 value) ...@@ -88,7 +88,7 @@ static void batadv_ring_buffer_set(u8 lq_recv[], u8 *lq_index, u8 value)
* in the given ring buffer * in the given ring buffer
* @lq_recv: pointer to the ring buffer * @lq_recv: pointer to the ring buffer
* *
* Returns computed average value. * Return: computed average value.
*/ */
static u8 batadv_ring_buffer_avg(const u8 lq_recv[]) static u8 batadv_ring_buffer_avg(const u8 lq_recv[])
{ {
...@@ -132,7 +132,7 @@ static void batadv_iv_ogm_orig_free(struct batadv_orig_node *orig_node) ...@@ -132,7 +132,7 @@ static void batadv_iv_ogm_orig_free(struct batadv_orig_node *orig_node)
* @orig_node: the orig_node that has to be changed * @orig_node: the orig_node that has to be changed
* @max_if_num: the current amount of interfaces * @max_if_num: the current amount of interfaces
* *
* Returns 0 on success, a negative error code otherwise. * Return: 0 on success, a negative error code otherwise.
*/ */
static int batadv_iv_ogm_orig_add_if(struct batadv_orig_node *orig_node, static int batadv_iv_ogm_orig_add_if(struct batadv_orig_node *orig_node,
int max_if_num) int max_if_num)
...@@ -180,7 +180,7 @@ static int batadv_iv_ogm_orig_add_if(struct batadv_orig_node *orig_node, ...@@ -180,7 +180,7 @@ static int batadv_iv_ogm_orig_add_if(struct batadv_orig_node *orig_node,
* @max_if_num: the current amount of interfaces * @max_if_num: the current amount of interfaces
* @del_if_num: the index of the interface being removed * @del_if_num: the index of the interface being removed
* *
* Returns 0 on success, a negative error code otherwise. * Return: 0 on success, a negative error code otherwise.
*/ */
static int batadv_iv_ogm_orig_del_if(struct batadv_orig_node *orig_node, static int batadv_iv_ogm_orig_del_if(struct batadv_orig_node *orig_node,
int max_if_num, int del_if_num) int max_if_num, int del_if_num)
...@@ -246,7 +246,7 @@ static int batadv_iv_ogm_orig_del_if(struct batadv_orig_node *orig_node, ...@@ -246,7 +246,7 @@ static int batadv_iv_ogm_orig_del_if(struct batadv_orig_node *orig_node,
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @addr: mac address of the originator * @addr: mac address of the originator
* *
* Returns the originator object corresponding to the passed mac address or NULL * Return: the originator object corresponding to the passed mac address or NULL
* on failure. * on failure.
* If the object does not exists it is created an initialised. * If the object does not exists it is created an initialised.
*/ */
...@@ -396,7 +396,14 @@ static u8 batadv_hop_penalty(u8 tq, const struct batadv_priv *bat_priv) ...@@ -396,7 +396,14 @@ static u8 batadv_hop_penalty(u8 tq, const struct batadv_priv *bat_priv)
return new_tq; return new_tq;
} }
/* is there another aggregated packet here? */ /**
* batadv_iv_ogm_aggr_packet - checks if there is another OGM attached
* @buff_pos: current position in the skb
* @packet_len: total length of the skb
* @tvlv_len: tvlv length of the previously considered OGM
*
* Return: true if there is enough space for another OGM, false otherwise.
*/
static bool batadv_iv_ogm_aggr_packet(int buff_pos, int packet_len, static bool batadv_iv_ogm_aggr_packet(int buff_pos, int packet_len,
__be16 tvlv_len) __be16 tvlv_len)
{ {
...@@ -522,7 +529,7 @@ static void batadv_iv_ogm_emit(struct batadv_forw_packet *forw_packet) ...@@ -522,7 +529,7 @@ static void batadv_iv_ogm_emit(struct batadv_forw_packet *forw_packet)
* @if_outgoing: interface for which the retransmission should be considered * @if_outgoing: interface for which the retransmission should be considered
* @forw_packet: the forwarded packet which should be checked * @forw_packet: the forwarded packet which should be checked
* *
* Returns true if new_packet can be aggregated with forw_packet * Return: true if new_packet can be aggregated with forw_packet
*/ */
static bool static bool
batadv_iv_ogm_can_aggregate(const struct batadv_ogm_packet *new_bat_ogm_packet, batadv_iv_ogm_can_aggregate(const struct batadv_ogm_packet *new_bat_ogm_packet,
...@@ -1125,7 +1132,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, ...@@ -1125,7 +1132,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
* @if_incoming: interface where the packet was received * @if_incoming: interface where the packet was received
* @if_outgoing: interface for which the retransmission should be considered * @if_outgoing: interface for which the retransmission should be considered
* *
* Returns 1 if the link can be considered bidirectional, 0 otherwise * Return: 1 if the link can be considered bidirectional, 0 otherwise
*/ */
static int batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node, static int batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node,
struct batadv_orig_node *orig_neigh_node, struct batadv_orig_node *orig_neigh_node,
...@@ -1269,7 +1276,7 @@ static int batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node, ...@@ -1269,7 +1276,7 @@ static int batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node,
* @if_incoming: interface on which the OGM packet was received * @if_incoming: interface on which the OGM packet was received
* @if_outgoing: interface for which the retransmission should be considered * @if_outgoing: interface for which the retransmission should be considered
* *
* Returns duplicate status as enum batadv_dup_status * Return: duplicate status as enum batadv_dup_status
*/ */
static enum batadv_dup_status static enum batadv_dup_status
batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr, batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
...@@ -1929,7 +1936,7 @@ static void batadv_iv_neigh_print(struct batadv_priv *bat_priv, ...@@ -1929,7 +1936,7 @@ static void batadv_iv_neigh_print(struct batadv_priv *bat_priv,
* @neigh2: the second neighbor object of the comparison * @neigh2: the second neighbor object of the comparison
* @if_outgoing2: outgoing interface for the second neighbor * @if_outgoing2: outgoing interface for the second neighbor
* *
* Returns a value less, equal to or greater than 0 if the metric via neigh1 is * Return: a value less, equal to or greater than 0 if the metric via neigh1 is
* lower, the same as or higher than the metric via neigh2 * lower, the same as or higher than the metric via neigh2
*/ */
static int batadv_iv_ogm_neigh_cmp(struct batadv_neigh_node *neigh1, static int batadv_iv_ogm_neigh_cmp(struct batadv_neigh_node *neigh1,
...@@ -1970,7 +1977,7 @@ static int batadv_iv_ogm_neigh_cmp(struct batadv_neigh_node *neigh1, ...@@ -1970,7 +1977,7 @@ static int batadv_iv_ogm_neigh_cmp(struct batadv_neigh_node *neigh1,
* @neigh2: the second neighbor object of the comparison * @neigh2: the second neighbor object of the comparison
* @if_outgoing2: outgoing interface for the second neighbor * @if_outgoing2: outgoing interface for the second neighbor
* *
* Returns true if the metric via neigh1 is equally good or better than * Return: true if the metric via neigh1 is equally good or better than
* the metric via neigh2, false otherwise. * the metric via neigh2, false otherwise.
*/ */
static bool static bool
......
/* Copyright (C) 2006-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2006-2016 B.A.T.M.A.N. contributors:
* *
* Simon Wunderlich, Marek Lindner * Simon Wunderlich, Marek Lindner
* *
...@@ -29,10 +29,16 @@ static void batadv_bitmap_shift_left(unsigned long *seq_bits, s32 n) ...@@ -29,10 +29,16 @@ static void batadv_bitmap_shift_left(unsigned long *seq_bits, s32 n)
bitmap_shift_left(seq_bits, seq_bits, n, BATADV_TQ_LOCAL_WINDOW_SIZE); bitmap_shift_left(seq_bits, seq_bits, n, BATADV_TQ_LOCAL_WINDOW_SIZE);
} }
/* receive and process one packet within the sequence number window. /**
* batadv_bit_get_packet - receive and process one packet within the sequence
* number window
* @priv: the bat priv with all the soft interface information
* @seq_bits: pointer to the sequence number receive packet
* @seq_num_diff: difference between the current/received sequence number and
* the last sequence number
* @set_mark: whether this packet should be marked in seq_bits
* *
* returns: * Return: 1 if the window was moved (either new or very old),
* 1 if the window was moved (either new or very old)
* 0 if the window was not moved/shifted. * 0 if the window was not moved/shifted.
*/ */
int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, s32 seq_num_diff, int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, s32 seq_num_diff,
......
/* Copyright (C) 2006-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2006-2016 B.A.T.M.A.N. contributors:
* *
* Simon Wunderlich, Marek Lindner * Simon Wunderlich, Marek Lindner
* *
...@@ -24,7 +24,14 @@ ...@@ -24,7 +24,14 @@
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/types.h> #include <linux/types.h>
/* Returns 1 if the corresponding bit in the given seq_bits indicates true /**
* batadv_test_bit - check if bit is set in the current window
*
* @seq_bits: pointer to the sequence number receive packet
* @last_seqno: latest sequence number in seq_bits
* @curr_seqno: sequence number to test for
*
* Return: 1 if the corresponding bit in the given seq_bits indicates true
* and curr_seqno is within range of last_seqno. Otherwise returns 0. * and curr_seqno is within range of last_seqno. Otherwise returns 0.
*/ */
static inline int batadv_test_bit(const unsigned long *seq_bits, static inline int batadv_test_bit(const unsigned long *seq_bits,
...@@ -48,9 +55,6 @@ static inline void batadv_set_bit(unsigned long *seq_bits, s32 n) ...@@ -48,9 +55,6 @@ static inline void batadv_set_bit(unsigned long *seq_bits, s32 n)
set_bit(n, seq_bits); /* turn the position on */ set_bit(n, seq_bits); /* turn the position on */
} }
/* receive and process one packet, returns 1 if received seq_num is considered
* new, 0 if old
*/
int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, s32 seq_num_diff, int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, s32 seq_num_diff,
int set_mark); int set_mark);
......
/* Copyright (C) 2011-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2011-2016 B.A.T.M.A.N. contributors:
* *
* Simon Wunderlich * Simon Wunderlich
* *
...@@ -58,7 +58,13 @@ static void ...@@ -58,7 +58,13 @@ static void
batadv_bla_send_announce(struct batadv_priv *bat_priv, batadv_bla_send_announce(struct batadv_priv *bat_priv,
struct batadv_bla_backbone_gw *backbone_gw); struct batadv_bla_backbone_gw *backbone_gw);
/* return the index of the claim */ /**
* batadv_choose_claim - choose the right bucket for a claim.
* @data: data to hash
* @size: size of the hash table
*
* Return: the hash index of the claim
*/
static inline u32 batadv_choose_claim(const void *data, u32 size) static inline u32 batadv_choose_claim(const void *data, u32 size)
{ {
struct batadv_bla_claim *claim = (struct batadv_bla_claim *)data; struct batadv_bla_claim *claim = (struct batadv_bla_claim *)data;
...@@ -70,7 +76,13 @@ static inline u32 batadv_choose_claim(const void *data, u32 size) ...@@ -70,7 +76,13 @@ static inline u32 batadv_choose_claim(const void *data, u32 size)
return hash % size; return hash % size;
} }
/* return the index of the backbone gateway */ /**
* batadv_choose_backbone_gw - choose the right bucket for a backbone gateway.
* @data: data to hash
* @size: size of the hash table
*
* Return: the hash index of the backbone gateway
*/
static inline u32 batadv_choose_backbone_gw(const void *data, u32 size) static inline u32 batadv_choose_backbone_gw(const void *data, u32 size)
{ {
const struct batadv_bla_claim *claim = (struct batadv_bla_claim *)data; const struct batadv_bla_claim *claim = (struct batadv_bla_claim *)data;
...@@ -82,7 +94,13 @@ static inline u32 batadv_choose_backbone_gw(const void *data, u32 size) ...@@ -82,7 +94,13 @@ static inline u32 batadv_choose_backbone_gw(const void *data, u32 size)
return hash % size; return hash % size;
} }
/* compares address and vid of two backbone gws */ /**
* batadv_compare_backbone_gw - compare address and vid of two backbone gws
* @node: list node of the first entry to compare
* @data2: pointer to the second backbone gateway
*
* Return: 1 if the backbones have the same data, 0 otherwise
*/
static int batadv_compare_backbone_gw(const struct hlist_node *node, static int batadv_compare_backbone_gw(const struct hlist_node *node,
const void *data2) const void *data2)
{ {
...@@ -100,7 +118,13 @@ static int batadv_compare_backbone_gw(const struct hlist_node *node, ...@@ -100,7 +118,13 @@ static int batadv_compare_backbone_gw(const struct hlist_node *node,
return 1; return 1;
} }
/* compares address and vid of two claims */ /**
* batadv_compare_backbone_gw - compare address and vid of two claims
* @node: list node of the first entry to compare
* @data2: pointer to the second claims
*
* Return: 1 if the claim have the same data, 0 otherwise
*/
static int batadv_compare_claim(const struct hlist_node *node, static int batadv_compare_claim(const struct hlist_node *node,
const void *data2) const void *data2)
{ {
...@@ -118,7 +142,10 @@ static int batadv_compare_claim(const struct hlist_node *node, ...@@ -118,7 +142,10 @@ static int batadv_compare_claim(const struct hlist_node *node,
return 1; return 1;
} }
/* free a backbone gw */ /**
* batadv_compare_backbone_gw - free backbone gw
* @backbone_gw: backbone gateway to be free'd
*/
static void static void
batadv_backbone_gw_free_ref(struct batadv_bla_backbone_gw *backbone_gw) batadv_backbone_gw_free_ref(struct batadv_bla_backbone_gw *backbone_gw)
{ {
...@@ -126,14 +153,22 @@ batadv_backbone_gw_free_ref(struct batadv_bla_backbone_gw *backbone_gw) ...@@ -126,14 +153,22 @@ batadv_backbone_gw_free_ref(struct batadv_bla_backbone_gw *backbone_gw)
kfree_rcu(backbone_gw, rcu); kfree_rcu(backbone_gw, rcu);
} }
/* finally deinitialize the claim */ /**
* batadv_claim_release - release claim from lists and queue for free after rcu
* grace period
* @ref: kref pointer of the claim
*/
static void batadv_claim_release(struct batadv_bla_claim *claim) static void batadv_claim_release(struct batadv_bla_claim *claim)
{ {
batadv_backbone_gw_free_ref(claim->backbone_gw); batadv_backbone_gw_free_ref(claim->backbone_gw);
kfree_rcu(claim, rcu); kfree_rcu(claim, rcu);
} }
/* free a claim, call claim_free_rcu if its the last reference */ /**
* batadv_claim_free_ref - decrement the claim refcounter and possibly
* release it
* @claim: claim to be free'd
*/
static void batadv_claim_free_ref(struct batadv_bla_claim *claim) static void batadv_claim_free_ref(struct batadv_bla_claim *claim)
{ {
if (atomic_dec_and_test(&claim->refcount)) if (atomic_dec_and_test(&claim->refcount))
...@@ -141,12 +176,11 @@ static void batadv_claim_free_ref(struct batadv_bla_claim *claim) ...@@ -141,12 +176,11 @@ static void batadv_claim_free_ref(struct batadv_bla_claim *claim)
} }
/** /**
* batadv_claim_hash_find * batadv_claim_hash_find - looks for a claim in the claim hash
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @data: search data (may be local/static data) * @data: search data (may be local/static data)
* *
* looks for a claim in the hash, and returns it if found * Return: claim if found or NULL otherwise.
* or NULL otherwise.
*/ */
static struct batadv_bla_claim static struct batadv_bla_claim
*batadv_claim_hash_find(struct batadv_priv *bat_priv, *batadv_claim_hash_find(struct batadv_priv *bat_priv,
...@@ -181,12 +215,12 @@ static struct batadv_bla_claim ...@@ -181,12 +215,12 @@ static struct batadv_bla_claim
} }
/** /**
* batadv_backbone_hash_find - looks for a claim in the hash * batadv_backbone_hash_find - looks for a backbone gateway in the hash
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @addr: the address of the originator * @addr: the address of the originator
* @vid: the VLAN ID * @vid: the VLAN ID
* *
* Returns claim if found or NULL otherwise. * Return: backbone gateway if found or NULL otherwise
*/ */
static struct batadv_bla_backbone_gw * static struct batadv_bla_backbone_gw *
batadv_backbone_hash_find(struct batadv_priv *bat_priv, u8 *addr, batadv_backbone_hash_find(struct batadv_priv *bat_priv, u8 *addr,
...@@ -224,7 +258,10 @@ batadv_backbone_hash_find(struct batadv_priv *bat_priv, u8 *addr, ...@@ -224,7 +258,10 @@ batadv_backbone_hash_find(struct batadv_priv *bat_priv, u8 *addr,
return backbone_gw_tmp; return backbone_gw_tmp;
} }
/* delete all claims for a backbone */ /**
* batadv_bla_del_backbone_claims - delete all claims for a backbone
* @backbone_gw: backbone gateway where the claims should be removed
*/
static void static void
batadv_bla_del_backbone_claims(struct batadv_bla_backbone_gw *backbone_gw) batadv_bla_del_backbone_claims(struct batadv_bla_backbone_gw *backbone_gw)
{ {
...@@ -372,14 +409,13 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, u8 *mac, ...@@ -372,14 +409,13 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, u8 *mac,
} }
/** /**
* batadv_bla_get_backbone_gw * batadv_bla_get_backbone_gw - finds or creates a backbone gateway
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @orig: the mac address of the originator * @orig: the mac address of the originator
* @vid: the VLAN ID * @vid: the VLAN ID
* @own_backbone: set if the requested backbone is local * @own_backbone: set if the requested backbone is local
* *
* searches for the backbone gw or creates a new one if it could not * Return: the (possibly created) backbone gateway or NULL on error
* be found.
*/ */
static struct batadv_bla_backbone_gw * static struct batadv_bla_backbone_gw *
batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, u8 *orig, batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, u8 *orig,
...@@ -445,7 +481,13 @@ batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, u8 *orig, ...@@ -445,7 +481,13 @@ batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, u8 *orig,
return entry; return entry;
} }
/* update or add the own backbone gw to make sure we announce /**
* batadv_bla_update_own_backbone_gw - updates the own backbone gw for a VLAN
* @bat_priv: the bat priv with all the soft interface information
* @primary_if: the selected primary interface
* @vid: VLAN identifier
*
* update or add the own backbone gw to make sure we announce
* where we receive other backbone gws * where we receive other backbone gws
*/ */
static void static void
...@@ -542,12 +584,9 @@ static void batadv_bla_send_request(struct batadv_bla_backbone_gw *backbone_gw) ...@@ -542,12 +584,9 @@ static void batadv_bla_send_request(struct batadv_bla_backbone_gw *backbone_gw)
} }
/** /**
* batadv_bla_send_announce * batadv_bla_send_announce - Send an announcement frame
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @backbone_gw: our backbone gateway which should be announced * @backbone_gw: our backbone gateway which should be announced
*
* This function sends an announcement. It is called from multiple
* places.
*/ */
static void batadv_bla_send_announce(struct batadv_priv *bat_priv, static void batadv_bla_send_announce(struct batadv_priv *bat_priv,
struct batadv_bla_backbone_gw *backbone_gw) struct batadv_bla_backbone_gw *backbone_gw)
...@@ -637,8 +676,11 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv, ...@@ -637,8 +676,11 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv,
batadv_claim_free_ref(claim); batadv_claim_free_ref(claim);
} }
/* Delete a claim from the claim hash which has the /**
* given mac address and vid. * batadv_bla_del_claim - delete a claim from the claim hash
* @bat_priv: the bat priv with all the soft interface information
* @mac: mac address of the claim to be removed
* @vid: VLAN id for the claim to be removed
*/ */
static void batadv_bla_del_claim(struct batadv_priv *bat_priv, static void batadv_bla_del_claim(struct batadv_priv *bat_priv,
const u8 *mac, const unsigned short vid) const u8 *mac, const unsigned short vid)
...@@ -666,7 +708,15 @@ static void batadv_bla_del_claim(struct batadv_priv *bat_priv, ...@@ -666,7 +708,15 @@ static void batadv_bla_del_claim(struct batadv_priv *bat_priv,
batadv_claim_free_ref(claim); batadv_claim_free_ref(claim);
} }
/* check for ANNOUNCE frame, return 1 if handled */ /**
* batadv_handle_announce - check for ANNOUNCE frame
* @bat_priv: the bat priv with all the soft interface information
* @an_addr: announcement mac address (ARP Sender HW address)
* @backbone_addr: originator address of the sender (Ethernet source MAC)
* @vid: the VLAN ID of the frame
*
* Return: 1 if handled
*/
static int batadv_handle_announce(struct batadv_priv *bat_priv, u8 *an_addr, static int batadv_handle_announce(struct batadv_priv *bat_priv, u8 *an_addr,
u8 *backbone_addr, unsigned short vid) u8 *backbone_addr, unsigned short vid)
{ {
...@@ -716,7 +766,16 @@ static int batadv_handle_announce(struct batadv_priv *bat_priv, u8 *an_addr, ...@@ -716,7 +766,16 @@ static int batadv_handle_announce(struct batadv_priv *bat_priv, u8 *an_addr,
return 1; return 1;
} }
/* check for REQUEST frame, return 1 if handled */ /**
* batadv_handle_request - check for REQUEST frame
* @bat_priv: the bat priv with all the soft interface information
* @primary_if: the primary hard interface of this batman soft interface
* @backbone_addr: backbone address to be requested (ARP sender HW MAC)
* @ethhdr: ethernet header of a packet
* @vid: the VLAN ID of the frame
*
* Return: 1 if handled
*/
static int batadv_handle_request(struct batadv_priv *bat_priv, static int batadv_handle_request(struct batadv_priv *bat_priv,
struct batadv_hard_iface *primary_if, struct batadv_hard_iface *primary_if,
u8 *backbone_addr, struct ethhdr *ethhdr, u8 *backbone_addr, struct ethhdr *ethhdr,
...@@ -740,7 +799,16 @@ static int batadv_handle_request(struct batadv_priv *bat_priv, ...@@ -740,7 +799,16 @@ static int batadv_handle_request(struct batadv_priv *bat_priv,
return 1; return 1;
} }
/* check for UNCLAIM frame, return 1 if handled */ /**
* batadv_handle_unclaim - check for UNCLAIM frame
* @bat_priv: the bat priv with all the soft interface information
* @primary_if: the primary hard interface of this batman soft interface
* @backbone_addr: originator address of the backbone (Ethernet source)
* @claim_addr: Client to be unclaimed (ARP sender HW MAC)
* @vid: the VLAN ID of the frame
*
* Return: 1 if handled
*/
static int batadv_handle_unclaim(struct batadv_priv *bat_priv, static int batadv_handle_unclaim(struct batadv_priv *bat_priv,
struct batadv_hard_iface *primary_if, struct batadv_hard_iface *primary_if,
u8 *backbone_addr, u8 *claim_addr, u8 *backbone_addr, u8 *claim_addr,
...@@ -769,7 +837,16 @@ static int batadv_handle_unclaim(struct batadv_priv *bat_priv, ...@@ -769,7 +837,16 @@ static int batadv_handle_unclaim(struct batadv_priv *bat_priv,
return 1; return 1;
} }
/* check for CLAIM frame, return 1 if handled */ /**
* batadv_handle_claim - check for CLAIM frame
* @bat_priv: the bat priv with all the soft interface information
* @primary_if: the primary hard interface of this batman soft interface
* @backbone_addr: originator address of the backbone (Ethernet Source)
* @claim_addr: client mac address to be claimed (ARP sender HW MAC)
* @vid: the VLAN ID of the frame
*
* Return: 1 if handled
*/
static int batadv_handle_claim(struct batadv_priv *bat_priv, static int batadv_handle_claim(struct batadv_priv *bat_priv,
struct batadv_hard_iface *primary_if, struct batadv_hard_iface *primary_if,
u8 *backbone_addr, u8 *claim_addr, u8 *backbone_addr, u8 *claim_addr,
...@@ -798,7 +875,7 @@ static int batadv_handle_claim(struct batadv_priv *bat_priv, ...@@ -798,7 +875,7 @@ static int batadv_handle_claim(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_check_claim_group * batadv_check_claim_group - check for claim group membership
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @primary_if: the primary interface of this batman interface * @primary_if: the primary interface of this batman interface
* @hw_src: the Hardware source in the ARP Header * @hw_src: the Hardware source in the ARP Header
...@@ -809,7 +886,7 @@ static int batadv_handle_claim(struct batadv_priv *bat_priv, ...@@ -809,7 +886,7 @@ static int batadv_handle_claim(struct batadv_priv *bat_priv,
* This function also applies the group ID of the sender * This function also applies the group ID of the sender
* if it is in the same mesh. * if it is in the same mesh.
* *
* returns: * Return:
* 2 - if it is a claim packet and on the same group * 2 - if it is a claim packet and on the same group
* 1 - if is a claim packet from another group * 1 - if is a claim packet from another group
* 0 - if it is not a claim packet * 0 - if it is not a claim packet
...@@ -873,14 +950,12 @@ static int batadv_check_claim_group(struct batadv_priv *bat_priv, ...@@ -873,14 +950,12 @@ static int batadv_check_claim_group(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_bla_process_claim * batadv_bla_process_claim - Check if this is a claim frame, and process it
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @primary_if: the primary hard interface of this batman soft interface * @primary_if: the primary hard interface of this batman soft interface
* @skb: the frame to be checked * @skb: the frame to be checked
* *
* Check if this is a claim frame, and process it accordingly. * Return: 1 if it was a claim frame, otherwise return 0 to
*
* returns 1 if it was a claim frame, otherwise return 0 to
* tell the callee that it can use the frame on its own. * tell the callee that it can use the frame on its own.
*/ */
static int batadv_bla_process_claim(struct batadv_priv *bat_priv, static int batadv_bla_process_claim(struct batadv_priv *bat_priv,
...@@ -1011,7 +1086,13 @@ static int batadv_bla_process_claim(struct batadv_priv *bat_priv, ...@@ -1011,7 +1086,13 @@ static int batadv_bla_process_claim(struct batadv_priv *bat_priv,
return 1; return 1;
} }
/* Check when we last heard from other nodes, and remove them in case of /**
* batadv_bla_purge_backbone_gw - Remove backbone gateways after a timeout or
* immediately
* @bat_priv: the bat priv with all the soft interface information
* @now: whether the whole hash shall be wiped now
*
* Check when we last heard from other nodes, and remove them in case of
* a time out, or clean all backbone gws if now is set. * a time out, or clean all backbone gws if now is set.
*/ */
static void batadv_bla_purge_backbone_gw(struct batadv_priv *bat_priv, int now) static void batadv_bla_purge_backbone_gw(struct batadv_priv *bat_priv, int now)
...@@ -1059,7 +1140,7 @@ static void batadv_bla_purge_backbone_gw(struct batadv_priv *bat_priv, int now) ...@@ -1059,7 +1140,7 @@ static void batadv_bla_purge_backbone_gw(struct batadv_priv *bat_priv, int now)
} }
/** /**
* batadv_bla_purge_claims * batadv_bla_purge_claims - Remove claims after a timeout or immediately
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @primary_if: the selected primary interface, may be NULL if now is set * @primary_if: the selected primary interface, may be NULL if now is set
* @now: whether the whole hash shall be wiped now * @now: whether the whole hash shall be wiped now
...@@ -1108,12 +1189,11 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv, ...@@ -1108,12 +1189,11 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_bla_update_orig_address * batadv_bla_update_orig_address - Update the backbone gateways when the own
* originator address changes
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @primary_if: the new selected primary_if * @primary_if: the new selected primary_if
* @oldif: the old primary interface, may be NULL * @oldif: the old primary interface, may be NULL
*
* Update the backbone gateways when the own orig address changes.
*/ */
void batadv_bla_update_orig_address(struct batadv_priv *bat_priv, void batadv_bla_update_orig_address(struct batadv_priv *bat_priv,
struct batadv_hard_iface *primary_if, struct batadv_hard_iface *primary_if,
...@@ -1184,7 +1264,11 @@ void batadv_bla_status_update(struct net_device *net_dev) ...@@ -1184,7 +1264,11 @@ void batadv_bla_status_update(struct net_device *net_dev)
batadv_hardif_free_ref(primary_if); batadv_hardif_free_ref(primary_if);
} }
/* periodic work to do: /**
* batadv_bla_periodic_work - performs periodic bla work
* @work: kernel work struct
*
* periodic work to do:
* * purge structures when they are too old * * purge structures when they are too old
* * send announcements * * send announcements
*/ */
...@@ -1265,7 +1349,12 @@ static void batadv_bla_periodic_work(struct work_struct *work) ...@@ -1265,7 +1349,12 @@ static void batadv_bla_periodic_work(struct work_struct *work)
static struct lock_class_key batadv_claim_hash_lock_class_key; static struct lock_class_key batadv_claim_hash_lock_class_key;
static struct lock_class_key batadv_backbone_hash_lock_class_key; static struct lock_class_key batadv_backbone_hash_lock_class_key;
/* initialize all bla structures */ /**
* batadv_bla_init - initialize all bla structures
* @bat_priv: the bat priv with all the soft interface information
*
* Return: 0 on success, < 0 on error.
*/
int batadv_bla_init(struct batadv_priv *bat_priv) int batadv_bla_init(struct batadv_priv *bat_priv)
{ {
int i; int i;
...@@ -1320,7 +1409,7 @@ int batadv_bla_init(struct batadv_priv *bat_priv) ...@@ -1320,7 +1409,7 @@ int batadv_bla_init(struct batadv_priv *bat_priv)
} }
/** /**
* batadv_bla_check_bcast_duplist * batadv_bla_check_bcast_duplist - Check if a frame is in the broadcast dup.
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @skb: contains the bcast_packet to be checked * @skb: contains the bcast_packet to be checked
* *
...@@ -1332,6 +1421,8 @@ int batadv_bla_init(struct batadv_priv *bat_priv) ...@@ -1332,6 +1421,8 @@ int batadv_bla_init(struct batadv_priv *bat_priv)
* with a good chance that it is the same packet. If it is furthermore * with a good chance that it is the same packet. If it is furthermore
* sent by another host, drop it. We allow equal packets from * sent by another host, drop it. We allow equal packets from
* the same host however as this might be intended. * the same host however as this might be intended.
*
* Return: 1 if a packet is in the duplicate list, 0 otherwise.
*/ */
int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
struct sk_buff *skb) struct sk_buff *skb)
...@@ -1390,14 +1481,13 @@ int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, ...@@ -1390,14 +1481,13 @@ int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_bla_is_backbone_gw_orig * batadv_bla_is_backbone_gw_orig - Check if the originator is a gateway for
* the VLAN identified by vid.
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @orig: originator mac address * @orig: originator mac address
* @vid: VLAN identifier * @vid: VLAN identifier
* *
* Check if the originator is a gateway for the VLAN identified by vid. * Return: true if orig is a backbone for this vid, false otherwise.
*
* Returns true if orig is a backbone for this vid, false otherwise.
*/ */
bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, u8 *orig, bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, u8 *orig,
unsigned short vid) unsigned short vid)
...@@ -1431,14 +1521,13 @@ bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, u8 *orig, ...@@ -1431,14 +1521,13 @@ bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, u8 *orig,
} }
/** /**
* batadv_bla_is_backbone_gw * batadv_bla_is_backbone_gw - check if originator is a backbone gw for a VLAN.
* @skb: the frame to be checked * @skb: the frame to be checked
* @orig_node: the orig_node of the frame * @orig_node: the orig_node of the frame
* @hdr_size: maximum length of the frame * @hdr_size: maximum length of the frame
* *
* bla_is_backbone_gw inspects the skb for the VLAN ID and returns 1 * Return: 1 if the orig_node is also a gateway on the soft interface, otherwise
* if the orig_node is also a gateway on the soft interface, otherwise it * it returns 0.
* returns 0.
*/ */
int batadv_bla_is_backbone_gw(struct sk_buff *skb, int batadv_bla_is_backbone_gw(struct sk_buff *skb,
struct batadv_orig_node *orig_node, int hdr_size) struct batadv_orig_node *orig_node, int hdr_size)
...@@ -1465,7 +1554,12 @@ int batadv_bla_is_backbone_gw(struct sk_buff *skb, ...@@ -1465,7 +1554,12 @@ int batadv_bla_is_backbone_gw(struct sk_buff *skb,
return 1; return 1;
} }
/* free all bla structures (for softinterface free or module unload) */ /**
* batadv_bla_init - free all bla structures
* @bat_priv: the bat priv with all the soft interface information
*
* for softinterface free or module unload
*/
void batadv_bla_free(struct batadv_priv *bat_priv) void batadv_bla_free(struct batadv_priv *bat_priv)
{ {
struct batadv_hard_iface *primary_if; struct batadv_hard_iface *primary_if;
...@@ -1488,18 +1582,19 @@ void batadv_bla_free(struct batadv_priv *bat_priv) ...@@ -1488,18 +1582,19 @@ void batadv_bla_free(struct batadv_priv *bat_priv)
} }
/** /**
* batadv_bla_rx * batadv_bla_rx - check packets coming from the mesh.
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @skb: the frame to be checked * @skb: the frame to be checked
* @vid: the VLAN ID of the frame * @vid: the VLAN ID of the frame
* @is_bcast: the packet came in a broadcast packet type. * @is_bcast: the packet came in a broadcast packet type.
* *
* bla_rx avoidance checks if: * batadv_bla_rx avoidance checks if:
* * we have to race for a claim * * we have to race for a claim
* * if the frame is allowed on the LAN * * if the frame is allowed on the LAN
* *
* in these cases, the skb is further handled by this function and * in these cases, the skb is further handled by this function
* returns 1, otherwise it returns 0 and the caller shall further *
* Return: 1 if handled, otherwise it returns 0 and the caller shall further
* process the skb. * process the skb.
*/ */
int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
...@@ -1583,20 +1678,21 @@ int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, ...@@ -1583,20 +1678,21 @@ int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
} }
/** /**
* batadv_bla_tx * batadv_bla_tx - check packets going into the mesh
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @skb: the frame to be checked * @skb: the frame to be checked
* @vid: the VLAN ID of the frame * @vid: the VLAN ID of the frame
* *
* bla_tx checks if: * batadv_bla_tx checks if:
* * a claim was received which has to be processed * * a claim was received which has to be processed
* * the frame is allowed on the mesh * * the frame is allowed on the mesh
* *
* in these cases, the skb is further handled by this function and * in these cases, the skb is further handled by this function.
* returns 1, otherwise it returns 0 and the caller shall further
* process the skb.
* *
* This call might reallocate skb data. * This call might reallocate skb data.
*
* Return: 1 if handled, otherwise it returns 0 and the caller shall further
* process the skb.
*/ */
int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,
unsigned short vid) unsigned short vid)
...@@ -1670,6 +1766,13 @@ int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, ...@@ -1670,6 +1766,13 @@ int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,
return ret; return ret;
} }
/**
* batadv_bla_claim_table_seq_print_text - print the claim table in a seq file
* @seq: seq file to print on
* @offset: not used
*
* Return: always 0
*/
int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
{ {
struct net_device *net_dev = (struct net_device *)seq->private; struct net_device *net_dev = (struct net_device *)seq->private;
...@@ -1719,6 +1822,14 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) ...@@ -1719,6 +1822,14 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
return 0; return 0;
} }
/**
* batadv_bla_backbone_table_seq_print_text - print the backbone table in a seq
* file
* @seq: seq file to print on
* @offset: not used
*
* Return: always 0
*/
int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset) int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset)
{ {
struct net_device *net_dev = (struct net_device *)seq->private; struct net_device *net_dev = (struct net_device *)seq->private;
......
/* Copyright (C) 2011-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2011-2016 B.A.T.M.A.N. contributors:
* *
* Simon Wunderlich * Simon Wunderlich
* *
......
/* Copyright (C) 2010-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2010-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
* *
...@@ -281,6 +281,8 @@ static int batadv_originators_open(struct inode *inode, struct file *file) ...@@ -281,6 +281,8 @@ static int batadv_originators_open(struct inode *inode, struct file *file)
* originator table of an hard interface * originator table of an hard interface
* @inode: inode pointer to debugfs file * @inode: inode pointer to debugfs file
* @file: pointer to the seq_file * @file: pointer to the seq_file
*
* Return: 0 on success or negative error number in case of failure
*/ */
static int batadv_originators_hardif_open(struct inode *inode, static int batadv_originators_hardif_open(struct inode *inode,
struct file *file) struct file *file)
...@@ -329,6 +331,8 @@ static int batadv_bla_backbone_table_open(struct inode *inode, ...@@ -329,6 +331,8 @@ static int batadv_bla_backbone_table_open(struct inode *inode,
* batadv_dat_cache_open - Prepare file handler for reads from dat_chache * batadv_dat_cache_open - Prepare file handler for reads from dat_chache
* @inode: inode which was opened * @inode: inode which was opened
* @file: file handle to be initialized * @file: file handle to be initialized
*
* Return: 0 on success or negative error number in case of failure
*/ */
static int batadv_dat_cache_open(struct inode *inode, struct file *file) static int batadv_dat_cache_open(struct inode *inode, struct file *file)
{ {
...@@ -483,6 +487,8 @@ void batadv_debugfs_destroy(void) ...@@ -483,6 +487,8 @@ void batadv_debugfs_destroy(void)
* batadv_debugfs_add_hardif - creates the base directory for a hard interface * batadv_debugfs_add_hardif - creates the base directory for a hard interface
* in debugfs. * in debugfs.
* @hard_iface: hard interface which should be added. * @hard_iface: hard interface which should be added.
*
* Return: 0 on success or negative error number in case of failure
*/ */
int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface) int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface)
{ {
......
/* Copyright (C) 2010-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2010-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
* *
......
/* Copyright (C) 2011-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2011-2016 B.A.T.M.A.N. contributors:
* *
* Antonio Quartulli * Antonio Quartulli
* *
...@@ -76,7 +76,7 @@ static void batadv_dat_entry_free_ref(struct batadv_dat_entry *dat_entry) ...@@ -76,7 +76,7 @@ static void batadv_dat_entry_free_ref(struct batadv_dat_entry *dat_entry)
* batadv_dat_to_purge - check whether a dat_entry has to be purged or not * batadv_dat_to_purge - check whether a dat_entry has to be purged or not
* @dat_entry: the entry to check * @dat_entry: the entry to check
* *
* Returns true if the entry has to be purged now, false otherwise. * Return: true if the entry has to be purged now, false otherwise.
*/ */
static bool batadv_dat_to_purge(struct batadv_dat_entry *dat_entry) static bool batadv_dat_to_purge(struct batadv_dat_entry *dat_entry)
{ {
...@@ -151,7 +151,7 @@ static void batadv_dat_purge(struct work_struct *work) ...@@ -151,7 +151,7 @@ static void batadv_dat_purge(struct work_struct *work)
* @node: node in the local table * @node: node in the local table
* @data2: second object to compare the node to * @data2: second object to compare the node to
* *
* Returns 1 if the two entries are the same, 0 otherwise. * Return: 1 if the two entries are the same, 0 otherwise.
*/ */
static int batadv_compare_dat(const struct hlist_node *node, const void *data2) static int batadv_compare_dat(const struct hlist_node *node, const void *data2)
{ {
...@@ -166,7 +166,7 @@ static int batadv_compare_dat(const struct hlist_node *node, const void *data2) ...@@ -166,7 +166,7 @@ static int batadv_compare_dat(const struct hlist_node *node, const void *data2)
* @skb: ARP packet * @skb: ARP packet
* @hdr_size: size of the possible header before the ARP packet * @hdr_size: size of the possible header before the ARP packet
* *
* Returns the value of the hw_src field in the ARP packet. * Return: the value of the hw_src field in the ARP packet.
*/ */
static u8 *batadv_arp_hw_src(struct sk_buff *skb, int hdr_size) static u8 *batadv_arp_hw_src(struct sk_buff *skb, int hdr_size)
{ {
...@@ -183,7 +183,7 @@ static u8 *batadv_arp_hw_src(struct sk_buff *skb, int hdr_size) ...@@ -183,7 +183,7 @@ static u8 *batadv_arp_hw_src(struct sk_buff *skb, int hdr_size)
* @skb: ARP packet * @skb: ARP packet
* @hdr_size: size of the possible header before the ARP packet * @hdr_size: size of the possible header before the ARP packet
* *
* Returns the value of the ip_src field in the ARP packet. * Return: the value of the ip_src field in the ARP packet.
*/ */
static __be32 batadv_arp_ip_src(struct sk_buff *skb, int hdr_size) static __be32 batadv_arp_ip_src(struct sk_buff *skb, int hdr_size)
{ {
...@@ -195,7 +195,7 @@ static __be32 batadv_arp_ip_src(struct sk_buff *skb, int hdr_size) ...@@ -195,7 +195,7 @@ static __be32 batadv_arp_ip_src(struct sk_buff *skb, int hdr_size)
* @skb: ARP packet * @skb: ARP packet
* @hdr_size: size of the possible header before the ARP packet * @hdr_size: size of the possible header before the ARP packet
* *
* Returns the value of the hw_dst field in the ARP packet. * Return: the value of the hw_dst field in the ARP packet.
*/ */
static u8 *batadv_arp_hw_dst(struct sk_buff *skb, int hdr_size) static u8 *batadv_arp_hw_dst(struct sk_buff *skb, int hdr_size)
{ {
...@@ -207,7 +207,7 @@ static u8 *batadv_arp_hw_dst(struct sk_buff *skb, int hdr_size) ...@@ -207,7 +207,7 @@ static u8 *batadv_arp_hw_dst(struct sk_buff *skb, int hdr_size)
* @skb: ARP packet * @skb: ARP packet
* @hdr_size: size of the possible header before the ARP packet * @hdr_size: size of the possible header before the ARP packet
* *
* Returns the value of the ip_dst field in the ARP packet. * Return: the value of the ip_dst field in the ARP packet.
*/ */
static __be32 batadv_arp_ip_dst(struct sk_buff *skb, int hdr_size) static __be32 batadv_arp_ip_dst(struct sk_buff *skb, int hdr_size)
{ {
...@@ -219,7 +219,7 @@ static __be32 batadv_arp_ip_dst(struct sk_buff *skb, int hdr_size) ...@@ -219,7 +219,7 @@ static __be32 batadv_arp_ip_dst(struct sk_buff *skb, int hdr_size)
* @data: data to hash * @data: data to hash
* @size: size of the hash table * @size: size of the hash table
* *
* Returns the selected index in the hash table for the given data. * Return: the selected index in the hash table for the given data.
*/ */
static u32 batadv_hash_dat(const void *data, u32 size) static u32 batadv_hash_dat(const void *data, u32 size)
{ {
...@@ -256,7 +256,7 @@ static u32 batadv_hash_dat(const void *data, u32 size) ...@@ -256,7 +256,7 @@ static u32 batadv_hash_dat(const void *data, u32 size)
* @ip: search key * @ip: search key
* @vid: VLAN identifier * @vid: VLAN identifier
* *
* Returns the dat_entry if found, NULL otherwise. * Return: the dat_entry if found, NULL otherwise.
*/ */
static struct batadv_dat_entry * static struct batadv_dat_entry *
batadv_dat_entry_hash_find(struct batadv_priv *bat_priv, __be32 ip, batadv_dat_entry_hash_find(struct batadv_priv *bat_priv, __be32 ip,
...@@ -440,7 +440,7 @@ static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb, ...@@ -440,7 +440,7 @@ static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb,
* @candidate: orig_node under evaluation * @candidate: orig_node under evaluation
* @max_orig_node: last selected candidate * @max_orig_node: last selected candidate
* *
* Returns true if the node has been elected as next candidate or false * Return: true if the node has been elected as next candidate or false
* otherwise. * otherwise.
*/ */
static bool batadv_is_orig_node_eligible(struct batadv_dat_candidate *res, static bool batadv_is_orig_node_eligible(struct batadv_dat_candidate *res,
...@@ -558,7 +558,7 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv, ...@@ -558,7 +558,7 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv,
* closest values (from the LEFT, with wrap around if needed) then the hash * closest values (from the LEFT, with wrap around if needed) then the hash
* value of the key. ip_dst is the key. * value of the key. ip_dst is the key.
* *
* Returns the candidate array of size BATADV_DAT_CANDIDATE_NUM. * Return: the candidate array of size BATADV_DAT_CANDIDATE_NUM.
*/ */
static struct batadv_dat_candidate * static struct batadv_dat_candidate *
batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst)
...@@ -602,7 +602,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) ...@@ -602,7 +602,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst)
* This function copies the skb with pskb_copy() and is sent as unicast packet * This function copies the skb with pskb_copy() and is sent as unicast packet
* to each of the selected candidates. * to each of the selected candidates.
* *
* Returns true if the packet is sent to at least one candidate, false * Return: true if the packet is sent to at least one candidate, false
* otherwise. * otherwise.
*/ */
static bool batadv_dat_send_data(struct batadv_priv *bat_priv, static bool batadv_dat_send_data(struct batadv_priv *bat_priv,
...@@ -741,6 +741,8 @@ static void batadv_dat_hash_free(struct batadv_priv *bat_priv) ...@@ -741,6 +741,8 @@ static void batadv_dat_hash_free(struct batadv_priv *bat_priv)
/** /**
* batadv_dat_init - initialise the DAT internals * batadv_dat_init - initialise the DAT internals
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
*
* Return: 0 in case of success, a negative error code otherwise
*/ */
int batadv_dat_init(struct batadv_priv *bat_priv) int batadv_dat_init(struct batadv_priv *bat_priv)
{ {
...@@ -779,6 +781,8 @@ void batadv_dat_free(struct batadv_priv *bat_priv) ...@@ -779,6 +781,8 @@ void batadv_dat_free(struct batadv_priv *bat_priv)
* batadv_dat_cache_seq_print_text - print the local DAT hash table * batadv_dat_cache_seq_print_text - print the local DAT hash table
* @seq: seq file to print on * @seq: seq file to print on
* @offset: not used * @offset: not used
*
* Return: always 0
*/ */
int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset) int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset)
{ {
...@@ -831,7 +835,7 @@ int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset) ...@@ -831,7 +835,7 @@ int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset)
* @skb: packet to analyse * @skb: packet to analyse
* @hdr_size: size of the possible header before the ARP packet in the skb * @hdr_size: size of the possible header before the ARP packet in the skb
* *
* Returns the ARP type if the skb contains a valid ARP packet, 0 otherwise. * Return: the ARP type if the skb contains a valid ARP packet, 0 otherwise.
*/ */
static u16 batadv_arp_get_type(struct batadv_priv *bat_priv, static u16 batadv_arp_get_type(struct batadv_priv *bat_priv,
struct sk_buff *skb, int hdr_size) struct sk_buff *skb, int hdr_size)
...@@ -904,8 +908,9 @@ static u16 batadv_arp_get_type(struct batadv_priv *bat_priv, ...@@ -904,8 +908,9 @@ static u16 batadv_arp_get_type(struct batadv_priv *bat_priv,
* @skb: the buffer containing the packet to extract the VID from * @skb: the buffer containing the packet to extract the VID from
* @hdr_size: the size of the batman-adv header encapsulating the packet * @hdr_size: the size of the batman-adv header encapsulating the packet
* *
* If the packet embedded in the skb is vlan tagged this function returns the * Return: If the packet embedded in the skb is vlan tagged this function
* VID with the BATADV_VLAN_HAS_TAG flag. Otherwise BATADV_NO_FLAGS is returned. * returns the VID with the BATADV_VLAN_HAS_TAG flag. Otherwise BATADV_NO_FLAGS
* is returned.
*/ */
static unsigned short batadv_dat_get_vid(struct sk_buff *skb, int *hdr_size) static unsigned short batadv_dat_get_vid(struct sk_buff *skb, int *hdr_size)
{ {
...@@ -930,7 +935,7 @@ static unsigned short batadv_dat_get_vid(struct sk_buff *skb, int *hdr_size) ...@@ -930,7 +935,7 @@ static unsigned short batadv_dat_get_vid(struct sk_buff *skb, int *hdr_size)
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @skb: packet to check * @skb: packet to check
* *
* Returns true if the message has been sent to the dht candidates, false * Return: true if the message has been sent to the dht candidates, false
* otherwise. In case of a positive return value the message has to be enqueued * otherwise. In case of a positive return value the message has to be enqueued
* to permit the fallback. * to permit the fallback.
*/ */
...@@ -1020,7 +1025,7 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv, ...@@ -1020,7 +1025,7 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
* @skb: packet to check * @skb: packet to check
* @hdr_size: size of the encapsulation header * @hdr_size: size of the encapsulation header
* *
* Returns true if the request has been answered, false otherwise. * Return: true if the request has been answered, false otherwise.
*/ */
bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv, bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv,
struct sk_buff *skb, int hdr_size) struct sk_buff *skb, int hdr_size)
...@@ -1143,7 +1148,7 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv, ...@@ -1143,7 +1148,7 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv,
* @skb: packet to check * @skb: packet to check
* @hdr_size: size of the encapsulation header * @hdr_size: size of the encapsulation header
* *
* Returns true if the packet was snooped and consumed by DAT. False if the * Return: true if the packet was snooped and consumed by DAT. False if the
* packet has to be delivered to the interface * packet has to be delivered to the interface
*/ */
bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,
...@@ -1200,7 +1205,7 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, ...@@ -1200,7 +1205,7 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @forw_packet: the broadcast packet * @forw_packet: the broadcast packet
* *
* Returns true if the node can drop the packet, false otherwise. * Return: true if the node can drop the packet, false otherwise.
*/ */
bool batadv_dat_drop_broadcast_packet(struct batadv_priv *bat_priv, bool batadv_dat_drop_broadcast_packet(struct batadv_priv *bat_priv,
struct batadv_forw_packet *forw_packet) struct batadv_forw_packet *forw_packet)
......
/* Copyright (C) 2011-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2011-2016 B.A.T.M.A.N. contributors:
* *
* Antonio Quartulli * Antonio Quartulli
* *
......
/* Copyright (C) 2013-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2013-2016 B.A.T.M.A.N. contributors:
* *
* Martin Hundebøll <martin@hundeboll.net> * Martin Hundebøll <martin@hundeboll.net>
* *
...@@ -85,7 +85,7 @@ void batadv_frag_purge_orig(struct batadv_orig_node *orig_node, ...@@ -85,7 +85,7 @@ void batadv_frag_purge_orig(struct batadv_orig_node *orig_node,
/** /**
* batadv_frag_size_limit - maximum possible size of packet to be fragmented * batadv_frag_size_limit - maximum possible size of packet to be fragmented
* *
* Returns the maximum size of payload that can be fragmented. * Return: the maximum size of payload that can be fragmented.
*/ */
static int batadv_frag_size_limit(void) static int batadv_frag_size_limit(void)
{ {
...@@ -107,7 +107,7 @@ static int batadv_frag_size_limit(void) ...@@ -107,7 +107,7 @@ static int batadv_frag_size_limit(void)
* *
* Caller must hold chain->lock. * Caller must hold chain->lock.
* *
* Returns true if chain is empty and caller can just insert the new fragment * Return: true if chain is empty and caller can just insert the new fragment
* without searching for the right position. * without searching for the right position.
*/ */
static bool batadv_frag_init_chain(struct batadv_frag_table_entry *chain, static bool batadv_frag_init_chain(struct batadv_frag_table_entry *chain,
...@@ -136,7 +136,7 @@ static bool batadv_frag_init_chain(struct batadv_frag_table_entry *chain, ...@@ -136,7 +136,7 @@ static bool batadv_frag_init_chain(struct batadv_frag_table_entry *chain,
* Insert a new fragment into the reverse ordered chain in the right table * Insert a new fragment into the reverse ordered chain in the right table
* entry. The hash table entry is cleared if "old" fragments exist in it. * entry. The hash table entry is cleared if "old" fragments exist in it.
* *
* Returns true if skb is buffered, false on error. If the chain has all the * Return: true if skb is buffered, false on error. If the chain has all the
* fragments needed to merge the packet, the chain is moved to the passed head * fragments needed to merge the packet, the chain is moved to the passed head
* to avoid locking the chain in the table. * to avoid locking the chain in the table.
*/ */
...@@ -242,12 +242,11 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node, ...@@ -242,12 +242,11 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
/** /**
* batadv_frag_merge_packets - merge a chain of fragments * batadv_frag_merge_packets - merge a chain of fragments
* @chain: head of chain with fragments * @chain: head of chain with fragments
* @skb: packet with total size of skb after merging
* *
* Expand the first skb in the chain and copy the content of the remaining * Expand the first skb in the chain and copy the content of the remaining
* skb's into the expanded one. After doing so, clear the chain. * skb's into the expanded one. After doing so, clear the chain.
* *
* Returns the merged skb or NULL on error. * Return: the merged skb or NULL on error.
*/ */
static struct sk_buff * static struct sk_buff *
batadv_frag_merge_packets(struct hlist_head *chain) batadv_frag_merge_packets(struct hlist_head *chain)
...@@ -307,6 +306,9 @@ batadv_frag_merge_packets(struct hlist_head *chain) ...@@ -307,6 +306,9 @@ batadv_frag_merge_packets(struct hlist_head *chain)
* There are three possible outcomes: 1) Packet is merged: Return true and * There are three possible outcomes: 1) Packet is merged: Return true and
* set *skb to merged packet; 2) Packet is buffered: Return true and set *skb * set *skb to merged packet; 2) Packet is buffered: Return true and set *skb
* to NULL; 3) Error: Return false and leave skb as is. * to NULL; 3) Error: Return false and leave skb as is.
*
* Return: true when packet is merged or buffered, false when skb is not not
* used.
*/ */
bool batadv_frag_skb_buffer(struct sk_buff **skb, bool batadv_frag_skb_buffer(struct sk_buff **skb,
struct batadv_orig_node *orig_node_src) struct batadv_orig_node *orig_node_src)
...@@ -344,7 +346,7 @@ bool batadv_frag_skb_buffer(struct sk_buff **skb, ...@@ -344,7 +346,7 @@ bool batadv_frag_skb_buffer(struct sk_buff **skb,
* will exceed the MTU towards the next-hop. If so, the fragment is forwarded * will exceed the MTU towards the next-hop. If so, the fragment is forwarded
* without merging it. * without merging it.
* *
* Returns true if the fragment is consumed/forwarded, false otherwise. * Return: true if the fragment is consumed/forwarded, false otherwise.
*/ */
bool batadv_frag_skb_fwd(struct sk_buff *skb, bool batadv_frag_skb_fwd(struct sk_buff *skb,
struct batadv_hard_iface *recv_if, struct batadv_hard_iface *recv_if,
...@@ -399,7 +401,7 @@ bool batadv_frag_skb_fwd(struct sk_buff *skb, ...@@ -399,7 +401,7 @@ bool batadv_frag_skb_fwd(struct sk_buff *skb,
* passed mtu and the old one with the rest. The new skb contains data from the * passed mtu and the old one with the rest. The new skb contains data from the
* tail of the old skb. * tail of the old skb.
* *
* Returns the new fragment, NULL on error. * Return: the new fragment, NULL on error.
*/ */
static struct sk_buff *batadv_frag_create(struct sk_buff *skb, static struct sk_buff *batadv_frag_create(struct sk_buff *skb,
struct batadv_frag_packet *frag_head, struct batadv_frag_packet *frag_head,
...@@ -433,7 +435,7 @@ static struct sk_buff *batadv_frag_create(struct sk_buff *skb, ...@@ -433,7 +435,7 @@ static struct sk_buff *batadv_frag_create(struct sk_buff *skb,
* @orig_node: final destination of the created fragments * @orig_node: final destination of the created fragments
* @neigh_node: next-hop of the created fragments * @neigh_node: next-hop of the created fragments
* *
* Returns true on success, false otherwise. * Return: true on success, false otherwise.
*/ */
bool batadv_frag_send_packet(struct sk_buff *skb, bool batadv_frag_send_packet(struct sk_buff *skb,
struct batadv_orig_node *orig_node, struct batadv_orig_node *orig_node,
......
/* Copyright (C) 2013-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2013-2016 B.A.T.M.A.N. contributors:
* *
* Martin Hundebøll <martin@hundeboll.net> * Martin Hundebøll <martin@hundeboll.net>
* *
...@@ -42,7 +42,7 @@ bool batadv_frag_send_packet(struct sk_buff *skb, ...@@ -42,7 +42,7 @@ bool batadv_frag_send_packet(struct sk_buff *skb,
* batadv_frag_check_entry - check if a list of fragments has timed out * batadv_frag_check_entry - check if a list of fragments has timed out
* @frags_entry: table entry to check * @frags_entry: table entry to check
* *
* Returns true if the frags entry has timed out, false otherwise. * Return: true if the frags entry has timed out, false otherwise.
*/ */
static inline bool static inline bool
batadv_frag_check_entry(struct batadv_frag_table_entry *frags_entry) batadv_frag_check_entry(struct batadv_frag_table_entry *frags_entry)
......
/* Copyright (C) 2009-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2009-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
* *
...@@ -456,7 +456,7 @@ static void batadv_gw_node_add(struct batadv_priv *bat_priv, ...@@ -456,7 +456,7 @@ static void batadv_gw_node_add(struct batadv_priv *bat_priv,
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @orig_node: originator announcing gateway capabilities * @orig_node: originator announcing gateway capabilities
* *
* Returns gateway node if found or NULL otherwise. * Return: gateway node if found or NULL otherwise.
*/ */
static struct batadv_gw_node * static struct batadv_gw_node *
batadv_gw_node_get(struct batadv_priv *bat_priv, batadv_gw_node_get(struct batadv_priv *bat_priv,
...@@ -655,13 +655,13 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset) ...@@ -655,13 +655,13 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
* @chaddr: buffer where the client address will be stored. Valid * @chaddr: buffer where the client address will be stored. Valid
* only if the function returns BATADV_DHCP_TO_CLIENT * only if the function returns BATADV_DHCP_TO_CLIENT
* *
* Returns: * This function may re-allocate the data buffer of the skb passed as argument.
*
* Return:
* - BATADV_DHCP_NO if the packet is not a dhcp message or if there was an error * - BATADV_DHCP_NO if the packet is not a dhcp message or if there was an error
* while parsing it * while parsing it
* - BATADV_DHCP_TO_SERVER if this is a message going to the DHCP server * - BATADV_DHCP_TO_SERVER if this is a message going to the DHCP server
* - BATADV_DHCP_TO_CLIENT if this is a message going to a DHCP client * - BATADV_DHCP_TO_CLIENT if this is a message going to a DHCP client
*
* This function may re-allocate the data buffer of the skb passed as argument.
*/ */
enum batadv_dhcp_recipient enum batadv_dhcp_recipient
batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len, batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len,
...@@ -776,11 +776,11 @@ batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len, ...@@ -776,11 +776,11 @@ batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len,
* server. Due to topology changes it may be the case that the GW server * server. Due to topology changes it may be the case that the GW server
* previously selected is not the best one anymore. * previously selected is not the best one anymore.
* *
* Returns true if the packet destination is unicast and it is not the best gw,
* false otherwise.
*
* This call might reallocate skb data. * This call might reallocate skb data.
* Must be invoked only when the DHCP packet is going TO a DHCP SERVER. * Must be invoked only when the DHCP packet is going TO a DHCP SERVER.
*
* Return: true if the packet destination is unicast and it is not the best gw,
* false otherwise.
*/ */
bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
struct sk_buff *skb) struct sk_buff *skb)
......
/* Copyright (C) 2009-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2009-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
* *
......
/* Copyright (C) 2009-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2009-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
* *
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
* @description: text shown when throughput string cannot be parsed * @description: text shown when throughput string cannot be parsed
* @throughput: pointer holding the returned throughput information * @throughput: pointer holding the returned throughput information
* *
* Returns false on parse error and true otherwise. * Return: false on parse error and true otherwise.
*/ */
static bool batadv_parse_throughput(struct net_device *net_dev, char *buff, static bool batadv_parse_throughput(struct net_device *net_dev, char *buff,
const char *description, u32 *throughput) const char *description, u32 *throughput)
......
/* Copyright (C) 2009-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2009-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
* *
......
/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
* *
...@@ -85,7 +85,7 @@ batadv_hardif_get_by_netdev(const struct net_device *net_dev) ...@@ -85,7 +85,7 @@ batadv_hardif_get_by_netdev(const struct net_device *net_dev)
* This function recursively checks all the fathers of the device passed as * This function recursively checks all the fathers of the device passed as
* argument looking for a batman-adv soft interface. * argument looking for a batman-adv soft interface.
* *
* Returns true if the device is descendant of a batman-adv mesh interface (or * Return: true if the device is descendant of a batman-adv mesh interface (or
* if it is a batman-adv interface itself), false otherwise * if it is a batman-adv interface itself), false otherwise
*/ */
static bool batadv_is_on_batman_iface(const struct net_device *net_dev) static bool batadv_is_on_batman_iface(const struct net_device *net_dev)
...@@ -136,7 +136,7 @@ static int batadv_is_valid_iface(const struct net_device *net_dev) ...@@ -136,7 +136,7 @@ static int batadv_is_valid_iface(const struct net_device *net_dev)
* interface * interface
* @net_device: the device to check * @net_device: the device to check
* *
* Returns true if the net device is a 802.11 wireless device, false otherwise. * Return: true if the net device is a 802.11 wireless device, false otherwise.
*/ */
bool batadv_is_wifi_netdev(struct net_device *net_device) bool batadv_is_wifi_netdev(struct net_device *net_device)
{ {
...@@ -401,7 +401,8 @@ batadv_hardif_deactivate_interface(struct batadv_hard_iface *hard_iface) ...@@ -401,7 +401,8 @@ batadv_hardif_deactivate_interface(struct batadv_hard_iface *hard_iface)
* *
* Invoke ndo_del_slave on master passing slave as argument. In this way slave * Invoke ndo_del_slave on master passing slave as argument. In this way slave
* is free'd and master can correctly change its internal state. * is free'd and master can correctly change its internal state.
* Return 0 on success, a negative value representing the error otherwise *
* Return: 0 on success, a negative value representing the error otherwise
*/ */
static int batadv_master_del_slave(struct batadv_hard_iface *slave, static int batadv_master_del_slave(struct batadv_hard_iface *slave,
struct net_device *master) struct net_device *master)
......
/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
* *
......
/* Copyright (C) 2006-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2006-2016 B.A.T.M.A.N. contributors:
* *
* Simon Wunderlich, Marek Lindner * Simon Wunderlich, Marek Lindner
* *
......
/* Copyright (C) 2006-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2006-2016 B.A.T.M.A.N. contributors:
* *
* Simon Wunderlich, Marek Lindner * Simon Wunderlich, Marek Lindner
* *
...@@ -30,14 +30,17 @@ ...@@ -30,14 +30,17 @@
struct lock_class_key; struct lock_class_key;
/* callback to a compare function. should compare 2 element datas for their /* callback to a compare function. should compare 2 element datas for their
* keys, return 0 if same and not 0 if not same * keys
*
* Return: 0 if same and not 0 if not same
*/ */
typedef int (*batadv_hashdata_compare_cb)(const struct hlist_node *, typedef int (*batadv_hashdata_compare_cb)(const struct hlist_node *,
const void *); const void *);
/* the hashfunction, should return an index /* the hashfunction
* based on the key in the data of the first *
* argument and the size the second * Return: an index based on the key in the data of the first argument and the
* size the second
*/ */
typedef u32 (*batadv_hashdata_choose_cb)(const void *, u32); typedef u32 (*batadv_hashdata_choose_cb)(const void *, u32);
typedef void (*batadv_hashdata_free_cb)(struct hlist_node *, void *); typedef void (*batadv_hashdata_free_cb)(struct hlist_node *, void *);
...@@ -96,7 +99,7 @@ static inline void batadv_hash_delete(struct batadv_hashtable *hash, ...@@ -96,7 +99,7 @@ static inline void batadv_hash_delete(struct batadv_hashtable *hash,
* @data: data passed to the aforementioned callbacks as argument * @data: data passed to the aforementioned callbacks as argument
* @data_node: to be added element * @data_node: to be added element
* *
* Returns 0 on success, 1 if the element already is in the hash * Return: 0 on success, 1 if the element already is in the hash
* and -1 on error. * and -1 on error.
*/ */
static inline int batadv_hash_add(struct batadv_hashtable *hash, static inline int batadv_hash_add(struct batadv_hashtable *hash,
...@@ -139,10 +142,11 @@ static inline int batadv_hash_add(struct batadv_hashtable *hash, ...@@ -139,10 +142,11 @@ static inline int batadv_hash_add(struct batadv_hashtable *hash,
return ret; return ret;
} }
/* removes data from hash, if found. returns pointer do data on success, so you /* removes data from hash, if found. data could be the structure you use with
* can remove the used structure yourself, or NULL on error . data could be the * just the key filled, we just need the key for comparing.
* structure you use with just the key filled, we just need the key for *
* comparing. * Return: returns pointer do data on success, so you can remove the used
* structure yourself, or NULL on error
*/ */
static inline void *batadv_hash_remove(struct batadv_hashtable *hash, static inline void *batadv_hash_remove(struct batadv_hashtable *hash,
batadv_hashdata_compare_cb compare, batadv_hashdata_compare_cb compare,
......
/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
* *
......
/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
* *
......
/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
* *
...@@ -233,7 +233,7 @@ void batadv_mesh_free(struct net_device *soft_iface) ...@@ -233,7 +233,7 @@ void batadv_mesh_free(struct net_device *soft_iface)
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @addr: the address to check * @addr: the address to check
* *
* Returns 'true' if the mac address was found, false otherwise. * Return: 'true' if the mac address was found, false otherwise.
*/ */
bool batadv_is_my_mac(struct batadv_priv *bat_priv, const u8 *addr) bool batadv_is_my_mac(struct batadv_priv *bat_priv, const u8 *addr)
{ {
...@@ -262,7 +262,7 @@ bool batadv_is_my_mac(struct batadv_priv *bat_priv, const u8 *addr) ...@@ -262,7 +262,7 @@ bool batadv_is_my_mac(struct batadv_priv *bat_priv, const u8 *addr)
* function that requires the primary interface * function that requires the primary interface
* @seq: debugfs table seq_file struct * @seq: debugfs table seq_file struct
* *
* Returns primary interface if found or NULL otherwise. * Return: primary interface if found or NULL otherwise.
*/ */
struct batadv_hard_iface * struct batadv_hard_iface *
batadv_seq_print_text_primary_if_get(struct seq_file *seq) batadv_seq_print_text_primary_if_get(struct seq_file *seq)
...@@ -297,7 +297,7 @@ batadv_seq_print_text_primary_if_get(struct seq_file *seq) ...@@ -297,7 +297,7 @@ batadv_seq_print_text_primary_if_get(struct seq_file *seq)
* batadv_max_header_len - calculate maximum encapsulation overhead for a * batadv_max_header_len - calculate maximum encapsulation overhead for a
* payload packet * payload packet
* *
* Return the maximum encapsulation overhead in bytes. * Return: the maximum encapsulation overhead in bytes.
*/ */
int batadv_max_header_len(void) int batadv_max_header_len(void)
{ {
...@@ -599,6 +599,8 @@ int batadv_algo_seq_print_text(struct seq_file *seq, void *offset) ...@@ -599,6 +599,8 @@ int batadv_algo_seq_print_text(struct seq_file *seq, void *offset)
* *
* payload_ptr must always point to an address in the skb head buffer and not to * payload_ptr must always point to an address in the skb head buffer and not to
* a fragment. * a fragment.
*
* Return: big endian crc32c of the checksummed data
*/ */
__be32 batadv_skb_crc32(struct sk_buff *skb, u8 *payload_ptr) __be32 batadv_skb_crc32(struct sk_buff *skb, u8 *payload_ptr)
{ {
...@@ -640,7 +642,7 @@ batadv_tvlv_handler_free_ref(struct batadv_tvlv_handler *tvlv_handler) ...@@ -640,7 +642,7 @@ batadv_tvlv_handler_free_ref(struct batadv_tvlv_handler *tvlv_handler)
* @type: tvlv handler type to look for * @type: tvlv handler type to look for
* @version: tvlv handler version to look for * @version: tvlv handler version to look for
* *
* Returns tvlv handler if found or NULL otherwise. * Return: tvlv handler if found or NULL otherwise.
*/ */
static struct batadv_tvlv_handler static struct batadv_tvlv_handler
*batadv_tvlv_handler_get(struct batadv_priv *bat_priv, u8 type, u8 version) *batadv_tvlv_handler_get(struct batadv_priv *bat_priv, u8 type, u8 version)
...@@ -688,7 +690,7 @@ static void batadv_tvlv_container_free_ref(struct batadv_tvlv_container *tvlv) ...@@ -688,7 +690,7 @@ static void batadv_tvlv_container_free_ref(struct batadv_tvlv_container *tvlv)
* Has to be called with the appropriate locks being acquired * Has to be called with the appropriate locks being acquired
* (tvlv.container_list_lock). * (tvlv.container_list_lock).
* *
* Returns tvlv container if found or NULL otherwise. * Return: tvlv container if found or NULL otherwise.
*/ */
static struct batadv_tvlv_container static struct batadv_tvlv_container
*batadv_tvlv_container_get(struct batadv_priv *bat_priv, u8 type, u8 version) *batadv_tvlv_container_get(struct batadv_priv *bat_priv, u8 type, u8 version)
...@@ -720,7 +722,7 @@ static struct batadv_tvlv_container ...@@ -720,7 +722,7 @@ static struct batadv_tvlv_container
* Has to be called with the appropriate locks being acquired * Has to be called with the appropriate locks being acquired
* (tvlv.container_list_lock). * (tvlv.container_list_lock).
* *
* Returns size of all currently registered tvlv containers in bytes. * Return: size of all currently registered tvlv containers in bytes.
*/ */
static u16 batadv_tvlv_container_list_size(struct batadv_priv *bat_priv) static u16 batadv_tvlv_container_list_size(struct batadv_priv *bat_priv)
{ {
...@@ -826,7 +828,7 @@ void batadv_tvlv_container_register(struct batadv_priv *bat_priv, ...@@ -826,7 +828,7 @@ void batadv_tvlv_container_register(struct batadv_priv *bat_priv,
* @additional_packet_len: requested additional packet size on top of minimum * @additional_packet_len: requested additional packet size on top of minimum
* size * size
* *
* Returns true of the packet buffer could be changed to the requested size, * Return: true of the packet buffer could be changed to the requested size,
* false otherwise. * false otherwise.
*/ */
static bool batadv_tvlv_realloc_packet_buff(unsigned char **packet_buff, static bool batadv_tvlv_realloc_packet_buff(unsigned char **packet_buff,
...@@ -862,7 +864,7 @@ static bool batadv_tvlv_realloc_packet_buff(unsigned char **packet_buff, ...@@ -862,7 +864,7 @@ static bool batadv_tvlv_realloc_packet_buff(unsigned char **packet_buff,
* The ogm packet might be enlarged or shrunk depending on the current size * The ogm packet might be enlarged or shrunk depending on the current size
* and the size of the to-be-appended tvlv containers. * and the size of the to-be-appended tvlv containers.
* *
* Returns size of all appended tvlv containers in bytes. * Return: size of all appended tvlv containers in bytes.
*/ */
u16 batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv, u16 batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv,
unsigned char **packet_buff, unsigned char **packet_buff,
...@@ -915,7 +917,7 @@ u16 batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv, ...@@ -915,7 +917,7 @@ u16 batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv,
* @tvlv_value: tvlv content * @tvlv_value: tvlv content
* @tvlv_value_len: tvlv content length * @tvlv_value_len: tvlv content length
* *
* Returns success if handler was not found or the return value of the handler * Return: success if handler was not found or the return value of the handler
* callback. * callback.
*/ */
static int batadv_tvlv_call_handler(struct batadv_priv *bat_priv, static int batadv_tvlv_call_handler(struct batadv_priv *bat_priv,
...@@ -968,7 +970,7 @@ static int batadv_tvlv_call_handler(struct batadv_priv *bat_priv, ...@@ -968,7 +970,7 @@ static int batadv_tvlv_call_handler(struct batadv_priv *bat_priv,
* @tvlv_value: tvlv content * @tvlv_value: tvlv content
* @tvlv_value_len: tvlv content length * @tvlv_value_len: tvlv content length
* *
* Returns success when processing an OGM or the return value of all called * Return: success when processing an OGM or the return value of all called
* handler callbacks. * handler callbacks.
*/ */
int batadv_tvlv_containers_process(struct batadv_priv *bat_priv, int batadv_tvlv_containers_process(struct batadv_priv *bat_priv,
...@@ -1190,8 +1192,8 @@ void batadv_tvlv_unicast_send(struct batadv_priv *bat_priv, u8 *src, ...@@ -1190,8 +1192,8 @@ void batadv_tvlv_unicast_send(struct batadv_priv *bat_priv, u8 *src,
* @skb: the buffer containing the packet * @skb: the buffer containing the packet
* @header_len: length of the batman header preceding the ethernet header * @header_len: length of the batman header preceding the ethernet header
* *
* If the packet embedded in the skb is vlan tagged this function returns the * Return: VID with the BATADV_VLAN_HAS_TAG flag when the packet embedded in the
* VID with the BATADV_VLAN_HAS_TAG flag. Otherwise BATADV_NO_FLAGS is returned. * skb is vlan tagged. Otherwise BATADV_NO_FLAGS.
*/ */
unsigned short batadv_get_vid(struct sk_buff *skb, size_t header_len) unsigned short batadv_get_vid(struct sk_buff *skb, size_t header_len)
{ {
...@@ -1218,7 +1220,7 @@ unsigned short batadv_get_vid(struct sk_buff *skb, size_t header_len) ...@@ -1218,7 +1220,7 @@ unsigned short batadv_get_vid(struct sk_buff *skb, size_t header_len)
* @vid: the VLAN identifier for which the AP isolation attributed as to be * @vid: the VLAN identifier for which the AP isolation attributed as to be
* looked up * looked up
* *
* Returns true if AP isolation is on for the VLAN idenfied by vid, false * Return: true if AP isolation is on for the VLAN idenfied by vid, false
* otherwise * otherwise
*/ */
bool batadv_vlan_ap_isola_get(struct batadv_priv *bat_priv, unsigned short vid) bool batadv_vlan_ap_isola_get(struct batadv_priv *bat_priv, unsigned short vid)
......
/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
* *
...@@ -273,9 +273,14 @@ static inline void _batadv_dbg(int type __always_unused, ...@@ -273,9 +273,14 @@ static inline void _batadv_dbg(int type __always_unused,
pr_err("%s: " fmt, _netdev->name, ## arg); \ pr_err("%s: " fmt, _netdev->name, ## arg); \
} while (0) } while (0)
/* returns 1 if they are the same ethernet addr /**
* batadv_compare_eth - Compare two not u16 aligned Ethernet addresses
* @data1: Pointer to a six-byte array containing the Ethernet address
* @data2: Pointer other six-byte array containing the Ethernet address
* *
* note: can't use ether_addr_equal() as it requires aligned memory * note: can't use ether_addr_equal() as it requires aligned memory
*
* Return: 1 if they are the same ethernet addr
*/ */
static inline bool batadv_compare_eth(const void *data1, const void *data2) static inline bool batadv_compare_eth(const void *data1, const void *data2)
{ {
...@@ -287,7 +292,7 @@ static inline bool batadv_compare_eth(const void *data1, const void *data2) ...@@ -287,7 +292,7 @@ static inline bool batadv_compare_eth(const void *data1, const void *data2)
* @timestamp: base value to compare with (in jiffies) * @timestamp: base value to compare with (in jiffies)
* @timeout: added to base value before comparing (in milliseconds) * @timeout: added to base value before comparing (in milliseconds)
* *
* Returns true if current time is after timestamp + timeout * Return: true if current time is after timestamp + timeout
*/ */
static inline bool batadv_has_timed_out(unsigned long timestamp, static inline bool batadv_has_timed_out(unsigned long timestamp,
unsigned int timeout) unsigned int timeout)
...@@ -326,7 +331,13 @@ static inline void batadv_add_counter(struct batadv_priv *bat_priv, size_t idx, ...@@ -326,7 +331,13 @@ static inline void batadv_add_counter(struct batadv_priv *bat_priv, size_t idx,
#define batadv_inc_counter(b, i) batadv_add_counter(b, i, 1) #define batadv_inc_counter(b, i) batadv_add_counter(b, i, 1)
/* Sum and return the cpu-local counters for index 'idx' */ /**
* batadv_sum_counter - Sum the cpu-local counters for index 'idx'
* @bat_priv: the bat priv with all the soft interface information
* @idx: index of counter to sum up
*
* Return: sum of all cpu-local counters
*/
static inline u64 batadv_sum_counter(struct batadv_priv *bat_priv, size_t idx) static inline u64 batadv_sum_counter(struct batadv_priv *bat_priv, size_t idx)
{ {
u64 *counters, sum = 0; u64 *counters, sum = 0;
......
/* Copyright (C) 2014-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2014-2016 B.A.T.M.A.N. contributors:
* *
* Linus Lüssing * Linus Lüssing
* *
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
* Collect multicast addresses of the local multicast listeners * Collect multicast addresses of the local multicast listeners
* on the given soft interface, dev, in the given mcast_list. * on the given soft interface, dev, in the given mcast_list.
* *
* Returns -ENOMEM on memory allocation error or the number of * Return: -ENOMEM on memory allocation error or the number of
* items added to the mcast_list otherwise. * items added to the mcast_list otherwise.
*/ */
static int batadv_mcast_mla_softif_get(struct net_device *dev, static int batadv_mcast_mla_softif_get(struct net_device *dev,
...@@ -87,7 +87,7 @@ static int batadv_mcast_mla_softif_get(struct net_device *dev, ...@@ -87,7 +87,7 @@ static int batadv_mcast_mla_softif_get(struct net_device *dev,
* @mcast_addr: the multicast address to check * @mcast_addr: the multicast address to check
* @mcast_list: the list with multicast addresses to search in * @mcast_list: the list with multicast addresses to search in
* *
* Returns true if the given address is already in the given list. * Return: true if the given address is already in the given list.
* Otherwise returns false. * Otherwise returns false.
*/ */
static bool batadv_mcast_mla_is_duplicate(u8 *mcast_addr, static bool batadv_mcast_mla_is_duplicate(u8 *mcast_addr,
...@@ -195,8 +195,9 @@ static void batadv_mcast_mla_tt_add(struct batadv_priv *bat_priv, ...@@ -195,8 +195,9 @@ static void batadv_mcast_mla_tt_add(struct batadv_priv *bat_priv,
* batadv_mcast_has_bridge - check whether the soft-iface is bridged * batadv_mcast_has_bridge - check whether the soft-iface is bridged
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* *
* Checks whether there is a bridge on top of our soft interface. Returns * Checks whether there is a bridge on top of our soft interface.
* true if so, false otherwise. *
* Return: true if there is a bridge, false otherwise.
*/ */
static bool batadv_mcast_has_bridge(struct batadv_priv *bat_priv) static bool batadv_mcast_has_bridge(struct batadv_priv *bat_priv)
{ {
...@@ -218,7 +219,7 @@ static bool batadv_mcast_has_bridge(struct batadv_priv *bat_priv) ...@@ -218,7 +219,7 @@ static bool batadv_mcast_has_bridge(struct batadv_priv *bat_priv)
* Updates the own multicast tvlv with our current multicast related settings, * Updates the own multicast tvlv with our current multicast related settings,
* capabilities and inabilities. * capabilities and inabilities.
* *
* Returns true if the tvlv container is registered afterwards. Otherwise * Return: true if the tvlv container is registered afterwards. Otherwise
* returns false. * returns false.
*/ */
static bool batadv_mcast_mla_tvlv_update(struct batadv_priv *bat_priv) static bool batadv_mcast_mla_tvlv_update(struct batadv_priv *bat_priv)
...@@ -289,8 +290,8 @@ void batadv_mcast_mla_update(struct batadv_priv *bat_priv) ...@@ -289,8 +290,8 @@ void batadv_mcast_mla_update(struct batadv_priv *bat_priv)
* Checks whether the given IPv4 packet has the potential to be forwarded with a * Checks whether the given IPv4 packet has the potential to be forwarded with a
* mode more optimal than classic flooding. * mode more optimal than classic flooding.
* *
* If so then returns 0. Otherwise -EINVAL is returned or -ENOMEM in case of * Return: If so then 0. Otherwise -EINVAL or -ENOMEM in case of memory
* memory allocation failure. * allocation failure.
*/ */
static int batadv_mcast_forw_mode_check_ipv4(struct batadv_priv *bat_priv, static int batadv_mcast_forw_mode_check_ipv4(struct batadv_priv *bat_priv,
struct sk_buff *skb, struct sk_buff *skb,
...@@ -327,8 +328,7 @@ static int batadv_mcast_forw_mode_check_ipv4(struct batadv_priv *bat_priv, ...@@ -327,8 +328,7 @@ static int batadv_mcast_forw_mode_check_ipv4(struct batadv_priv *bat_priv,
* Checks whether the given IPv6 packet has the potential to be forwarded with a * Checks whether the given IPv6 packet has the potential to be forwarded with a
* mode more optimal than classic flooding. * mode more optimal than classic flooding.
* *
* If so then returns 0. Otherwise -EINVAL is returned or -ENOMEM if we are out * Return: If so then 0. Otherwise -EINVAL is or -ENOMEM if we are out of memory
* of memory.
*/ */
static int batadv_mcast_forw_mode_check_ipv6(struct batadv_priv *bat_priv, static int batadv_mcast_forw_mode_check_ipv6(struct batadv_priv *bat_priv,
struct sk_buff *skb, struct sk_buff *skb,
...@@ -366,8 +366,7 @@ static int batadv_mcast_forw_mode_check_ipv6(struct batadv_priv *bat_priv, ...@@ -366,8 +366,7 @@ static int batadv_mcast_forw_mode_check_ipv6(struct batadv_priv *bat_priv,
* Checks whether the given multicast ethernet frame has the potential to be * Checks whether the given multicast ethernet frame has the potential to be
* forwarded with a mode more optimal than classic flooding. * forwarded with a mode more optimal than classic flooding.
* *
* If so then returns 0. Otherwise -EINVAL is returned or -ENOMEM if we are out * Return: If so then 0. Otherwise -EINVAL is or -ENOMEM if we are out of memory
* of memory.
*/ */
static int batadv_mcast_forw_mode_check(struct batadv_priv *bat_priv, static int batadv_mcast_forw_mode_check(struct batadv_priv *bat_priv,
struct sk_buff *skb, struct sk_buff *skb,
...@@ -398,7 +397,7 @@ static int batadv_mcast_forw_mode_check(struct batadv_priv *bat_priv, ...@@ -398,7 +397,7 @@ static int batadv_mcast_forw_mode_check(struct batadv_priv *bat_priv,
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @ethhdr: ethernet header of a packet * @ethhdr: ethernet header of a packet
* *
* Returns the number of nodes which want all IPv4 multicast traffic if the * Return: the number of nodes which want all IPv4 multicast traffic if the
* given ethhdr is from an IPv4 packet or the number of nodes which want all * given ethhdr is from an IPv4 packet or the number of nodes which want all
* IPv6 traffic if it matches an IPv6 packet. * IPv6 traffic if it matches an IPv6 packet.
*/ */
...@@ -421,7 +420,7 @@ static int batadv_mcast_forw_want_all_ip_count(struct batadv_priv *bat_priv, ...@@ -421,7 +420,7 @@ static int batadv_mcast_forw_want_all_ip_count(struct batadv_priv *bat_priv,
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @ethhdr: the ether header containing the multicast destination * @ethhdr: the ether header containing the multicast destination
* *
* Returns an orig_node matching the multicast address provided by ethhdr * Return: an orig_node matching the multicast address provided by ethhdr
* via a translation table lookup. This increases the returned nodes refcount. * via a translation table lookup. This increases the returned nodes refcount.
*/ */
static struct batadv_orig_node * static struct batadv_orig_node *
...@@ -436,7 +435,7 @@ batadv_mcast_forw_tt_node_get(struct batadv_priv *bat_priv, ...@@ -436,7 +435,7 @@ batadv_mcast_forw_tt_node_get(struct batadv_priv *bat_priv,
* batadv_mcast_want_forw_ipv4_node_get - get a node with an ipv4 flag * batadv_mcast_want_forw_ipv4_node_get - get a node with an ipv4 flag
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* *
* Returns an orig_node which has the BATADV_MCAST_WANT_ALL_IPV4 flag set and * Return: an orig_node which has the BATADV_MCAST_WANT_ALL_IPV4 flag set and
* increases its refcount. * increases its refcount.
*/ */
static struct batadv_orig_node * static struct batadv_orig_node *
...@@ -463,7 +462,7 @@ batadv_mcast_forw_ipv4_node_get(struct batadv_priv *bat_priv) ...@@ -463,7 +462,7 @@ batadv_mcast_forw_ipv4_node_get(struct batadv_priv *bat_priv)
* batadv_mcast_want_forw_ipv6_node_get - get a node with an ipv6 flag * batadv_mcast_want_forw_ipv6_node_get - get a node with an ipv6 flag
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* *
* Returns an orig_node which has the BATADV_MCAST_WANT_ALL_IPV6 flag set * Return: an orig_node which has the BATADV_MCAST_WANT_ALL_IPV6 flag set
* and increases its refcount. * and increases its refcount.
*/ */
static struct batadv_orig_node * static struct batadv_orig_node *
...@@ -491,7 +490,7 @@ batadv_mcast_forw_ipv6_node_get(struct batadv_priv *bat_priv) ...@@ -491,7 +490,7 @@ batadv_mcast_forw_ipv6_node_get(struct batadv_priv *bat_priv)
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @ethhdr: an ethernet header to determine the protocol family from * @ethhdr: an ethernet header to determine the protocol family from
* *
* Returns an orig_node which has the BATADV_MCAST_WANT_ALL_IPV4 or * Return: an orig_node which has the BATADV_MCAST_WANT_ALL_IPV4 or
* BATADV_MCAST_WANT_ALL_IPV6 flag, depending on the provided ethhdr, set and * BATADV_MCAST_WANT_ALL_IPV6 flag, depending on the provided ethhdr, set and
* increases its refcount. * increases its refcount.
*/ */
...@@ -514,7 +513,7 @@ batadv_mcast_forw_ip_node_get(struct batadv_priv *bat_priv, ...@@ -514,7 +513,7 @@ batadv_mcast_forw_ip_node_get(struct batadv_priv *bat_priv,
* batadv_mcast_want_forw_unsnoop_node_get - get a node with an unsnoopable flag * batadv_mcast_want_forw_unsnoop_node_get - get a node with an unsnoopable flag
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* *
* Returns an orig_node which has the BATADV_MCAST_WANT_ALL_UNSNOOPABLES flag * Return: an orig_node which has the BATADV_MCAST_WANT_ALL_UNSNOOPABLES flag
* set and increases its refcount. * set and increases its refcount.
*/ */
static struct batadv_orig_node * static struct batadv_orig_node *
...@@ -543,7 +542,7 @@ batadv_mcast_forw_unsnoop_node_get(struct batadv_priv *bat_priv) ...@@ -543,7 +542,7 @@ batadv_mcast_forw_unsnoop_node_get(struct batadv_priv *bat_priv)
* @skb: The multicast packet to check * @skb: The multicast packet to check
* @orig: an originator to be set to forward the skb to * @orig: an originator to be set to forward the skb to
* *
* Returns the forwarding mode as enum batadv_forw_mode and in case of * Return: the forwarding mode as enum batadv_forw_mode and in case of
* BATADV_FORW_SINGLE set the orig to the single originator the skb * BATADV_FORW_SINGLE set the orig to the single originator the skb
* should be forwarded to. * should be forwarded to.
*/ */
......
/* Copyright (C) 2014-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2014-2016 B.A.T.M.A.N. contributors:
* *
* Linus Lüssing * Linus Lüssing
* *
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
struct sk_buff; struct sk_buff;
/** /**
* batadv_forw_mode - the way a packet should be forwarded as * enum batadv_forw_mode - the way a packet should be forwarded as
* @BATADV_FORW_ALL: forward the packet to all nodes (currently via classic * @BATADV_FORW_ALL: forward the packet to all nodes (currently via classic
* flooding) * flooding)
* @BATADV_FORW_SINGLE: forward the packet to a single node (currently via the * @BATADV_FORW_SINGLE: forward the packet to a single node (currently via the
......
/* Copyright (C) 2012-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2012-2016 B.A.T.M.A.N. contributors:
* *
* Martin Hundebøll, Jeppe Ledet-Pedersen * Martin Hundebøll, Jeppe Ledet-Pedersen
* *
...@@ -64,6 +64,8 @@ static int batadv_nc_recv_coded_packet(struct sk_buff *skb, ...@@ -64,6 +64,8 @@ static int batadv_nc_recv_coded_packet(struct sk_buff *skb,
/** /**
* batadv_nc_init - one-time initialization for network coding * batadv_nc_init - one-time initialization for network coding
*
* Return: 0 on success or negative error number in case of failure
*/ */
int __init batadv_nc_init(void) int __init batadv_nc_init(void)
{ {
...@@ -142,6 +144,8 @@ static void batadv_nc_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, ...@@ -142,6 +144,8 @@ static void batadv_nc_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
/** /**
* batadv_nc_mesh_init - initialise coding hash table and start house keeping * batadv_nc_mesh_init - initialise coding hash table and start house keeping
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
*
* Return: 0 on success or negative error number in case of failure
*/ */
int batadv_nc_mesh_init(struct batadv_priv *bat_priv) int batadv_nc_mesh_init(struct batadv_priv *bat_priv)
{ {
...@@ -251,7 +255,7 @@ static void batadv_nc_packet_free(struct batadv_nc_packet *nc_packet) ...@@ -251,7 +255,7 @@ static void batadv_nc_packet_free(struct batadv_nc_packet *nc_packet)
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @nc_node: the nc node to check * @nc_node: the nc node to check
* *
* Returns true if the entry has to be purged now, false otherwise * Return: true if the entry has to be purged now, false otherwise
*/ */
static bool batadv_nc_to_purge_nc_node(struct batadv_priv *bat_priv, static bool batadv_nc_to_purge_nc_node(struct batadv_priv *bat_priv,
struct batadv_nc_node *nc_node) struct batadv_nc_node *nc_node)
...@@ -267,7 +271,7 @@ static bool batadv_nc_to_purge_nc_node(struct batadv_priv *bat_priv, ...@@ -267,7 +271,7 @@ static bool batadv_nc_to_purge_nc_node(struct batadv_priv *bat_priv,
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @nc_path: the nc path to check * @nc_path: the nc path to check
* *
* Returns true if the entry has to be purged now, false otherwise * Return: true if the entry has to be purged now, false otherwise
*/ */
static bool batadv_nc_to_purge_nc_path_coding(struct batadv_priv *bat_priv, static bool batadv_nc_to_purge_nc_path_coding(struct batadv_priv *bat_priv,
struct batadv_nc_path *nc_path) struct batadv_nc_path *nc_path)
...@@ -287,7 +291,7 @@ static bool batadv_nc_to_purge_nc_path_coding(struct batadv_priv *bat_priv, ...@@ -287,7 +291,7 @@ static bool batadv_nc_to_purge_nc_path_coding(struct batadv_priv *bat_priv,
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @nc_path: the nc path to check * @nc_path: the nc path to check
* *
* Returns true if the entry has to be purged now, false otherwise * Return: true if the entry has to be purged now, false otherwise
*/ */
static bool batadv_nc_to_purge_nc_path_decoding(struct batadv_priv *bat_priv, static bool batadv_nc_to_purge_nc_path_decoding(struct batadv_priv *bat_priv,
struct batadv_nc_path *nc_path) struct batadv_nc_path *nc_path)
...@@ -470,7 +474,7 @@ static void batadv_nc_hash_key_gen(struct batadv_nc_path *key, const char *src, ...@@ -470,7 +474,7 @@ static void batadv_nc_hash_key_gen(struct batadv_nc_path *key, const char *src,
* @data: data to hash * @data: data to hash
* @size: size of the hash table * @size: size of the hash table
* *
* Returns the selected index in the hash table for the given data. * Return: the selected index in the hash table for the given data.
*/ */
static u32 batadv_nc_hash_choose(const void *data, u32 size) static u32 batadv_nc_hash_choose(const void *data, u32 size)
{ {
...@@ -489,7 +493,7 @@ static u32 batadv_nc_hash_choose(const void *data, u32 size) ...@@ -489,7 +493,7 @@ static u32 batadv_nc_hash_choose(const void *data, u32 size)
* @node: node in the local table * @node: node in the local table
* @data2: second object to compare the node to * @data2: second object to compare the node to
* *
* Returns 1 if the two entry are the same, 0 otherwise * Return: 1 if the two entry are the same, 0 otherwise
*/ */
static int batadv_nc_hash_compare(const struct hlist_node *node, static int batadv_nc_hash_compare(const struct hlist_node *node,
const void *data2) const void *data2)
...@@ -516,7 +520,7 @@ static int batadv_nc_hash_compare(const struct hlist_node *node, ...@@ -516,7 +520,7 @@ static int batadv_nc_hash_compare(const struct hlist_node *node,
* @hash: hash table containing the nc path * @hash: hash table containing the nc path
* @data: search key * @data: search key
* *
* Returns the nc_path if found, NULL otherwise. * Return: the nc_path if found, NULL otherwise.
*/ */
static struct batadv_nc_path * static struct batadv_nc_path *
batadv_nc_hash_find(struct batadv_hashtable *hash, batadv_nc_hash_find(struct batadv_hashtable *hash,
...@@ -571,7 +575,7 @@ static void batadv_nc_send_packet(struct batadv_nc_packet *nc_packet) ...@@ -571,7 +575,7 @@ static void batadv_nc_send_packet(struct batadv_nc_packet *nc_packet)
* timeout. If so, the packet is no longer kept and the entry deleted from the * timeout. If so, the packet is no longer kept and the entry deleted from the
* queue. Has to be called with the appropriate locks. * queue. Has to be called with the appropriate locks.
* *
* Returns false as soon as the entry in the fifo queue has not been timed out * Return: false as soon as the entry in the fifo queue has not been timed out
* yet and true otherwise. * yet and true otherwise.
*/ */
static bool batadv_nc_sniffed_purge(struct batadv_priv *bat_priv, static bool batadv_nc_sniffed_purge(struct batadv_priv *bat_priv,
...@@ -610,7 +614,7 @@ static bool batadv_nc_sniffed_purge(struct batadv_priv *bat_priv, ...@@ -610,7 +614,7 @@ static bool batadv_nc_sniffed_purge(struct batadv_priv *bat_priv,
* packet is no longer delayed, immediately sent and the entry deleted from the * packet is no longer delayed, immediately sent and the entry deleted from the
* queue. Has to be called with the appropriate locks. * queue. Has to be called with the appropriate locks.
* *
* Returns false as soon as the entry in the fifo queue has not been timed out * Return: false as soon as the entry in the fifo queue has not been timed out
* yet and true otherwise. * yet and true otherwise.
*/ */
static bool batadv_nc_fwd_flush(struct batadv_priv *bat_priv, static bool batadv_nc_fwd_flush(struct batadv_priv *bat_priv,
...@@ -731,7 +735,7 @@ static void batadv_nc_worker(struct work_struct *work) ...@@ -731,7 +735,7 @@ static void batadv_nc_worker(struct work_struct *work)
* @orig_node: neighboring orig node which may be used as nc candidate * @orig_node: neighboring orig node which may be used as nc candidate
* @ogm_packet: incoming ogm packet also used for the checks * @ogm_packet: incoming ogm packet also used for the checks
* *
* Returns true if: * Return: true if:
* 1) The OGM must have the most recent sequence number. * 1) The OGM must have the most recent sequence number.
* 2) The TTL must be decremented by one and only one. * 2) The TTL must be decremented by one and only one.
* 3) The OGM must be received from the first hop from orig_node. * 3) The OGM must be received from the first hop from orig_node.
...@@ -772,7 +776,7 @@ static bool batadv_can_nc_with_orig(struct batadv_priv *bat_priv, ...@@ -772,7 +776,7 @@ static bool batadv_can_nc_with_orig(struct batadv_priv *bat_priv,
* (can be equal to orig_node) * (can be equal to orig_node)
* @in_coding: traverse incoming or outgoing network coding list * @in_coding: traverse incoming or outgoing network coding list
* *
* Returns the nc_node if found, NULL otherwise. * Return: the nc_node if found, NULL otherwise.
*/ */
static struct batadv_nc_node static struct batadv_nc_node
*batadv_nc_find_nc_node(struct batadv_orig_node *orig_node, *batadv_nc_find_nc_node(struct batadv_orig_node *orig_node,
...@@ -814,7 +818,7 @@ static struct batadv_nc_node ...@@ -814,7 +818,7 @@ static struct batadv_nc_node
* (can be equal to orig_node) * (can be equal to orig_node)
* @in_coding: traverse incoming or outgoing network coding list * @in_coding: traverse incoming or outgoing network coding list
* *
* Returns the nc_node if found or created, NULL in case of an error. * Return: the nc_node if found or created, NULL in case of an error.
*/ */
static struct batadv_nc_node static struct batadv_nc_node
*batadv_nc_get_nc_node(struct batadv_priv *bat_priv, *batadv_nc_get_nc_node(struct batadv_priv *bat_priv,
...@@ -932,7 +936,7 @@ void batadv_nc_update_nc_node(struct batadv_priv *bat_priv, ...@@ -932,7 +936,7 @@ void batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
* @src: ethernet source address - first half of the nc path search key * @src: ethernet source address - first half of the nc path search key
* @dst: ethernet destination address - second half of the nc path search key * @dst: ethernet destination address - second half of the nc path search key
* *
* Returns pointer to nc_path if the path was found or created, returns NULL * Return: pointer to nc_path if the path was found or created, returns NULL
* on error. * on error.
*/ */
static struct batadv_nc_path *batadv_nc_get_path(struct batadv_priv *bat_priv, static struct batadv_nc_path *batadv_nc_get_path(struct batadv_priv *bat_priv,
...@@ -989,6 +993,8 @@ static struct batadv_nc_path *batadv_nc_get_path(struct batadv_priv *bat_priv, ...@@ -989,6 +993,8 @@ static struct batadv_nc_path *batadv_nc_get_path(struct batadv_priv *bat_priv,
* batadv_nc_random_weight_tq - scale the receivers TQ-value to avoid unfair * batadv_nc_random_weight_tq - scale the receivers TQ-value to avoid unfair
* selection of a receiver with slightly lower TQ than the other * selection of a receiver with slightly lower TQ than the other
* @tq: to be weighted tq value * @tq: to be weighted tq value
*
* Return: scaled tq value
*/ */
static u8 batadv_nc_random_weight_tq(u8 tq) static u8 batadv_nc_random_weight_tq(u8 tq)
{ {
...@@ -1029,7 +1035,7 @@ static void batadv_nc_memxor(char *dst, const char *src, unsigned int len) ...@@ -1029,7 +1035,7 @@ static void batadv_nc_memxor(char *dst, const char *src, unsigned int len)
* @nc_packet: structure containing the packet to the skb can be coded with * @nc_packet: structure containing the packet to the skb can be coded with
* @neigh_node: next hop to forward packet to * @neigh_node: next hop to forward packet to
* *
* Returns true if both packets are consumed, false otherwise. * Return: true if both packets are consumed, false otherwise.
*/ */
static bool batadv_nc_code_packets(struct batadv_priv *bat_priv, static bool batadv_nc_code_packets(struct batadv_priv *bat_priv,
struct sk_buff *skb, struct sk_buff *skb,
...@@ -1228,7 +1234,7 @@ static bool batadv_nc_code_packets(struct batadv_priv *bat_priv, ...@@ -1228,7 +1234,7 @@ static bool batadv_nc_code_packets(struct batadv_priv *bat_priv,
* Since the source encoded the packet we can be certain it has all necessary * Since the source encoded the packet we can be certain it has all necessary
* decode information. * decode information.
* *
* Returns true if coding of a decoded packet is allowed. * Return: true if coding of a decoded packet is allowed.
*/ */
static bool batadv_nc_skb_coding_possible(struct sk_buff *skb, u8 *dst, u8 *src) static bool batadv_nc_skb_coding_possible(struct sk_buff *skb, u8 *dst, u8 *src)
{ {
...@@ -1246,7 +1252,7 @@ static bool batadv_nc_skb_coding_possible(struct sk_buff *skb, u8 *dst, u8 *src) ...@@ -1246,7 +1252,7 @@ static bool batadv_nc_skb_coding_possible(struct sk_buff *skb, u8 *dst, u8 *src)
* @skb: data skb to forward * @skb: data skb to forward
* @eth_dst: next hop mac address of skb * @eth_dst: next hop mac address of skb
* *
* Returns true if coding of a decoded skb is allowed. * Return: true if coding of a decoded skb is allowed.
*/ */
static struct batadv_nc_packet * static struct batadv_nc_packet *
batadv_nc_path_search(struct batadv_priv *bat_priv, batadv_nc_path_search(struct batadv_priv *bat_priv,
...@@ -1314,7 +1320,7 @@ batadv_nc_path_search(struct batadv_priv *bat_priv, ...@@ -1314,7 +1320,7 @@ batadv_nc_path_search(struct batadv_priv *bat_priv,
* @eth_src: source mac address of skb * @eth_src: source mac address of skb
* @in_nc_node: pointer to skb next hop's neighbor nc node * @in_nc_node: pointer to skb next hop's neighbor nc node
* *
* Returns an nc packet if a suitable coding packet was found, NULL otherwise. * Return: an nc packet if a suitable coding packet was found, NULL otherwise.
*/ */
static struct batadv_nc_packet * static struct batadv_nc_packet *
batadv_nc_skb_src_search(struct batadv_priv *bat_priv, batadv_nc_skb_src_search(struct batadv_priv *bat_priv,
...@@ -1397,7 +1403,7 @@ static void batadv_nc_skb_store_before_coding(struct batadv_priv *bat_priv, ...@@ -1397,7 +1403,7 @@ static void batadv_nc_skb_store_before_coding(struct batadv_priv *bat_priv,
* next hop that potentially sent a packet which our next hop also received * next hop that potentially sent a packet which our next hop also received
* (overheard) and has stored for later decoding. * (overheard) and has stored for later decoding.
* *
* Returns true if the skb was consumed (encoded packet sent) or false otherwise * Return: true if the skb was consumed (encoded packet sent) or false otherwise
*/ */
static bool batadv_nc_skb_dst_search(struct sk_buff *skb, static bool batadv_nc_skb_dst_search(struct sk_buff *skb,
struct batadv_neigh_node *neigh_node, struct batadv_neigh_node *neigh_node,
...@@ -1451,7 +1457,7 @@ static bool batadv_nc_skb_dst_search(struct sk_buff *skb, ...@@ -1451,7 +1457,7 @@ static bool batadv_nc_skb_dst_search(struct sk_buff *skb,
* @neigh_node: next hop to forward packet to * @neigh_node: next hop to forward packet to
* @packet_id: checksum to identify packet * @packet_id: checksum to identify packet
* *
* Returns true if the packet was buffered or false in case of an error. * Return: true if the packet was buffered or false in case of an error.
*/ */
static bool batadv_nc_skb_add_to_path(struct sk_buff *skb, static bool batadv_nc_skb_add_to_path(struct sk_buff *skb,
struct batadv_nc_path *nc_path, struct batadv_nc_path *nc_path,
...@@ -1485,7 +1491,7 @@ static bool batadv_nc_skb_add_to_path(struct sk_buff *skb, ...@@ -1485,7 +1491,7 @@ static bool batadv_nc_skb_add_to_path(struct sk_buff *skb,
* @skb: data skb to forward * @skb: data skb to forward
* @neigh_node: next hop to forward packet to * @neigh_node: next hop to forward packet to
* *
* Returns true if the skb was consumed (encoded packet sent) or false otherwise * Return: true if the skb was consumed (encoded packet sent) or false otherwise
*/ */
bool batadv_nc_skb_forward(struct sk_buff *skb, bool batadv_nc_skb_forward(struct sk_buff *skb,
struct batadv_neigh_node *neigh_node) struct batadv_neigh_node *neigh_node)
...@@ -1624,7 +1630,7 @@ void batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv, ...@@ -1624,7 +1630,7 @@ void batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
* @skb: unicast skb to decode * @skb: unicast skb to decode
* @nc_packet: decode data needed to decode the skb * @nc_packet: decode data needed to decode the skb
* *
* Returns pointer to decoded unicast packet if the packet was decoded or NULL * Return: pointer to decoded unicast packet if the packet was decoded or NULL
* in case of an error. * in case of an error.
*/ */
static struct batadv_unicast_packet * static struct batadv_unicast_packet *
...@@ -1718,7 +1724,7 @@ batadv_nc_skb_decode_packet(struct batadv_priv *bat_priv, struct sk_buff *skb, ...@@ -1718,7 +1724,7 @@ batadv_nc_skb_decode_packet(struct batadv_priv *bat_priv, struct sk_buff *skb,
* @ethhdr: pointer to the ethernet header inside the coded packet * @ethhdr: pointer to the ethernet header inside the coded packet
* @coded: coded packet we try to find decode data for * @coded: coded packet we try to find decode data for
* *
* Returns pointer to nc packet if the needed data was found or NULL otherwise. * Return: pointer to nc packet if the needed data was found or NULL otherwise.
*/ */
static struct batadv_nc_packet * static struct batadv_nc_packet *
batadv_nc_find_decoding_packet(struct batadv_priv *bat_priv, batadv_nc_find_decoding_packet(struct batadv_priv *bat_priv,
...@@ -1781,6 +1787,9 @@ batadv_nc_find_decoding_packet(struct batadv_priv *bat_priv, ...@@ -1781,6 +1787,9 @@ batadv_nc_find_decoding_packet(struct batadv_priv *bat_priv,
* resulting unicast packet * resulting unicast packet
* @skb: incoming coded packet * @skb: incoming coded packet
* @recv_if: pointer to interface this packet was received on * @recv_if: pointer to interface this packet was received on
*
* Return: NET_RX_SUCCESS if the packet has been consumed or NET_RX_DROP
* otherwise.
*/ */
static int batadv_nc_recv_coded_packet(struct sk_buff *skb, static int batadv_nc_recv_coded_packet(struct sk_buff *skb,
struct batadv_hard_iface *recv_if) struct batadv_hard_iface *recv_if)
...@@ -1865,6 +1874,8 @@ void batadv_nc_mesh_free(struct batadv_priv *bat_priv) ...@@ -1865,6 +1874,8 @@ void batadv_nc_mesh_free(struct batadv_priv *bat_priv)
* batadv_nc_nodes_seq_print_text - print the nc node information * batadv_nc_nodes_seq_print_text - print the nc node information
* @seq: seq file to print on * @seq: seq file to print on
* @offset: not used * @offset: not used
*
* Return: always 0
*/ */
int batadv_nc_nodes_seq_print_text(struct seq_file *seq, void *offset) int batadv_nc_nodes_seq_print_text(struct seq_file *seq, void *offset)
{ {
...@@ -1927,6 +1938,8 @@ int batadv_nc_nodes_seq_print_text(struct seq_file *seq, void *offset) ...@@ -1927,6 +1938,8 @@ int batadv_nc_nodes_seq_print_text(struct seq_file *seq, void *offset)
/** /**
* batadv_nc_init_debugfs - create nc folder and related files in debugfs * batadv_nc_init_debugfs - create nc folder and related files in debugfs
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
*
* Return: 0 on success or negative error number in case of failure
*/ */
int batadv_nc_init_debugfs(struct batadv_priv *bat_priv) int batadv_nc_init_debugfs(struct batadv_priv *bat_priv)
{ {
......
/* Copyright (C) 2012-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2012-2016 B.A.T.M.A.N. contributors:
* *
* Martin Hundebøll, Jeppe Ledet-Pedersen * Martin Hundebøll, Jeppe Ledet-Pedersen
* *
......
/* Copyright (C) 2009-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2009-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
* *
...@@ -47,7 +47,13 @@ static struct lock_class_key batadv_orig_hash_lock_class_key; ...@@ -47,7 +47,13 @@ static struct lock_class_key batadv_orig_hash_lock_class_key;
static void batadv_purge_orig(struct work_struct *work); static void batadv_purge_orig(struct work_struct *work);
/* returns 1 if they are the same originator */ /**
* batadv_compare_orig - comparing function used in the originator hash table
* @node: node in the local table
* @data2: second object to compare the node to
*
* Return: 1 if they are the same originator
*/
int batadv_compare_orig(const struct hlist_node *node, const void *data2) int batadv_compare_orig(const struct hlist_node *node, const void *data2)
{ {
const void *data1 = container_of(node, struct batadv_orig_node, const void *data1 = container_of(node, struct batadv_orig_node,
...@@ -61,7 +67,7 @@ int batadv_compare_orig(const struct hlist_node *node, const void *data2) ...@@ -61,7 +67,7 @@ int batadv_compare_orig(const struct hlist_node *node, const void *data2)
* @orig_node: the originator serving the VLAN * @orig_node: the originator serving the VLAN
* @vid: the VLAN identifier * @vid: the VLAN identifier
* *
* Returns the vlan object identified by vid and belonging to orig_node or NULL * Return: the vlan object identified by vid and belonging to orig_node or NULL
* if it does not exist. * if it does not exist.
*/ */
struct batadv_orig_node_vlan * struct batadv_orig_node_vlan *
...@@ -93,7 +99,7 @@ batadv_orig_node_vlan_get(struct batadv_orig_node *orig_node, ...@@ -93,7 +99,7 @@ batadv_orig_node_vlan_get(struct batadv_orig_node *orig_node,
* @orig_node: the originator serving the VLAN * @orig_node: the originator serving the VLAN
* @vid: the VLAN identifier * @vid: the VLAN identifier
* *
* Returns NULL in case of failure or the vlan object identified by vid and * Return: NULL in case of failure or the vlan object identified by vid and
* belonging to orig_node otherwise. The object is created and added to the list * belonging to orig_node otherwise. The object is created and added to the list
* if it does not exist. * if it does not exist.
* *
...@@ -266,7 +272,7 @@ void batadv_neigh_node_free_ref(struct batadv_neigh_node *neigh_node) ...@@ -266,7 +272,7 @@ void batadv_neigh_node_free_ref(struct batadv_neigh_node *neigh_node)
* @if_outgoing: the interface where the payload packet has been received or * @if_outgoing: the interface where the payload packet has been received or
* the OGM should be sent to * the OGM should be sent to
* *
* Returns the neighbor which should be router for this orig_node/iface. * Return: the neighbor which should be router for this orig_node/iface.
* *
* The object is returned with refcounter increased by 1. * The object is returned with refcounter increased by 1.
*/ */
...@@ -298,7 +304,7 @@ batadv_orig_router_get(struct batadv_orig_node *orig_node, ...@@ -298,7 +304,7 @@ batadv_orig_router_get(struct batadv_orig_node *orig_node,
* @orig_node: the orig node to be queried * @orig_node: the orig node to be queried
* @if_outgoing: the interface for which the ifinfo should be acquired * @if_outgoing: the interface for which the ifinfo should be acquired
* *
* Returns the requested orig_ifinfo or NULL if not found. * Return: the requested orig_ifinfo or NULL if not found.
* *
* The object is returned with refcounter increased by 1. * The object is returned with refcounter increased by 1.
*/ */
...@@ -330,7 +336,7 @@ batadv_orig_ifinfo_get(struct batadv_orig_node *orig_node, ...@@ -330,7 +336,7 @@ batadv_orig_ifinfo_get(struct batadv_orig_node *orig_node,
* @orig_node: the orig node to be queried * @orig_node: the orig node to be queried
* @if_outgoing: the interface for which the ifinfo should be acquired * @if_outgoing: the interface for which the ifinfo should be acquired
* *
* Returns NULL in case of failure or the orig_ifinfo object for the if_outgoing * Return: NULL in case of failure or the orig_ifinfo object for the if_outgoing
* interface otherwise. The object is created and added to the list * interface otherwise. The object is created and added to the list
* if it does not exist. * if it does not exist.
* *
...@@ -375,12 +381,12 @@ batadv_orig_ifinfo_new(struct batadv_orig_node *orig_node, ...@@ -375,12 +381,12 @@ batadv_orig_ifinfo_new(struct batadv_orig_node *orig_node,
/** /**
* batadv_neigh_ifinfo_get - find the ifinfo from an neigh_node * batadv_neigh_ifinfo_get - find the ifinfo from an neigh_node
* @neigh_node: the neigh node to be queried * @neigh: the neigh node to be queried
* @if_outgoing: the interface for which the ifinfo should be acquired * @if_outgoing: the interface for which the ifinfo should be acquired
* *
* The object is returned with refcounter increased by 1. * The object is returned with refcounter increased by 1.
* *
* Returns the requested neigh_ifinfo or NULL if not found * Return: the requested neigh_ifinfo or NULL if not found
*/ */
struct batadv_neigh_ifinfo * struct batadv_neigh_ifinfo *
batadv_neigh_ifinfo_get(struct batadv_neigh_node *neigh, batadv_neigh_ifinfo_get(struct batadv_neigh_node *neigh,
...@@ -408,10 +414,10 @@ batadv_neigh_ifinfo_get(struct batadv_neigh_node *neigh, ...@@ -408,10 +414,10 @@ batadv_neigh_ifinfo_get(struct batadv_neigh_node *neigh,
/** /**
* batadv_neigh_ifinfo_new - search and possibly create an neigh_ifinfo object * batadv_neigh_ifinfo_new - search and possibly create an neigh_ifinfo object
* @neigh_node: the neigh node to be queried * @neigh: the neigh node to be queried
* @if_outgoing: the interface for which the ifinfo should be acquired * @if_outgoing: the interface for which the ifinfo should be acquired
* *
* Returns NULL in case of failure or the neigh_ifinfo object for the * Return: NULL in case of failure or the neigh_ifinfo object for the
* if_outgoing interface otherwise. The object is created and added to the list * if_outgoing interface otherwise. The object is created and added to the list
* if it does not exist. * if it does not exist.
* *
...@@ -459,7 +465,8 @@ batadv_neigh_ifinfo_new(struct batadv_neigh_node *neigh, ...@@ -459,7 +465,8 @@ batadv_neigh_ifinfo_new(struct batadv_neigh_node *neigh,
* *
* Looks for and possibly returns a neighbour belonging to this originator list * Looks for and possibly returns a neighbour belonging to this originator list
* which is connected through the provided hard interface. * which is connected through the provided hard interface.
* Returns NULL if the neighbour is not found. *
* Return: neighbor when found. Othwerwise NULL
*/ */
static struct batadv_neigh_node * static struct batadv_neigh_node *
batadv_neigh_node_get(const struct batadv_orig_node *orig_node, batadv_neigh_node_get(const struct batadv_orig_node *orig_node,
...@@ -492,7 +499,7 @@ batadv_neigh_node_get(const struct batadv_orig_node *orig_node, ...@@ -492,7 +499,7 @@ batadv_neigh_node_get(const struct batadv_orig_node *orig_node,
* @hard_iface: the interface this neighbour is connected to * @hard_iface: the interface this neighbour is connected to
* @neigh_addr: the interface address of the neighbour to retrieve * @neigh_addr: the interface address of the neighbour to retrieve
* *
* Returns the hardif neighbour node if found or created or NULL otherwise. * Return: the hardif neighbour node if found or created or NULL otherwise.
*/ */
static struct batadv_hardif_neigh_node * static struct batadv_hardif_neigh_node *
batadv_hardif_neigh_create(struct batadv_hard_iface *hard_iface, batadv_hardif_neigh_create(struct batadv_hard_iface *hard_iface,
...@@ -540,7 +547,7 @@ batadv_hardif_neigh_create(struct batadv_hard_iface *hard_iface, ...@@ -540,7 +547,7 @@ batadv_hardif_neigh_create(struct batadv_hard_iface *hard_iface,
* @hard_iface: the interface this neighbour is connected to * @hard_iface: the interface this neighbour is connected to
* @neigh_addr: the interface address of the neighbour to retrieve * @neigh_addr: the interface address of the neighbour to retrieve
* *
* Returns the hardif neighbour node if found or created or NULL otherwise. * Return: the hardif neighbour node if found or created or NULL otherwise.
*/ */
static struct batadv_hardif_neigh_node * static struct batadv_hardif_neigh_node *
batadv_hardif_neigh_get_or_create(struct batadv_hard_iface *hard_iface, batadv_hardif_neigh_get_or_create(struct batadv_hard_iface *hard_iface,
...@@ -562,7 +569,8 @@ batadv_hardif_neigh_get_or_create(struct batadv_hard_iface *hard_iface, ...@@ -562,7 +569,8 @@ batadv_hardif_neigh_get_or_create(struct batadv_hard_iface *hard_iface,
* @neigh_addr: the address of the neighbour * @neigh_addr: the address of the neighbour
* *
* Looks for and possibly returns a neighbour belonging to this hard interface. * Looks for and possibly returns a neighbour belonging to this hard interface.
* Returns NULL if the neighbour is not found. *
* Return: neighbor when found. Othwerwise NULL
*/ */
struct batadv_hardif_neigh_node * struct batadv_hardif_neigh_node *
batadv_hardif_neigh_get(const struct batadv_hard_iface *hard_iface, batadv_hardif_neigh_get(const struct batadv_hard_iface *hard_iface,
...@@ -594,7 +602,8 @@ batadv_hardif_neigh_get(const struct batadv_hard_iface *hard_iface, ...@@ -594,7 +602,8 @@ batadv_hardif_neigh_get(const struct batadv_hard_iface *hard_iface,
* @neigh_addr: the mac address of the neighbour interface * @neigh_addr: the mac address of the neighbour interface
* *
* Allocates a new neigh_node object and initialises all the generic fields. * Allocates a new neigh_node object and initialises all the generic fields.
* Returns the new object or NULL on failure. *
* Return: neighbor when found. Othwerwise NULL
*/ */
struct batadv_neigh_node * struct batadv_neigh_node *
batadv_neigh_node_new(struct batadv_orig_node *orig_node, batadv_neigh_node_new(struct batadv_orig_node *orig_node,
...@@ -656,7 +665,7 @@ batadv_neigh_node_new(struct batadv_orig_node *orig_node, ...@@ -656,7 +665,7 @@ batadv_neigh_node_new(struct batadv_orig_node *orig_node,
* @seq: neighbour table seq_file struct * @seq: neighbour table seq_file struct
* @offset: not used * @offset: not used
* *
* Always returns 0. * Return: always 0
*/ */
int batadv_hardif_neigh_seq_print_text(struct seq_file *seq, void *offset) int batadv_hardif_neigh_seq_print_text(struct seq_file *seq, void *offset)
{ {
...@@ -820,7 +829,8 @@ void batadv_originator_free(struct batadv_priv *bat_priv) ...@@ -820,7 +829,8 @@ void batadv_originator_free(struct batadv_priv *bat_priv)
* *
* Creates a new originator object and initialise all the generic fields. * Creates a new originator object and initialise all the generic fields.
* The new object is not added to the originator list. * The new object is not added to the originator list.
* Returns the newly created object or NULL on failure. *
* Return: the newly created object or NULL on failure.
*/ */
struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv, struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv,
const u8 *addr) const u8 *addr)
...@@ -937,7 +947,7 @@ batadv_purge_neigh_ifinfo(struct batadv_priv *bat_priv, ...@@ -937,7 +947,7 @@ batadv_purge_neigh_ifinfo(struct batadv_priv *bat_priv,
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @orig_node: orig node which is to be checked * @orig_node: orig node which is to be checked
* *
* Returns true if any ifinfo entry was purged, false otherwise. * Return: true if any ifinfo entry was purged, false otherwise.
*/ */
static bool static bool
batadv_purge_orig_ifinfo(struct batadv_priv *bat_priv, batadv_purge_orig_ifinfo(struct batadv_priv *bat_priv,
...@@ -989,7 +999,7 @@ batadv_purge_orig_ifinfo(struct batadv_priv *bat_priv, ...@@ -989,7 +999,7 @@ batadv_purge_orig_ifinfo(struct batadv_priv *bat_priv,
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @orig_node: orig node which is to be checked * @orig_node: orig node which is to be checked
* *
* Returns true if any neighbor was purged, false otherwise * Return: true if any neighbor was purged, false otherwise
*/ */
static bool static bool
batadv_purge_orig_neighbors(struct batadv_priv *bat_priv, batadv_purge_orig_neighbors(struct batadv_priv *bat_priv,
...@@ -1048,7 +1058,7 @@ batadv_purge_orig_neighbors(struct batadv_priv *bat_priv, ...@@ -1048,7 +1058,7 @@ batadv_purge_orig_neighbors(struct batadv_priv *bat_priv,
* @orig_node: orig node which is to be checked * @orig_node: orig node which is to be checked
* @if_outgoing: the interface for which the metric should be compared * @if_outgoing: the interface for which the metric should be compared
* *
* Returns the current best neighbor, with refcount increased. * Return: the current best neighbor, with refcount increased.
*/ */
static struct batadv_neigh_node * static struct batadv_neigh_node *
batadv_find_best_neighbor(struct batadv_priv *bat_priv, batadv_find_best_neighbor(struct batadv_priv *bat_priv,
...@@ -1085,7 +1095,7 @@ batadv_find_best_neighbor(struct batadv_priv *bat_priv, ...@@ -1085,7 +1095,7 @@ batadv_find_best_neighbor(struct batadv_priv *bat_priv,
* This function checks if the orig_node or substructures of it have become * This function checks if the orig_node or substructures of it have become
* obsolete, and purges this information if that's the case. * obsolete, and purges this information if that's the case.
* *
* Returns true if the orig_node is to be removed, false otherwise. * Return: true if the orig_node is to be removed, false otherwise.
*/ */
static bool batadv_purge_orig_node(struct batadv_priv *bat_priv, static bool batadv_purge_orig_node(struct batadv_priv *bat_priv,
struct batadv_orig_node *orig_node) struct batadv_orig_node *orig_node)
...@@ -1230,7 +1240,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset) ...@@ -1230,7 +1240,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
* @seq: debugfs table seq_file struct * @seq: debugfs table seq_file struct
* @offset: not used * @offset: not used
* *
* Returns 0 * Return: 0
*/ */
int batadv_orig_hardif_seq_print_text(struct seq_file *seq, void *offset) int batadv_orig_hardif_seq_print_text(struct seq_file *seq, void *offset)
{ {
......
/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
* *
......
/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
* *
...@@ -158,7 +158,7 @@ enum batadv_tt_client_flags { ...@@ -158,7 +158,7 @@ enum batadv_tt_client_flags {
}; };
/** /**
* batadv_vlan_flags - flags for the four MSB of any vlan ID field * enum batadv_vlan_flags - flags for the four MSB of any vlan ID field
* @BATADV_VLAN_HAS_TAG: whether the field contains a valid vlan tag or not * @BATADV_VLAN_HAS_TAG: whether the field contains a valid vlan tag or not
*/ */
enum batadv_vlan_flags { enum batadv_vlan_flags {
...@@ -209,6 +209,11 @@ struct batadv_bla_claim_dst { ...@@ -209,6 +209,11 @@ struct batadv_bla_claim_dst {
* @version: batman-adv protocol version, part of the genereal header * @version: batman-adv protocol version, part of the genereal header
* @ttl: time to live for this packet, part of the genereal header * @ttl: time to live for this packet, part of the genereal header
* @flags: contains routing relevant flags - see enum batadv_iv_flags * @flags: contains routing relevant flags - see enum batadv_iv_flags
* @seqno: sequence identification
* @orig: address of the source node
* @prev_sender: address of the previous sender
* @reserved: reserved byte for alignment
* @tq: transmission quality
* @tvlv_len: length of tvlv data following the ogm header * @tvlv_len: length of tvlv data following the ogm header
*/ */
struct batadv_ogm_packet { struct batadv_ogm_packet {
...@@ -230,7 +235,7 @@ struct batadv_ogm_packet { ...@@ -230,7 +235,7 @@ struct batadv_ogm_packet {
#define BATADV_OGM_HLEN sizeof(struct batadv_ogm_packet) #define BATADV_OGM_HLEN sizeof(struct batadv_ogm_packet)
/** /**
* batadv_icmp_header - common members among all the ICMP packets * struct batadv_icmp_header - common members among all the ICMP packets
* @packet_type: batman-adv packet type, part of the general header * @packet_type: batman-adv packet type, part of the general header
* @version: batman-adv protocol version, part of the genereal header * @version: batman-adv protocol version, part of the genereal header
* @ttl: time to live for this packet, part of the genereal header * @ttl: time to live for this packet, part of the genereal header
...@@ -256,7 +261,7 @@ struct batadv_icmp_header { ...@@ -256,7 +261,7 @@ struct batadv_icmp_header {
}; };
/** /**
* batadv_icmp_packet - ICMP packet * struct batadv_icmp_packet - ICMP packet
* @packet_type: batman-adv packet type, part of the general header * @packet_type: batman-adv packet type, part of the general header
* @version: batman-adv protocol version, part of the genereal header * @version: batman-adv protocol version, part of the genereal header
* @ttl: time to live for this packet, part of the genereal header * @ttl: time to live for this packet, part of the genereal header
...@@ -282,7 +287,7 @@ struct batadv_icmp_packet { ...@@ -282,7 +287,7 @@ struct batadv_icmp_packet {
#define BATADV_RR_LEN 16 #define BATADV_RR_LEN 16
/** /**
* batadv_icmp_packet_rr - ICMP RouteRecord packet * struct batadv_icmp_packet_rr - ICMP RouteRecord packet
* @packet_type: batman-adv packet type, part of the general header * @packet_type: batman-adv packet type, part of the general header
* @version: batman-adv protocol version, part of the genereal header * @version: batman-adv protocol version, part of the genereal header
* @ttl: time to live for this packet, part of the genereal header * @ttl: time to live for this packet, part of the genereal header
...@@ -345,6 +350,7 @@ struct batadv_unicast_packet { ...@@ -345,6 +350,7 @@ struct batadv_unicast_packet {
* @u: common unicast packet header * @u: common unicast packet header
* @src: address of the source * @src: address of the source
* @subtype: packet subtype * @subtype: packet subtype
* @reserved: reserved byte for alignment
*/ */
struct batadv_unicast_4addr_packet { struct batadv_unicast_4addr_packet {
struct batadv_unicast_packet u; struct batadv_unicast_packet u;
...@@ -413,7 +419,6 @@ struct batadv_bcast_packet { ...@@ -413,7 +419,6 @@ struct batadv_bcast_packet {
* @packet_type: batman-adv packet type, part of the general header * @packet_type: batman-adv packet type, part of the general header
* @version: batman-adv protocol version, part of the genereal header * @version: batman-adv protocol version, part of the genereal header
* @ttl: time to live for this packet, part of the genereal header * @ttl: time to live for this packet, part of the genereal header
* @reserved: Align following fields to 2-byte boundaries
* @first_source: original source of first included packet * @first_source: original source of first included packet
* @first_orig_dest: original destinal of first included packet * @first_orig_dest: original destinal of first included packet
* @first_crc: checksum of first included packet * @first_crc: checksum of first included packet
...@@ -495,7 +500,7 @@ struct batadv_tvlv_gateway_data { ...@@ -495,7 +500,7 @@ struct batadv_tvlv_gateway_data {
* struct batadv_tvlv_tt_data - tt data propagated through the tt tvlv container * struct batadv_tvlv_tt_data - tt data propagated through the tt tvlv container
* @flags: translation table flags (see batadv_tt_data_flags) * @flags: translation table flags (see batadv_tt_data_flags)
* @ttvn: translation table version number * @ttvn: translation table version number
* @vlan_num: number of announced VLANs. In the TVLV this struct is followed by * @num_vlan: number of announced VLANs. In the TVLV this struct is followed by
* one batadv_tvlv_tt_vlan_data object per announced vlan * one batadv_tvlv_tt_vlan_data object per announced vlan
*/ */
struct batadv_tvlv_tt_data { struct batadv_tvlv_tt_data {
......
/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
* *
...@@ -140,9 +140,17 @@ void batadv_update_route(struct batadv_priv *bat_priv, ...@@ -140,9 +140,17 @@ void batadv_update_route(struct batadv_priv *bat_priv,
batadv_neigh_node_free_ref(router); batadv_neigh_node_free_ref(router);
} }
/* checks whether the host restarted and is in the protection time. /**
* returns: * batadv_window_protected - checks whether the host restarted and is in the
* 0 if the packet is to be accepted * protection time.
* @bat_priv: the bat priv with all the soft interface information
* @seq_num_diff: difference between the current/received sequence number and
* the last sequence number
* @last_reset: jiffies timestamp of the last reset, will be updated when reset
* is detected
*
* Return:
* 0 if the packet is to be accepted.
* 1 if the packet is to be ignored. * 1 if the packet is to be ignored.
*/ */
int batadv_window_protected(struct batadv_priv *bat_priv, s32 seq_num_diff, int batadv_window_protected(struct batadv_priv *bat_priv, s32 seq_num_diff,
...@@ -198,7 +206,7 @@ bool batadv_check_management_packet(struct sk_buff *skb, ...@@ -198,7 +206,7 @@ bool batadv_check_management_packet(struct sk_buff *skb,
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @skb: icmp packet to process * @skb: icmp packet to process
* *
* Returns NET_RX_SUCCESS if the packet has been consumed or NET_RX_DROP * Return: NET_RX_SUCCESS if the packet has been consumed or NET_RX_DROP
* otherwise. * otherwise.
*/ */
static int batadv_recv_my_icmp_packet(struct batadv_priv *bat_priv, static int batadv_recv_my_icmp_packet(struct batadv_priv *bat_priv,
...@@ -398,10 +406,11 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, ...@@ -398,10 +406,11 @@ int batadv_recv_icmp_packet(struct sk_buff *skb,
* @skb: packet to check * @skb: packet to check
* @hdr_size: size of header to pull * @hdr_size: size of header to pull
* *
* Check for short header and bad addresses in given packet. Returns negative * Check for short header and bad addresses in given packet.
* value when check fails and 0 otherwise. The negative value depends on the *
* reason: -ENODATA for bad header, -EBADR for broadcast destination or source, * Return: negative value when check fails and 0 otherwise. The negative value
* and -EREMOTE for non-local (other host) destination. * depends on the reason: -ENODATA for bad header, -EBADR for broadcast
* destination or source, and -EREMOTE for non-local (other host) destination.
*/ */
static int batadv_check_unicast_packet(struct batadv_priv *bat_priv, static int batadv_check_unicast_packet(struct batadv_priv *bat_priv,
struct sk_buff *skb, int hdr_size) struct sk_buff *skb, int hdr_size)
...@@ -435,7 +444,7 @@ static int batadv_check_unicast_packet(struct batadv_priv *bat_priv, ...@@ -435,7 +444,7 @@ static int batadv_check_unicast_packet(struct batadv_priv *bat_priv,
* @orig_node: the destination node * @orig_node: the destination node
* @recv_if: pointer to interface this packet was received on * @recv_if: pointer to interface this packet was received on
* *
* Returns the router which should be used for this orig_node on * Return: the router which should be used for this orig_node on
* this interface, or NULL if not available. * this interface, or NULL if not available.
*/ */
struct batadv_neigh_node * struct batadv_neigh_node *
...@@ -648,7 +657,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, ...@@ -648,7 +657,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
* the new corresponding information (originator address where the destination * the new corresponding information (originator address where the destination
* client currently is and its known TTVN) * client currently is and its known TTVN)
* *
* Returns true if the packet header has been updated, false otherwise * Return: true if the packet header has been updated, false otherwise
*/ */
static bool static bool
batadv_reroute_unicast_packet(struct batadv_priv *bat_priv, batadv_reroute_unicast_packet(struct batadv_priv *bat_priv,
...@@ -805,7 +814,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, ...@@ -805,7 +814,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
* @skb: unicast tvlv packet to process * @skb: unicast tvlv packet to process
* @recv_if: pointer to interface this packet was received on * @recv_if: pointer to interface this packet was received on
* *
* Returns NET_RX_SUCCESS if the packet has been consumed or NET_RX_DROP * Return: NET_RX_SUCCESS if the packet has been consumed or NET_RX_DROP
* otherwise. * otherwise.
*/ */
int batadv_recv_unhandled_unicast_packet(struct sk_buff *skb, int batadv_recv_unhandled_unicast_packet(struct sk_buff *skb,
...@@ -904,9 +913,8 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, ...@@ -904,9 +913,8 @@ int batadv_recv_unicast_packet(struct sk_buff *skb,
* batadv_recv_unicast_tvlv - receive and process unicast tvlv packets * batadv_recv_unicast_tvlv - receive and process unicast tvlv packets
* @skb: unicast tvlv packet to process * @skb: unicast tvlv packet to process
* @recv_if: pointer to interface this packet was received on * @recv_if: pointer to interface this packet was received on
* @dst_addr: the payload destination
* *
* Returns NET_RX_SUCCESS if the packet has been consumed or NET_RX_DROP * Return: NET_RX_SUCCESS if the packet has been consumed or NET_RX_DROP
* otherwise. * otherwise.
*/ */
int batadv_recv_unicast_tvlv(struct sk_buff *skb, int batadv_recv_unicast_tvlv(struct sk_buff *skb,
...@@ -960,7 +968,7 @@ int batadv_recv_unicast_tvlv(struct sk_buff *skb, ...@@ -960,7 +968,7 @@ int batadv_recv_unicast_tvlv(struct sk_buff *skb,
* the assembled packet will exceed our MTU; 2) Buffer fragment, if we till * the assembled packet will exceed our MTU; 2) Buffer fragment, if we till
* lack further fragments; 3) Merge fragments, if we have all needed parts. * lack further fragments; 3) Merge fragments, if we have all needed parts.
* *
* Return NET_RX_DROP if the skb is not consumed, NET_RX_SUCCESS otherwise. * Return: NET_RX_DROP if the skb is not consumed, NET_RX_SUCCESS otherwise.
*/ */
int batadv_recv_frag_packet(struct sk_buff *skb, int batadv_recv_frag_packet(struct sk_buff *skb,
struct batadv_hard_iface *recv_if) struct batadv_hard_iface *recv_if)
......
/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
* *
......
/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
* *
...@@ -111,7 +111,7 @@ int batadv_send_skb_packet(struct sk_buff *skb, ...@@ -111,7 +111,7 @@ int batadv_send_skb_packet(struct sk_buff *skb,
* host, NULL can be passed as recv_if and no interface alternating is * host, NULL can be passed as recv_if and no interface alternating is
* attempted. * attempted.
* *
* Returns NET_XMIT_SUCCESS on success, NET_XMIT_DROP on failure, or * Return: NET_XMIT_SUCCESS on success, NET_XMIT_DROP on failure, or
* NET_XMIT_POLICED if the skb is buffered for later transmit. * NET_XMIT_POLICED if the skb is buffered for later transmit.
*/ */
int batadv_send_skb_to_orig(struct sk_buff *skb, int batadv_send_skb_to_orig(struct sk_buff *skb,
...@@ -165,7 +165,7 @@ int batadv_send_skb_to_orig(struct sk_buff *skb, ...@@ -165,7 +165,7 @@ int batadv_send_skb_to_orig(struct sk_buff *skb,
* @hdr_size: amount of bytes to push at the beginning of the skb * @hdr_size: amount of bytes to push at the beginning of the skb
* @orig_node: the destination node * @orig_node: the destination node
* *
* Returns false if the buffer extension was not possible or true otherwise. * Return: false if the buffer extension was not possible or true otherwise.
*/ */
static bool static bool
batadv_send_skb_push_fill_unicast(struct sk_buff *skb, int hdr_size, batadv_send_skb_push_fill_unicast(struct sk_buff *skb, int hdr_size,
...@@ -196,7 +196,7 @@ batadv_send_skb_push_fill_unicast(struct sk_buff *skb, int hdr_size, ...@@ -196,7 +196,7 @@ batadv_send_skb_push_fill_unicast(struct sk_buff *skb, int hdr_size,
* @skb: the skb containing the payload to encapsulate * @skb: the skb containing the payload to encapsulate
* @orig_node: the destination node * @orig_node: the destination node
* *
* Returns false if the payload could not be encapsulated or true otherwise. * Return: false if the payload could not be encapsulated or true otherwise.
*/ */
static bool batadv_send_skb_prepare_unicast(struct sk_buff *skb, static bool batadv_send_skb_prepare_unicast(struct sk_buff *skb,
struct batadv_orig_node *orig_node) struct batadv_orig_node *orig_node)
...@@ -211,10 +211,10 @@ static bool batadv_send_skb_prepare_unicast(struct sk_buff *skb, ...@@ -211,10 +211,10 @@ static bool batadv_send_skb_prepare_unicast(struct sk_buff *skb,
* unicast 4addr header * unicast 4addr header
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @skb: the skb containing the payload to encapsulate * @skb: the skb containing the payload to encapsulate
* @orig_node: the destination node * @orig: the destination node
* @packet_subtype: the unicast 4addr packet subtype to use * @packet_subtype: the unicast 4addr packet subtype to use
* *
* Returns false if the payload could not be encapsulated or true otherwise. * Return: false if the payload could not be encapsulated or true otherwise.
*/ */
bool batadv_send_skb_prepare_unicast_4addr(struct batadv_priv *bat_priv, bool batadv_send_skb_prepare_unicast_4addr(struct batadv_priv *bat_priv,
struct sk_buff *skb, struct sk_buff *skb,
...@@ -265,7 +265,7 @@ bool batadv_send_skb_prepare_unicast_4addr(struct batadv_priv *bat_priv, ...@@ -265,7 +265,7 @@ bool batadv_send_skb_prepare_unicast_4addr(struct batadv_priv *bat_priv,
* as packet_type. Then send this frame to the given orig_node and release a * as packet_type. Then send this frame to the given orig_node and release a
* reference to this orig_node. * reference to this orig_node.
* *
* Returns NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise. * Return: NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise.
*/ */
int batadv_send_skb_unicast(struct batadv_priv *bat_priv, int batadv_send_skb_unicast(struct batadv_priv *bat_priv,
struct sk_buff *skb, int packet_type, struct sk_buff *skb, int packet_type,
...@@ -339,7 +339,7 @@ int batadv_send_skb_unicast(struct batadv_priv *bat_priv, ...@@ -339,7 +339,7 @@ int batadv_send_skb_unicast(struct batadv_priv *bat_priv,
* BATADV_UNICAST_4ADDR was supplied as packet_type. Then send this frame * BATADV_UNICAST_4ADDR was supplied as packet_type. Then send this frame
* to the according destination node. * to the according destination node.
* *
* Returns NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise. * Return: NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise.
*/ */
int batadv_send_skb_via_tt_generic(struct batadv_priv *bat_priv, int batadv_send_skb_via_tt_generic(struct batadv_priv *bat_priv,
struct sk_buff *skb, int packet_type, struct sk_buff *skb, int packet_type,
...@@ -373,7 +373,7 @@ int batadv_send_skb_via_tt_generic(struct batadv_priv *bat_priv, ...@@ -373,7 +373,7 @@ int batadv_send_skb_via_tt_generic(struct batadv_priv *bat_priv,
* Look up the currently selected gateway. Wrap the given skb into a batman-adv * Look up the currently selected gateway. Wrap the given skb into a batman-adv
* unicast header and send this frame to this gateway node. * unicast header and send this frame to this gateway node.
* *
* Returns NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise. * Return: NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise.
*/ */
int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb, int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb,
unsigned short vid) unsigned short vid)
...@@ -430,14 +430,19 @@ _batadv_add_bcast_packet_to_list(struct batadv_priv *bat_priv, ...@@ -430,14 +430,19 @@ _batadv_add_bcast_packet_to_list(struct batadv_priv *bat_priv,
send_time); send_time);
} }
/* add a broadcast packet to the queue and setup timers. broadcast packets /**
* are sent multiple times to increase probability for being received. * batadv_add_bcast_packet_to_list - queue broadcast packet for multiple sends
* @bat_priv: the bat priv with all the soft interface information
* @skb: broadcast packet to add
* @delay: number of jiffies to wait before sending
* *
* This function returns NETDEV_TX_OK on success and NETDEV_TX_BUSY on * add a broadcast packet to the queue and setup timers. broadcast packets
* errors. * are sent multiple times to increase probability for being received.
* *
* The skb is not consumed, so the caller should make sure that the * The skb is not consumed, so the caller should make sure that the
* skb is freed. * skb is freed.
*
* Return: NETDEV_TX_OK on success and NETDEV_TX_BUSY on errors.
*/ */
int batadv_add_bcast_packet_to_list(struct batadv_priv *bat_priv, int batadv_add_bcast_packet_to_list(struct batadv_priv *bat_priv,
const struct sk_buff *skb, const struct sk_buff *skb,
......
/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
* *
...@@ -69,7 +69,7 @@ int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb, ...@@ -69,7 +69,7 @@ int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb,
* header via the translation table. Wrap the given skb into a batman-adv * header via the translation table. Wrap the given skb into a batman-adv
* unicast header. Then send this frame to the according destination node. * unicast header. Then send this frame to the according destination node.
* *
* Returns NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise. * Return: NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise.
*/ */
static inline int batadv_send_skb_via_tt(struct batadv_priv *bat_priv, static inline int batadv_send_skb_via_tt(struct batadv_priv *bat_priv,
struct sk_buff *skb, u8 *dst_hint, struct sk_buff *skb, u8 *dst_hint,
...@@ -92,7 +92,7 @@ static inline int batadv_send_skb_via_tt(struct batadv_priv *bat_priv, ...@@ -92,7 +92,7 @@ static inline int batadv_send_skb_via_tt(struct batadv_priv *bat_priv,
* unicast-4addr header. Then send this frame to the according destination * unicast-4addr header. Then send this frame to the according destination
* node. * node.
* *
* Returns NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise. * Return: NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise.
*/ */
static inline int batadv_send_skb_via_tt_4addr(struct batadv_priv *bat_priv, static inline int batadv_send_skb_via_tt_4addr(struct batadv_priv *bat_priv,
struct sk_buff *skb, struct sk_buff *skb,
......
/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
* *
...@@ -480,7 +480,7 @@ void batadv_interface_rx(struct net_device *soft_iface, ...@@ -480,7 +480,7 @@ void batadv_interface_rx(struct net_device *soft_iface,
/** /**
* batadv_softif_vlan_free_ref - decrease the vlan object refcounter and * batadv_softif_vlan_free_ref - decrease the vlan object refcounter and
* possibly free it * possibly free it
* @softif_vlan: the vlan object to release * @vlan: the vlan object to release
*/ */
void batadv_softif_vlan_free_ref(struct batadv_softif_vlan *vlan) void batadv_softif_vlan_free_ref(struct batadv_softif_vlan *vlan)
{ {
...@@ -501,7 +501,7 @@ void batadv_softif_vlan_free_ref(struct batadv_softif_vlan *vlan) ...@@ -501,7 +501,7 @@ void batadv_softif_vlan_free_ref(struct batadv_softif_vlan *vlan)
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @vid: the identifier of the vlan object to retrieve * @vid: the identifier of the vlan object to retrieve
* *
* Returns the private data of the vlan matching the vid passed as argument or * Return: the private data of the vlan matching the vid passed as argument or
* NULL otherwise. The refcounter of the returned object is incremented by 1. * NULL otherwise. The refcounter of the returned object is incremented by 1.
*/ */
struct batadv_softif_vlan *batadv_softif_vlan_get(struct batadv_priv *bat_priv, struct batadv_softif_vlan *batadv_softif_vlan_get(struct batadv_priv *bat_priv,
...@@ -530,7 +530,7 @@ struct batadv_softif_vlan *batadv_softif_vlan_get(struct batadv_priv *bat_priv, ...@@ -530,7 +530,7 @@ struct batadv_softif_vlan *batadv_softif_vlan_get(struct batadv_priv *bat_priv,
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @vid: the VLAN identifier * @vid: the VLAN identifier
* *
* Returns 0 on success, a negative error otherwise. * Return: 0 on success, a negative error otherwise.
*/ */
int batadv_softif_create_vlan(struct batadv_priv *bat_priv, unsigned short vid) int batadv_softif_create_vlan(struct batadv_priv *bat_priv, unsigned short vid)
{ {
...@@ -594,12 +594,13 @@ static void batadv_softif_destroy_vlan(struct batadv_priv *bat_priv, ...@@ -594,12 +594,13 @@ static void batadv_softif_destroy_vlan(struct batadv_priv *bat_priv,
/** /**
* batadv_interface_add_vid - ndo_add_vid API implementation * batadv_interface_add_vid - ndo_add_vid API implementation
* @dev: the netdev of the mesh interface * @dev: the netdev of the mesh interface
* @proto: protocol of the the vlan id
* @vid: identifier of the new vlan * @vid: identifier of the new vlan
* *
* Set up all the internal structures for handling the new vlan on top of the * Set up all the internal structures for handling the new vlan on top of the
* mesh interface * mesh interface
* *
* Returns 0 on success or a negative error code in case of failure. * Return: 0 on success or a negative error code in case of failure.
*/ */
static int batadv_interface_add_vid(struct net_device *dev, __be16 proto, static int batadv_interface_add_vid(struct net_device *dev, __be16 proto,
unsigned short vid) unsigned short vid)
...@@ -651,12 +652,13 @@ static int batadv_interface_add_vid(struct net_device *dev, __be16 proto, ...@@ -651,12 +652,13 @@ static int batadv_interface_add_vid(struct net_device *dev, __be16 proto,
/** /**
* batadv_interface_kill_vid - ndo_kill_vid API implementation * batadv_interface_kill_vid - ndo_kill_vid API implementation
* @dev: the netdev of the mesh interface * @dev: the netdev of the mesh interface
* @proto: protocol of the the vlan id
* @vid: identifier of the deleted vlan * @vid: identifier of the deleted vlan
* *
* Destroy all the internal structures used to handle the vlan identified by vid * Destroy all the internal structures used to handle the vlan identified by vid
* on top of the mesh interface * on top of the mesh interface
* *
* Returns 0 on success, -EINVAL if the specified prototype is not ETH_P_8021Q * Return: 0 on success, -EINVAL if the specified prototype is not ETH_P_8021Q
* or -ENOENT if the specified vlan id wasn't registered. * or -ENOENT if the specified vlan id wasn't registered.
*/ */
static int batadv_interface_kill_vid(struct net_device *dev, __be16 proto, static int batadv_interface_kill_vid(struct net_device *dev, __be16 proto,
...@@ -745,7 +747,7 @@ static void batadv_softif_destroy_finish(struct work_struct *work) ...@@ -745,7 +747,7 @@ static void batadv_softif_destroy_finish(struct work_struct *work)
* batadv_softif_init_late - late stage initialization of soft interface * batadv_softif_init_late - late stage initialization of soft interface
* @dev: registered network device to modify * @dev: registered network device to modify
* *
* Returns error code on failures * Return: error code on failures
*/ */
static int batadv_softif_init_late(struct net_device *dev) static int batadv_softif_init_late(struct net_device *dev)
{ {
...@@ -847,7 +849,7 @@ static int batadv_softif_init_late(struct net_device *dev) ...@@ -847,7 +849,7 @@ static int batadv_softif_init_late(struct net_device *dev)
* @dev: batadv_soft_interface used as master interface * @dev: batadv_soft_interface used as master interface
* @slave_dev: net_device which should become the slave interface * @slave_dev: net_device which should become the slave interface
* *
* Return 0 if successful or error otherwise. * Return: 0 if successful or error otherwise.
*/ */
static int batadv_softif_slave_add(struct net_device *dev, static int batadv_softif_slave_add(struct net_device *dev,
struct net_device *slave_dev) struct net_device *slave_dev)
...@@ -872,7 +874,7 @@ static int batadv_softif_slave_add(struct net_device *dev, ...@@ -872,7 +874,7 @@ static int batadv_softif_slave_add(struct net_device *dev,
* @dev: batadv_soft_interface used as master interface * @dev: batadv_soft_interface used as master interface
* @slave_dev: net_device which should be removed from the master interface * @slave_dev: net_device which should be removed from the master interface
* *
* Return 0 if successful or error otherwise. * Return: 0 if successful or error otherwise.
*/ */
static int batadv_softif_slave_del(struct net_device *dev, static int batadv_softif_slave_del(struct net_device *dev,
struct net_device *slave_dev) struct net_device *slave_dev)
......
/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
* *
......
/* Copyright (C) 2010-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2010-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
* *
...@@ -64,7 +64,7 @@ static struct batadv_priv *batadv_kobj_to_batpriv(struct kobject *obj) ...@@ -64,7 +64,7 @@ static struct batadv_priv *batadv_kobj_to_batpriv(struct kobject *obj)
* batadv_vlan_kobj_to_batpriv - convert a vlan kobj in the associated batpriv * batadv_vlan_kobj_to_batpriv - convert a vlan kobj in the associated batpriv
* @obj: kobject to covert * @obj: kobject to covert
* *
* Returns the associated batadv_priv struct. * Return: the associated batadv_priv struct.
*/ */
static struct batadv_priv *batadv_vlan_kobj_to_batpriv(struct kobject *obj) static struct batadv_priv *batadv_vlan_kobj_to_batpriv(struct kobject *obj)
{ {
...@@ -82,9 +82,10 @@ static struct batadv_priv *batadv_vlan_kobj_to_batpriv(struct kobject *obj) ...@@ -82,9 +82,10 @@ static struct batadv_priv *batadv_vlan_kobj_to_batpriv(struct kobject *obj)
/** /**
* batadv_kobj_to_vlan - convert a kobj in the associated softif_vlan struct * batadv_kobj_to_vlan - convert a kobj in the associated softif_vlan struct
* @bat_priv: the bat priv with all the soft interface information
* @obj: kobject to covert * @obj: kobject to covert
* *
* Returns the associated softif_vlan struct if found, NULL otherwise. * Return: the associated softif_vlan struct if found, NULL otherwise.
*/ */
static struct batadv_softif_vlan * static struct batadv_softif_vlan *
batadv_kobj_to_vlan(struct batadv_priv *bat_priv, struct kobject *obj) batadv_kobj_to_vlan(struct batadv_priv *bat_priv, struct kobject *obj)
...@@ -491,7 +492,7 @@ static ssize_t batadv_store_gw_bwidth(struct kobject *kobj, ...@@ -491,7 +492,7 @@ static ssize_t batadv_store_gw_bwidth(struct kobject *kobj,
* @attr: the batman-adv attribute the user is interacting with * @attr: the batman-adv attribute the user is interacting with
* @buff: the buffer that will contain the data to send back to the user * @buff: the buffer that will contain the data to send back to the user
* *
* Returns the number of bytes written into 'buff' on success or a negative * Return: the number of bytes written into 'buff' on success or a negative
* error code in case of failure * error code in case of failure
*/ */
static ssize_t batadv_show_isolation_mark(struct kobject *kobj, static ssize_t batadv_show_isolation_mark(struct kobject *kobj,
...@@ -511,7 +512,7 @@ static ssize_t batadv_show_isolation_mark(struct kobject *kobj, ...@@ -511,7 +512,7 @@ static ssize_t batadv_show_isolation_mark(struct kobject *kobj,
* @buff: the buffer containing the user data * @buff: the buffer containing the user data
* @count: number of bytes in the buffer * @count: number of bytes in the buffer
* *
* Returns 'count' on success or a negative error code in case of failure * Return: 'count' on success or a negative error code in case of failure
*/ */
static ssize_t batadv_store_isolation_mark(struct kobject *kobj, static ssize_t batadv_store_isolation_mark(struct kobject *kobj,
struct attribute *attr, char *buff, struct attribute *attr, char *buff,
...@@ -620,9 +621,7 @@ static struct batadv_attribute *batadv_mesh_attrs[] = { ...@@ -620,9 +621,7 @@ static struct batadv_attribute *batadv_mesh_attrs[] = {
BATADV_ATTR_VLAN_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL); BATADV_ATTR_VLAN_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL);
/** /* array of vlan specific sysfs attributes */
* batadv_vlan_attrs - array of vlan specific sysfs attributes
*/
static struct batadv_attribute *batadv_vlan_attrs[] = { static struct batadv_attribute *batadv_vlan_attrs[] = {
&batadv_attr_vlan_ap_isolation, &batadv_attr_vlan_ap_isolation,
NULL, NULL,
...@@ -683,7 +682,7 @@ void batadv_sysfs_del_meshif(struct net_device *dev) ...@@ -683,7 +682,7 @@ void batadv_sysfs_del_meshif(struct net_device *dev)
* @dev: netdev of the mesh interface * @dev: netdev of the mesh interface
* @vlan: private data of the newly added VLAN interface * @vlan: private data of the newly added VLAN interface
* *
* Returns 0 on success and -ENOMEM if any of the structure allocations fails. * Return: 0 on success and -ENOMEM if any of the structure allocations fails.
*/ */
int batadv_sysfs_add_vlan(struct net_device *dev, int batadv_sysfs_add_vlan(struct net_device *dev,
struct batadv_softif_vlan *vlan) struct batadv_softif_vlan *vlan)
......
/* Copyright (C) 2010-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2010-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
* *
......
/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich, Antonio Quartulli * Marek Lindner, Simon Wunderlich, Antonio Quartulli
* *
...@@ -68,7 +68,15 @@ static void batadv_tt_global_del(struct batadv_priv *bat_priv, ...@@ -68,7 +68,15 @@ static void batadv_tt_global_del(struct batadv_priv *bat_priv,
unsigned short vid, const char *message, unsigned short vid, const char *message,
bool roaming); bool roaming);
/* returns 1 if they are the same mac addr and vid */ /**
* batadv_compare_tt - check if two TT entries are the same
* @node: the list element pointer of the first TT entry
* @data2: pointer to the tt_common_entry of the second TT entry
*
* Compare the MAC address and the VLAN ID of the two TT entries and check if
* they are the same TT client.
* Return: 1 if the two TT clients are the same, 0 otherwise
*/
static int batadv_compare_tt(const struct hlist_node *node, const void *data2) static int batadv_compare_tt(const struct hlist_node *node, const void *data2)
{ {
const void *data1 = container_of(node, struct batadv_tt_common_entry, const void *data1 = container_of(node, struct batadv_tt_common_entry,
...@@ -84,7 +92,7 @@ static int batadv_compare_tt(const struct hlist_node *node, const void *data2) ...@@ -84,7 +92,7 @@ static int batadv_compare_tt(const struct hlist_node *node, const void *data2)
* @data: pointer to the tt_common_entry object to map * @data: pointer to the tt_common_entry object to map
* @size: the size of the hash table * @size: the size of the hash table
* *
* Returns the hash index where the object represented by 'data' should be * Return: the hash index where the object represented by 'data' should be
* stored at. * stored at.
*/ */
static inline u32 batadv_choose_tt(const void *data, u32 size) static inline u32 batadv_choose_tt(const void *data, u32 size)
...@@ -105,7 +113,7 @@ static inline u32 batadv_choose_tt(const void *data, u32 size) ...@@ -105,7 +113,7 @@ static inline u32 batadv_choose_tt(const void *data, u32 size)
* @addr: the mac address of the client to look for * @addr: the mac address of the client to look for
* @vid: VLAN identifier * @vid: VLAN identifier
* *
* Returns a pointer to the tt_common struct belonging to the searched client if * Return: a pointer to the tt_common struct belonging to the searched client if
* found, NULL otherwise. * found, NULL otherwise.
*/ */
static struct batadv_tt_common_entry * static struct batadv_tt_common_entry *
...@@ -150,7 +158,7 @@ batadv_tt_hash_find(struct batadv_hashtable *hash, const u8 *addr, ...@@ -150,7 +158,7 @@ batadv_tt_hash_find(struct batadv_hashtable *hash, const u8 *addr,
* @addr: the mac address of the client to look for * @addr: the mac address of the client to look for
* @vid: VLAN identifier * @vid: VLAN identifier
* *
* Returns a pointer to the corresponding tt_local_entry struct if the client is * Return: a pointer to the corresponding tt_local_entry struct if the client is
* found, NULL otherwise. * found, NULL otherwise.
*/ */
static struct batadv_tt_local_entry * static struct batadv_tt_local_entry *
...@@ -175,7 +183,7 @@ batadv_tt_local_hash_find(struct batadv_priv *bat_priv, const u8 *addr, ...@@ -175,7 +183,7 @@ batadv_tt_local_hash_find(struct batadv_priv *bat_priv, const u8 *addr,
* @addr: the mac address of the client to look for * @addr: the mac address of the client to look for
* @vid: VLAN identifier * @vid: VLAN identifier
* *
* Returns a pointer to the corresponding tt_global_entry struct if the client * Return: a pointer to the corresponding tt_global_entry struct if the client
* is found, NULL otherwise. * is found, NULL otherwise.
*/ */
static struct batadv_tt_global_entry * static struct batadv_tt_global_entry *
...@@ -217,11 +225,11 @@ batadv_tt_global_entry_free_ref(struct batadv_tt_global_entry *tt_global_entry) ...@@ -217,11 +225,11 @@ batadv_tt_global_entry_free_ref(struct batadv_tt_global_entry *tt_global_entry)
/** /**
* batadv_tt_global_hash_count - count the number of orig entries * batadv_tt_global_hash_count - count the number of orig entries
* @hash: hash table containing the tt entries * @bat_priv: the bat priv with all the soft interface information
* @addr: the mac address of the client to count entries for * @addr: the mac address of the client to count entries for
* @vid: VLAN identifier * @vid: VLAN identifier
* *
* Return the number of originators advertising the given address/data * Return: the number of originators advertising the given address/data
* (excluding ourself). * (excluding ourself).
*/ */
int batadv_tt_global_hash_count(struct batadv_priv *bat_priv, int batadv_tt_global_hash_count(struct batadv_priv *bat_priv,
...@@ -286,9 +294,9 @@ static void batadv_tt_local_size_dec(struct batadv_priv *bat_priv, ...@@ -286,9 +294,9 @@ static void batadv_tt_local_size_dec(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_tt_global_size_mod - change the size by v of the local table * batadv_tt_global_size_mod - change the size by v of the global table
* identified by vid * for orig_node identified by vid
* @bat_priv: the bat priv with all the soft interface information * @orig_node: the originator for which the table has to be modified
* @vid: the VLAN identifier * @vid: the VLAN identifier
* @v: the amount to sum to the global table size * @v: the amount to sum to the global table size
*/ */
...@@ -435,7 +443,7 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv, ...@@ -435,7 +443,7 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv,
* batadv_tt_len - compute length in bytes of given number of tt changes * batadv_tt_len - compute length in bytes of given number of tt changes
* @changes_num: number of tt changes * @changes_num: number of tt changes
* *
* Returns computed length in bytes. * Return: computed length in bytes.
*/ */
static int batadv_tt_len(int changes_num) static int batadv_tt_len(int changes_num)
{ {
...@@ -446,7 +454,7 @@ static int batadv_tt_len(int changes_num) ...@@ -446,7 +454,7 @@ static int batadv_tt_len(int changes_num)
* batadv_tt_entries - compute the number of entries fitting in tt_len bytes * batadv_tt_entries - compute the number of entries fitting in tt_len bytes
* @tt_len: available space * @tt_len: available space
* *
* Returns the number of entries. * Return: the number of entries.
*/ */
static u16 batadv_tt_entries(u16 tt_len) static u16 batadv_tt_entries(u16 tt_len)
{ {
...@@ -458,7 +466,7 @@ static u16 batadv_tt_entries(u16 tt_len) ...@@ -458,7 +466,7 @@ static u16 batadv_tt_entries(u16 tt_len)
* size when transmitted over the air * size when transmitted over the air
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* *
* Returns local translation table size in bytes. * Return: local translation table size in bytes.
*/ */
static int batadv_tt_local_table_transmit_size(struct batadv_priv *bat_priv) static int batadv_tt_local_table_transmit_size(struct batadv_priv *bat_priv)
{ {
...@@ -524,7 +532,7 @@ static void batadv_tt_global_free(struct batadv_priv *bat_priv, ...@@ -524,7 +532,7 @@ static void batadv_tt_global_free(struct batadv_priv *bat_priv,
* @mark: the value contained in the skb->mark field of the received packet (if * @mark: the value contained in the skb->mark field of the received packet (if
* any) * any)
* *
* Returns true if the client was successfully added, false otherwise. * Return: true if the client was successfully added, false otherwise.
*/ */
bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr, bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr,
unsigned short vid, int ifindex, u32 mark) unsigned short vid, int ifindex, u32 mark)
...@@ -719,12 +727,11 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr, ...@@ -719,12 +727,11 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr,
* function reserves the amount of space needed to send the entire global TT * function reserves the amount of space needed to send the entire global TT
* table. In case of success the value is updated with the real amount of * table. In case of success the value is updated with the real amount of
* reserved bytes * reserved bytes
* Allocate the needed amount of memory for the entire TT TVLV and write its * Allocate the needed amount of memory for the entire TT TVLV and write its
* header made up by one tvlv_tt_data object and a series of tvlv_tt_vlan_data * header made up by one tvlv_tt_data object and a series of tvlv_tt_vlan_data
* objects, one per active VLAN served by the originator node. * objects, one per active VLAN served by the originator node.
* *
* Return the size of the allocated buffer or 0 in case of failure. * Return: the size of the allocated buffer or 0 in case of failure.
*/ */
static u16 static u16
batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node, batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node,
...@@ -798,7 +805,7 @@ batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node, ...@@ -798,7 +805,7 @@ batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node,
* header made up by one tvlv_tt_data object and a series of tvlv_tt_vlan_data * header made up by one tvlv_tt_data object and a series of tvlv_tt_vlan_data
* objects, one per active VLAN. * objects, one per active VLAN.
* *
* Return the size of the allocated buffer or 0 in case of failure. * Return: the size of the allocated buffer or 0 in case of failure.
*/ */
static u16 static u16
batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv, batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv,
...@@ -1040,7 +1047,7 @@ batadv_tt_local_set_pending(struct batadv_priv *bat_priv, ...@@ -1040,7 +1047,7 @@ batadv_tt_local_set_pending(struct batadv_priv *bat_priv,
* @message: message to append to the log on deletion * @message: message to append to the log on deletion
* @roaming: true if the deletion is due to a roaming event * @roaming: true if the deletion is due to a roaming event
* *
* Returns the flags assigned to the local entry before being deleted * Return: the flags assigned to the local entry before being deleted
*/ */
u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr, u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr,
unsigned short vid, const char *message, unsigned short vid, const char *message,
...@@ -1240,10 +1247,16 @@ static void batadv_tt_changes_list_free(struct batadv_priv *bat_priv) ...@@ -1240,10 +1247,16 @@ static void batadv_tt_changes_list_free(struct batadv_priv *bat_priv)
spin_unlock_bh(&bat_priv->tt.changes_list_lock); spin_unlock_bh(&bat_priv->tt.changes_list_lock);
} }
/* retrieves the orig_tt_list_entry belonging to orig_node from the /**
* batadv_tt_global_orig_entry_find - find a TT orig_list_entry
* @entry: the TT global entry where the orig_list_entry has to be
* extracted from
* @orig_node: the originator for which the orig_list_entry has to be found
*
* retrieve the orig_tt_list_entry belonging to orig_node from the
* batadv_tt_global_entry list * batadv_tt_global_entry list
* *
* returns it with an increased refcounter, NULL if not found * Return: it with an increased refcounter, NULL if not found
*/ */
static struct batadv_tt_orig_list_entry * static struct batadv_tt_orig_list_entry *
batadv_tt_global_orig_entry_find(const struct batadv_tt_global_entry *entry, batadv_tt_global_orig_entry_find(const struct batadv_tt_global_entry *entry,
...@@ -1268,8 +1281,15 @@ batadv_tt_global_orig_entry_find(const struct batadv_tt_global_entry *entry, ...@@ -1268,8 +1281,15 @@ batadv_tt_global_orig_entry_find(const struct batadv_tt_global_entry *entry,
return orig_entry; return orig_entry;
} }
/* find out if an orig_node is already in the list of a tt_global_entry. /**
* returns true if found, false otherwise * batadv_tt_global_entry_has_orig - check if a TT global entry is also handled
* by a given originator
* @entry: the TT global entry to check
* @orig_node: the originator to search in the list
*
* find out if an orig_node is already in the list of a tt_global_entry.
*
* Return: true if found, false otherwise
*/ */
static bool static bool
batadv_tt_global_entry_has_orig(const struct batadv_tt_global_entry *entry, batadv_tt_global_entry_has_orig(const struct batadv_tt_global_entry *entry,
...@@ -1341,7 +1361,7 @@ batadv_tt_global_orig_entry_add(struct batadv_tt_global_entry *tt_global, ...@@ -1341,7 +1361,7 @@ batadv_tt_global_orig_entry_add(struct batadv_tt_global_entry *tt_global,
* *
* The caller must hold orig_node refcount. * The caller must hold orig_node refcount.
* *
* Return true if the new entry has been added, false otherwise * Return: true if the new entry has been added, false otherwise
*/ */
static bool batadv_tt_global_add(struct batadv_priv *bat_priv, static bool batadv_tt_global_add(struct batadv_priv *bat_priv,
struct batadv_orig_node *orig_node, struct batadv_orig_node *orig_node,
...@@ -1499,7 +1519,7 @@ static bool batadv_tt_global_add(struct batadv_priv *bat_priv, ...@@ -1499,7 +1519,7 @@ static bool batadv_tt_global_add(struct batadv_priv *bat_priv,
* @tt_global_entry: global translation table entry to be analyzed * @tt_global_entry: global translation table entry to be analyzed
* *
* This functon assumes the caller holds rcu_read_lock(). * This functon assumes the caller holds rcu_read_lock().
* Returns best originator list entry or NULL on errors. * Return: best originator list entry or NULL on errors.
*/ */
static struct batadv_tt_orig_list_entry * static struct batadv_tt_orig_list_entry *
batadv_transtable_best_orig(struct batadv_priv *bat_priv, batadv_transtable_best_orig(struct batadv_priv *bat_priv,
...@@ -2029,7 +2049,7 @@ _batadv_is_ap_isolated(struct batadv_tt_local_entry *tt_local_entry, ...@@ -2029,7 +2049,7 @@ _batadv_is_ap_isolated(struct batadv_tt_local_entry *tt_local_entry,
* @addr: mac address of the destination client * @addr: mac address of the destination client
* @vid: VLAN identifier * @vid: VLAN identifier
* *
* Returns a pointer to the originator that was selected as destination in the * Return: a pointer to the originator that was selected as destination in the
* mesh for contacting the client 'addr', NULL otherwise. * mesh for contacting the client 'addr', NULL otherwise.
* In case of multiple originators serving the same client, the function returns * In case of multiple originators serving the same client, the function returns
* the best one (best in terms of metric towards the destination node). * the best one (best in terms of metric towards the destination node).
...@@ -2104,7 +2124,7 @@ struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv, ...@@ -2104,7 +2124,7 @@ struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv,
* because the XOR operation can combine them all while trying to reduce the * because the XOR operation can combine them all while trying to reduce the
* noise as much as possible. * noise as much as possible.
* *
* Returns the checksum of the global table of a given originator. * Return: the checksum of the global table of a given originator.
*/ */
static u32 batadv_tt_global_crc(struct batadv_priv *bat_priv, static u32 batadv_tt_global_crc(struct batadv_priv *bat_priv,
struct batadv_orig_node *orig_node, struct batadv_orig_node *orig_node,
...@@ -2181,7 +2201,7 @@ static u32 batadv_tt_global_crc(struct batadv_priv *bat_priv, ...@@ -2181,7 +2201,7 @@ static u32 batadv_tt_global_crc(struct batadv_priv *bat_priv,
* For details about the computation, please refer to the documentation for * For details about the computation, please refer to the documentation for
* batadv_tt_global_crc(). * batadv_tt_global_crc().
* *
* Returns the checksum of the local table * Return: the checksum of the local table
*/ */
static u32 batadv_tt_local_crc(struct batadv_priv *bat_priv, static u32 batadv_tt_local_crc(struct batadv_priv *bat_priv,
unsigned short vid) unsigned short vid)
...@@ -2287,7 +2307,7 @@ static void batadv_tt_req_purge(struct batadv_priv *bat_priv) ...@@ -2287,7 +2307,7 @@ static void batadv_tt_req_purge(struct batadv_priv *bat_priv)
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @orig_node: orig node this request is being issued for * @orig_node: orig node this request is being issued for
* *
* Returns the pointer to the new tt_req_node struct if no request * Return: the pointer to the new tt_req_node struct if no request
* has already been issued for this orig_node, NULL otherwise. * has already been issued for this orig_node, NULL otherwise.
*/ */
static struct batadv_tt_req_node * static struct batadv_tt_req_node *
...@@ -2322,7 +2342,7 @@ batadv_tt_req_node_new(struct batadv_priv *bat_priv, ...@@ -2322,7 +2342,7 @@ batadv_tt_req_node_new(struct batadv_priv *bat_priv,
* @entry_ptr: to be checked local tt entry * @entry_ptr: to be checked local tt entry
* @data_ptr: not used but definition required to satisfy the callback prototype * @data_ptr: not used but definition required to satisfy the callback prototype
* *
* Returns 1 if the entry is a valid, 0 otherwise. * Return: 1 if the entry is a valid, 0 otherwise.
*/ */
static int batadv_tt_local_valid(const void *entry_ptr, const void *data_ptr) static int batadv_tt_local_valid(const void *entry_ptr, const void *data_ptr)
{ {
...@@ -2406,9 +2426,8 @@ static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv, ...@@ -2406,9 +2426,8 @@ static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv,
* @orig_node: originator for which the CRCs have to be checked * @orig_node: originator for which the CRCs have to be checked
* @tt_vlan: pointer to the first tvlv VLAN entry * @tt_vlan: pointer to the first tvlv VLAN entry
* @num_vlan: number of tvlv VLAN entries * @num_vlan: number of tvlv VLAN entries
* @create: if true, create VLAN objects if not found
* *
* Return true if all the received CRCs match the locally stored ones, false * Return: true if all the received CRCs match the locally stored ones, false
* otherwise * otherwise
*/ */
static bool batadv_tt_global_check_crc(struct batadv_orig_node *orig_node, static bool batadv_tt_global_check_crc(struct batadv_orig_node *orig_node,
...@@ -2511,6 +2530,8 @@ static void batadv_tt_global_update_crc(struct batadv_priv *bat_priv, ...@@ -2511,6 +2530,8 @@ static void batadv_tt_global_update_crc(struct batadv_priv *bat_priv,
* @num_vlan: number of tvlv VLAN entries * @num_vlan: number of tvlv VLAN entries
* @full_table: ask for the entire translation table if true, while only for the * @full_table: ask for the entire translation table if true, while only for the
* last TT diff otherwise * last TT diff otherwise
*
* Return: true if the TT Request was sent, false otherwise
*/ */
static int batadv_send_tt_request(struct batadv_priv *bat_priv, static int batadv_send_tt_request(struct batadv_priv *bat_priv,
struct batadv_orig_node *dst_orig_node, struct batadv_orig_node *dst_orig_node,
...@@ -2591,7 +2612,7 @@ static int batadv_send_tt_request(struct batadv_priv *bat_priv, ...@@ -2591,7 +2612,7 @@ static int batadv_send_tt_request(struct batadv_priv *bat_priv,
* @req_src: mac address of tt request sender * @req_src: mac address of tt request sender
* @req_dst: mac address of tt request recipient * @req_dst: mac address of tt request recipient
* *
* Returns true if tt request reply was sent, false otherwise. * Return: true if tt request reply was sent, false otherwise.
*/ */
static bool batadv_send_other_tt_response(struct batadv_priv *bat_priv, static bool batadv_send_other_tt_response(struct batadv_priv *bat_priv,
struct batadv_tvlv_tt_data *tt_data, struct batadv_tvlv_tt_data *tt_data,
...@@ -2723,7 +2744,7 @@ static bool batadv_send_other_tt_response(struct batadv_priv *bat_priv, ...@@ -2723,7 +2744,7 @@ static bool batadv_send_other_tt_response(struct batadv_priv *bat_priv,
* @tt_data: tt data containing the tt request information * @tt_data: tt data containing the tt request information
* @req_src: mac address of tt request sender * @req_src: mac address of tt request sender
* *
* Returns true if tt request reply was sent, false otherwise. * Return: true if tt request reply was sent, false otherwise.
*/ */
static bool batadv_send_my_tt_response(struct batadv_priv *bat_priv, static bool batadv_send_my_tt_response(struct batadv_priv *bat_priv,
struct batadv_tvlv_tt_data *tt_data, struct batadv_tvlv_tt_data *tt_data,
...@@ -2841,7 +2862,7 @@ static bool batadv_send_my_tt_response(struct batadv_priv *bat_priv, ...@@ -2841,7 +2862,7 @@ static bool batadv_send_my_tt_response(struct batadv_priv *bat_priv,
* @req_src: mac address of tt request sender * @req_src: mac address of tt request sender
* @req_dst: mac address of tt request recipient * @req_dst: mac address of tt request recipient
* *
* Returns true if tt request reply was sent, false otherwise. * Return: true if tt request reply was sent, false otherwise.
*/ */
static bool batadv_send_tt_response(struct batadv_priv *bat_priv, static bool batadv_send_tt_response(struct batadv_priv *bat_priv,
struct batadv_tvlv_tt_data *tt_data, struct batadv_tvlv_tt_data *tt_data,
...@@ -2936,7 +2957,7 @@ static void batadv_tt_update_changes(struct batadv_priv *bat_priv, ...@@ -2936,7 +2957,7 @@ static void batadv_tt_update_changes(struct batadv_priv *bat_priv,
* @addr: the mac address of the client to check * @addr: the mac address of the client to check
* @vid: VLAN identifier * @vid: VLAN identifier
* *
* Returns true if the client is served by this node, false otherwise. * Return: true if the client is served by this node, false otherwise.
*/ */
bool batadv_is_my_client(struct batadv_priv *bat_priv, const u8 *addr, bool batadv_is_my_client(struct batadv_priv *bat_priv, const u8 *addr,
unsigned short vid) unsigned short vid)
...@@ -3053,11 +3074,16 @@ static void batadv_tt_roam_purge(struct batadv_priv *bat_priv) ...@@ -3053,11 +3074,16 @@ static void batadv_tt_roam_purge(struct batadv_priv *bat_priv)
spin_unlock_bh(&bat_priv->tt.roam_list_lock); spin_unlock_bh(&bat_priv->tt.roam_list_lock);
} }
/* This function checks whether the client already reached the /**
* batadv_tt_check_roam_count - check if a client has roamed too frequently
* @bat_priv: the bat priv with all the soft interface information
* @client: mac address of the roaming client
*
* This function checks whether the client already reached the
* maximum number of possible roaming phases. In this case the ROAMING_ADV * maximum number of possible roaming phases. In this case the ROAMING_ADV
* will not be sent. * will not be sent.
* *
* returns true if the ROAMING_ADV can be sent, false otherwise * Return: true if the ROAMING_ADV can be sent, false otherwise
*/ */
static bool batadv_tt_check_roam_count(struct batadv_priv *bat_priv, u8 *client) static bool batadv_tt_check_roam_count(struct batadv_priv *bat_priv, u8 *client)
{ {
...@@ -3369,13 +3395,12 @@ bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst, ...@@ -3369,13 +3395,12 @@ bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst,
* batadv_tt_update_orig - update global translation table with new tt * batadv_tt_update_orig - update global translation table with new tt
* information received via ogms * information received via ogms
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @orig: the orig_node of the ogm * @orig_node: the orig_node of the ogm
* @tt_vlan: pointer to the first tvlv VLAN entry * @tt_buff: pointer to the first tvlv VLAN entry
* @tt_num_vlan: number of tvlv VLAN entries * @tt_num_vlan: number of tvlv VLAN entries
* @tt_change: pointer to the first entry in the TT buffer * @tt_change: pointer to the first entry in the TT buffer
* @tt_num_changes: number of tt changes inside the tt buffer * @tt_num_changes: number of tt changes inside the tt buffer
* @ttvn: translation table version number of this changeset * @ttvn: translation table version number of this changeset
* @tt_crc: crc32 checksum of orig node's translation table
*/ */
static void batadv_tt_update_orig(struct batadv_priv *bat_priv, static void batadv_tt_update_orig(struct batadv_priv *bat_priv,
struct batadv_orig_node *orig_node, struct batadv_orig_node *orig_node,
...@@ -3457,7 +3482,7 @@ static void batadv_tt_update_orig(struct batadv_priv *bat_priv, ...@@ -3457,7 +3482,7 @@ static void batadv_tt_update_orig(struct batadv_priv *bat_priv,
* @addr: the mac address of the client to check * @addr: the mac address of the client to check
* @vid: VLAN identifier * @vid: VLAN identifier
* *
* Returns true if we know that the client has moved from its old originator * Return: true if we know that the client has moved from its old originator
* to another one. This entry is still kept for consistency purposes and will be * to another one. This entry is still kept for consistency purposes and will be
* deleted later by a DEL or because of timeout * deleted later by a DEL or because of timeout
*/ */
...@@ -3483,7 +3508,7 @@ bool batadv_tt_global_client_is_roaming(struct batadv_priv *bat_priv, ...@@ -3483,7 +3508,7 @@ bool batadv_tt_global_client_is_roaming(struct batadv_priv *bat_priv,
* @addr: the mac address of the local client to query * @addr: the mac address of the local client to query
* @vid: VLAN identifier * @vid: VLAN identifier
* *
* Returns true if the local client is known to be roaming (it is not served by * Return: true if the local client is known to be roaming (it is not served by
* this node anymore) or not. If yes, the client is still present in the table * this node anymore) or not. If yes, the client is still present in the table
* to keep the latter consistent with the node TTVN * to keep the latter consistent with the node TTVN
*/ */
...@@ -3612,7 +3637,7 @@ static void batadv_tt_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, ...@@ -3612,7 +3637,7 @@ static void batadv_tt_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
* @tvlv_value: tvlv buffer containing the tt data * @tvlv_value: tvlv buffer containing the tt data
* @tvlv_value_len: tvlv buffer length * @tvlv_value_len: tvlv buffer length
* *
* Returns NET_RX_DROP if the tt tvlv is to be re-routed, NET_RX_SUCCESS * Return: NET_RX_DROP if the tt tvlv is to be re-routed, NET_RX_SUCCESS
* otherwise. * otherwise.
*/ */
static int batadv_tt_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv, static int batadv_tt_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv,
...@@ -3693,7 +3718,7 @@ static int batadv_tt_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv, ...@@ -3693,7 +3718,7 @@ static int batadv_tt_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv,
* @tvlv_value: tvlv buffer containing the tt data * @tvlv_value: tvlv buffer containing the tt data
* @tvlv_value_len: tvlv buffer length * @tvlv_value_len: tvlv buffer length
* *
* Returns NET_RX_DROP if the tt roam tvlv is to be re-routed, NET_RX_SUCCESS * Return: NET_RX_DROP if the tt roam tvlv is to be re-routed, NET_RX_SUCCESS
* otherwise. * otherwise.
*/ */
static int batadv_roam_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv, static int batadv_roam_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv,
...@@ -3739,7 +3764,7 @@ static int batadv_roam_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv, ...@@ -3739,7 +3764,7 @@ static int batadv_roam_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv,
* batadv_tt_init - initialise the translation table internals * batadv_tt_init - initialise the translation table internals
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* *
* Return 0 on success or negative error number in case of failure. * Return: 0 on success or negative error number in case of failure.
*/ */
int batadv_tt_init(struct batadv_priv *bat_priv) int batadv_tt_init(struct batadv_priv *bat_priv)
{ {
...@@ -3777,7 +3802,7 @@ int batadv_tt_init(struct batadv_priv *bat_priv) ...@@ -3777,7 +3802,7 @@ int batadv_tt_init(struct batadv_priv *bat_priv)
* @addr: the mac address of the client * @addr: the mac address of the client
* @vid: the identifier of the VLAN where this client is connected * @vid: the identifier of the VLAN where this client is connected
* *
* Returns true if the client is marked with the TT_CLIENT_ISOLA flag, false * Return: true if the client is marked with the TT_CLIENT_ISOLA flag, false
* otherwise * otherwise
*/ */
bool batadv_tt_global_is_isolated(struct batadv_priv *bat_priv, bool batadv_tt_global_is_isolated(struct batadv_priv *bat_priv,
......
/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich, Antonio Quartulli * Marek Lindner, Simon Wunderlich, Antonio Quartulli
* *
......
/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: /* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
* *
...@@ -73,7 +73,7 @@ enum batadv_dhcp_recipient { ...@@ -73,7 +73,7 @@ enum batadv_dhcp_recipient {
#define BATADV_TT_SYNC_MASK 0x00F0 #define BATADV_TT_SYNC_MASK 0x00F0
/** /**
* struct batadv_hard_iface_bat_iv - per hard interface B.A.T.M.A.N. IV data * struct batadv_hard_iface_bat_iv - per hard-interface B.A.T.M.A.N. IV data
* @ogm_buff: buffer holding the OGM packet * @ogm_buff: buffer holding the OGM packet
* @ogm_buff_len: length of the OGM packet buffer * @ogm_buff_len: length of the OGM packet buffer
* @ogm_seqno: OGM sequence number - used to identify each OGM * @ogm_seqno: OGM sequence number - used to identify each OGM
...@@ -97,8 +97,8 @@ struct batadv_hard_iface_bat_iv { ...@@ -97,8 +97,8 @@ struct batadv_hard_iface_bat_iv {
* batman-adv for this interface * batman-adv for this interface
* @soft_iface: the batman-adv interface which uses this network interface * @soft_iface: the batman-adv interface which uses this network interface
* @rcu: struct used for freeing in an RCU-safe manner * @rcu: struct used for freeing in an RCU-safe manner
* @bat_iv: BATMAN IV specific per hard interface data * @bat_iv: per hard-interface B.A.T.M.A.N. IV data
* @cleanup_work: work queue callback item for hard interface deinit * @cleanup_work: work queue callback item for hard-interface deinit
* @debug_dir: dentry for nc subdir in batman-adv directory in debugfs * @debug_dir: dentry for nc subdir in batman-adv directory in debugfs
* @neigh_list: list of unique single hop neighbors via this interface * @neigh_list: list of unique single hop neighbors via this interface
* @neigh_list_lock: lock protecting neigh_list * @neigh_list_lock: lock protecting neigh_list
...@@ -125,7 +125,7 @@ struct batadv_hard_iface { ...@@ -125,7 +125,7 @@ struct batadv_hard_iface {
/** /**
* struct batadv_orig_ifinfo - originator info per outgoing interface * struct batadv_orig_ifinfo - originator info per outgoing interface
* @list: list node for orig_node::ifinfo_list * @list: list node for orig_node::ifinfo_list
* @if_outgoing: pointer to outgoing hard interface * @if_outgoing: pointer to outgoing hard-interface
* @router: router that should be used to reach this originator * @router: router that should be used to reach this originator
* @last_real_seqno: last and best known sequence number * @last_real_seqno: last and best known sequence number
* @last_ttl: ttl of last received packet * @last_ttl: ttl of last received packet
...@@ -202,7 +202,7 @@ struct batadv_orig_node_vlan { ...@@ -202,7 +202,7 @@ struct batadv_orig_node_vlan {
/** /**
* struct batadv_orig_bat_iv - B.A.T.M.A.N. IV private orig_node members * struct batadv_orig_bat_iv - B.A.T.M.A.N. IV private orig_node members
* @bcast_own: set of bitfields (one per hard interface) where each one counts * @bcast_own: set of bitfields (one per hard-interface) where each one counts
* the number of our OGMs this orig_node rebroadcasted "back" to us (relative * the number of our OGMs this orig_node rebroadcasted "back" to us (relative
* to last_real_seqno). Every bitfield is BATADV_TQ_LOCAL_WINDOW_SIZE bits long. * to last_real_seqno). Every bitfield is BATADV_TQ_LOCAL_WINDOW_SIZE bits long.
* @bcast_own_sum: sum of bcast_own * @bcast_own_sum: sum of bcast_own
...@@ -346,10 +346,11 @@ struct batadv_gw_node { ...@@ -346,10 +346,11 @@ struct batadv_gw_node {
}; };
/** /**
* batadv_hardif_neigh_node - unique neighbor per hard interface * struct batadv_hardif_neigh_node - unique neighbor per hard-interface
* @list: list node for batadv_hard_iface::neigh_list * @list: list node for batadv_hard_iface::neigh_list
* @addr: the MAC address of the neighboring interface * @addr: the MAC address of the neighboring interface
* @if_incoming: pointer to incoming hard interface * @if_incoming: pointer to incoming hard-interface
* @last_seen: when last packet via this neighbor was received
* @refcount: number of contexts the object is used * @refcount: number of contexts the object is used
* @rcu: struct used for freeing in a RCU-safe manner * @rcu: struct used for freeing in a RCU-safe manner
*/ */
...@@ -369,7 +370,7 @@ struct batadv_hardif_neigh_node { ...@@ -369,7 +370,7 @@ struct batadv_hardif_neigh_node {
* @addr: the MAC address of the neighboring interface * @addr: the MAC address of the neighboring interface
* @ifinfo_list: list for routing metrics per outgoing interface * @ifinfo_list: list for routing metrics per outgoing interface
* @ifinfo_lock: lock protecting private ifinfo members and list * @ifinfo_lock: lock protecting private ifinfo members and list
* @if_incoming: pointer to incoming hard interface * @if_incoming: pointer to incoming hard-interface
* @last_seen: when last packet via this neighbor was received * @last_seen: when last packet via this neighbor was received
* @refcount: number of contexts the object is used * @refcount: number of contexts the object is used
* @rcu: struct used for freeing in an RCU-safe manner * @rcu: struct used for freeing in an RCU-safe manner
...@@ -388,7 +389,7 @@ struct batadv_neigh_node { ...@@ -388,7 +389,7 @@ struct batadv_neigh_node {
/** /**
* struct batadv_neigh_ifinfo_bat_iv - neighbor information per outgoing * struct batadv_neigh_ifinfo_bat_iv - neighbor information per outgoing
* interface for BATMAN IV * interface for B.A.T.M.A.N. IV
* @tq_recv: ring buffer of received TQ values from this neigh node * @tq_recv: ring buffer of received TQ values from this neigh node
* @tq_index: ring buffer index * @tq_index: ring buffer index
* @tq_avg: averaged tq of all tq values in the ring buffer (tq_recv) * @tq_avg: averaged tq of all tq values in the ring buffer (tq_recv)
...@@ -407,7 +408,7 @@ struct batadv_neigh_ifinfo_bat_iv { ...@@ -407,7 +408,7 @@ struct batadv_neigh_ifinfo_bat_iv {
/** /**
* struct batadv_neigh_ifinfo - neighbor information per outgoing interface * struct batadv_neigh_ifinfo - neighbor information per outgoing interface
* @list: list node for batadv_neigh_node::ifinfo_list * @list: list node for batadv_neigh_node::ifinfo_list
* @if_outgoing: pointer to outgoing hard interface * @if_outgoing: pointer to outgoing hard-interface
* @bat_iv: B.A.T.M.A.N. IV private structure * @bat_iv: B.A.T.M.A.N. IV private structure
* @last_ttl: last received ttl from this neigh node * @last_ttl: last received ttl from this neigh node
* @refcount: number of contexts the object is used * @refcount: number of contexts the object is used
...@@ -771,6 +772,9 @@ struct batadv_softif_vlan { ...@@ -771,6 +772,9 @@ struct batadv_softif_vlan {
* @orig_interval: OGM broadcast interval in milliseconds * @orig_interval: OGM broadcast interval in milliseconds
* @hop_penalty: penalty which will be applied to an OGM's tq-field on every hop * @hop_penalty: penalty which will be applied to an OGM's tq-field on every hop
* @log_level: configured log level (see batadv_dbg_level) * @log_level: configured log level (see batadv_dbg_level)
* @isolation_mark: the skb->mark value used to match packets for AP isolation
* @isolation_mark_mask: bitmask identifying the bits in skb->mark to be used
* for the isolation mark
* @bcast_seqno: last sent broadcast packet sequence number * @bcast_seqno: last sent broadcast packet sequence number
* @bcast_queue_left: number of remaining buffered broadcast packet slots * @bcast_queue_left: number of remaining buffered broadcast packet slots
* @batman_queue_left: number of remaining OGM packet slots * @batman_queue_left: number of remaining OGM packet slots
...@@ -783,8 +787,8 @@ struct batadv_softif_vlan { ...@@ -783,8 +787,8 @@ struct batadv_softif_vlan {
* @forw_bat_list_lock: lock protecting forw_bat_list * @forw_bat_list_lock: lock protecting forw_bat_list
* @forw_bcast_list_lock: lock protecting forw_bcast_list * @forw_bcast_list_lock: lock protecting forw_bcast_list
* @orig_work: work queue callback item for orig node purging * @orig_work: work queue callback item for orig node purging
* @cleanup_work: work queue callback item for soft interface deinit * @cleanup_work: work queue callback item for soft-interface deinit
* @primary_if: one of the hard interfaces assigned to this mesh interface * @primary_if: one of the hard-interfaces assigned to this mesh interface
* becomes the primary interface * becomes the primary interface
* @bat_algo_ops: routing algorithm used by this mesh interface * @bat_algo_ops: routing algorithm used by this mesh interface
* @softif_vlan_list: a list of softif_vlan structs, one per VLAN created on top * @softif_vlan_list: a list of softif_vlan structs, one per VLAN created on top
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment