aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMarek Lindner <lindner_marek@yahoo.de>2013-03-10 07:29:15 -0400
committerAntonio Quartulli <ordex@autistici.org>2013-05-28 20:44:53 -0400
commit93178018eb35aaa6ebcb5a136dce7eb3add011ab (patch)
tree34ff8000ab2960ea39841493b2f439ac41cf420c /net
parentcaf65bfcc5dbabd7222fa45fdcd42ce0783d7a42 (diff)
batman-adv: fix typos in kernel doc & comments
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net')
-rw-r--r--net/batman-adv/distributed-arp-table.c82
1 files changed, 39 insertions, 43 deletions
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
index 239992021b1d..06345d401588 100644
--- a/net/batman-adv/distributed-arp-table.c
+++ b/net/batman-adv/distributed-arp-table.c
@@ -45,9 +45,9 @@ static void batadv_dat_start_timer(struct batadv_priv *bat_priv)
45} 45}
46 46
47/** 47/**
48 * batadv_dat_entry_free_ref - decrements the dat_entry refcounter and possibly 48 * batadv_dat_entry_free_ref - decrement the dat_entry refcounter and possibly
49 * free it 49 * free it
50 * @dat_entry: the oentry to free 50 * @dat_entry: the entry to free
51 */ 51 */
52static void batadv_dat_entry_free_ref(struct batadv_dat_entry *dat_entry) 52static void batadv_dat_entry_free_ref(struct batadv_dat_entry *dat_entry)
53{ 53{
@@ -56,10 +56,10 @@ static void batadv_dat_entry_free_ref(struct batadv_dat_entry *dat_entry)
56} 56}
57 57
58/** 58/**
59 * batadv_dat_to_purge - checks whether a dat_entry has to be purged or not 59 * batadv_dat_to_purge - check whether a dat_entry has to be purged or not
60 * @dat_entry: the entry to check 60 * @dat_entry: the entry to check
61 * 61 *
62 * Returns true if the entry has to be purged now, false otherwise 62 * Returns true if the entry has to be purged now, false otherwise.
63 */ 63 */
64static bool batadv_dat_to_purge(struct batadv_dat_entry *dat_entry) 64static bool batadv_dat_to_purge(struct batadv_dat_entry *dat_entry)
65{ 65{
@@ -75,8 +75,8 @@ static bool batadv_dat_to_purge(struct batadv_dat_entry *dat_entry)
75 * returns a boolean value: true is the entry has to be deleted, 75 * returns a boolean value: true is the entry has to be deleted,
76 * false otherwise 76 * false otherwise
77 * 77 *
78 * Loops over each entry in the DAT local storage and delete it if and only if 78 * Loops over each entry in the DAT local storage and deletes it if and only if
79 * the to_purge function passed as argument returns true 79 * the to_purge function passed as argument returns true.
80 */ 80 */
81static void __batadv_dat_purge(struct batadv_priv *bat_priv, 81static void __batadv_dat_purge(struct batadv_priv *bat_priv,
82 bool (*to_purge)(struct batadv_dat_entry *)) 82 bool (*to_purge)(struct batadv_dat_entry *))
@@ -97,7 +97,7 @@ static void __batadv_dat_purge(struct batadv_priv *bat_priv,
97 spin_lock_bh(list_lock); 97 spin_lock_bh(list_lock);
98 hlist_for_each_entry_safe(dat_entry, node_tmp, head, 98 hlist_for_each_entry_safe(dat_entry, node_tmp, head,
99 hash_entry) { 99 hash_entry) {
100 /* if an helper function has been passed as parameter, 100 /* if a helper function has been passed as parameter,
101 * ask it if the entry has to be purged or not 101 * ask it if the entry has to be purged or not
102 */ 102 */
103 if (to_purge && !to_purge(dat_entry)) 103 if (to_purge && !to_purge(dat_entry))
@@ -134,7 +134,7 @@ static void batadv_dat_purge(struct work_struct *work)
134 * @node: node in the local table 134 * @node: node in the local table
135 * @data2: second object to compare the node to 135 * @data2: second object to compare the node to
136 * 136 *
137 * Returns 1 if the two entry are the same, 0 otherwise 137 * Returns 1 if the two entries are the same, 0 otherwise.
138 */ 138 */
139static int batadv_compare_dat(const struct hlist_node *node, const void *data2) 139static int batadv_compare_dat(const struct hlist_node *node, const void *data2)
140{ 140{
@@ -149,7 +149,7 @@ static int batadv_compare_dat(const struct hlist_node *node, const void *data2)
149 * @skb: ARP packet 149 * @skb: ARP packet
150 * @hdr_size: size of the possible header before the ARP packet 150 * @hdr_size: size of the possible header before the ARP packet
151 * 151 *
152 * Returns the value of the hw_src field in the ARP packet 152 * Returns the value of the hw_src field in the ARP packet.
153 */ 153 */
154static uint8_t *batadv_arp_hw_src(struct sk_buff *skb, int hdr_size) 154static uint8_t *batadv_arp_hw_src(struct sk_buff *skb, int hdr_size)
155{ 155{
@@ -166,7 +166,7 @@ static uint8_t *batadv_arp_hw_src(struct sk_buff *skb, int hdr_size)
166 * @skb: ARP packet 166 * @skb: ARP packet
167 * @hdr_size: size of the possible header before the ARP packet 167 * @hdr_size: size of the possible header before the ARP packet
168 * 168 *
169 * Returns the value of the ip_src field in the ARP packet 169 * Returns the value of the ip_src field in the ARP packet.
170 */ 170 */
171static __be32 batadv_arp_ip_src(struct sk_buff *skb, int hdr_size) 171static __be32 batadv_arp_ip_src(struct sk_buff *skb, int hdr_size)
172{ 172{
@@ -178,7 +178,7 @@ static __be32 batadv_arp_ip_src(struct sk_buff *skb, int hdr_size)
178 * @skb: ARP packet 178 * @skb: ARP packet
179 * @hdr_size: size of the possible header before the ARP packet 179 * @hdr_size: size of the possible header before the ARP packet
180 * 180 *
181 * Returns the value of the hw_dst field in the ARP packet 181 * Returns the value of the hw_dst field in the ARP packet.
182 */ 182 */
183static uint8_t *batadv_arp_hw_dst(struct sk_buff *skb, int hdr_size) 183static uint8_t *batadv_arp_hw_dst(struct sk_buff *skb, int hdr_size)
184{ 184{
@@ -190,7 +190,7 @@ static uint8_t *batadv_arp_hw_dst(struct sk_buff *skb, int hdr_size)
190 * @skb: ARP packet 190 * @skb: ARP packet
191 * @hdr_size: size of the possible header before the ARP packet 191 * @hdr_size: size of the possible header before the ARP packet
192 * 192 *
193 * Returns the value of the ip_dst field in the ARP packet 193 * Returns the value of the ip_dst field in the ARP packet.
194 */ 194 */
195static __be32 batadv_arp_ip_dst(struct sk_buff *skb, int hdr_size) 195static __be32 batadv_arp_ip_dst(struct sk_buff *skb, int hdr_size)
196{ 196{
@@ -202,7 +202,7 @@ static __be32 batadv_arp_ip_dst(struct sk_buff *skb, int hdr_size)
202 * @data: data to hash 202 * @data: data to hash
203 * @size: size of the hash table 203 * @size: size of the hash table
204 * 204 *
205 * Returns the selected index in the hash table for the given data 205 * Returns the selected index in the hash table for the given data.
206 */ 206 */
207static uint32_t batadv_hash_dat(const void *data, uint32_t size) 207static uint32_t batadv_hash_dat(const void *data, uint32_t size)
208{ 208{
@@ -224,12 +224,12 @@ static uint32_t batadv_hash_dat(const void *data, uint32_t size)
224} 224}
225 225
226/** 226/**
227 * batadv_dat_entry_hash_find - looks for a given dat_entry in the local hash 227 * batadv_dat_entry_hash_find - look for a given dat_entry in the local hash
228 * table 228 * table
229 * @bat_priv: the bat priv with all the soft interface information 229 * @bat_priv: the bat priv with all the soft interface information
230 * @ip: search key 230 * @ip: search key
231 * 231 *
232 * Returns the dat_entry if found, NULL otherwise 232 * Returns the dat_entry if found, NULL otherwise.
233 */ 233 */
234static struct batadv_dat_entry * 234static struct batadv_dat_entry *
235batadv_dat_entry_hash_find(struct batadv_priv *bat_priv, __be32 ip) 235batadv_dat_entry_hash_find(struct batadv_priv *bat_priv, __be32 ip)
@@ -343,9 +343,6 @@ static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb,
343 if (hdr_size == 0) 343 if (hdr_size == 0)
344 return; 344 return;
345 345
346 /* if the ARP packet is encapsulated in a batman packet, let's print
347 * some debug messages
348 */
349 unicast_4addr_packet = (struct batadv_unicast_4addr_packet *)skb->data; 346 unicast_4addr_packet = (struct batadv_unicast_4addr_packet *)skb->data;
350 347
351 switch (unicast_4addr_packet->u.header.packet_type) { 348 switch (unicast_4addr_packet->u.header.packet_type) {
@@ -409,7 +406,8 @@ static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb,
409 * @candidate: orig_node under evaluation 406 * @candidate: orig_node under evaluation
410 * @max_orig_node: last selected candidate 407 * @max_orig_node: last selected candidate
411 * 408 *
412 * Returns true if the node has been elected as next candidate or false othrwise 409 * Returns true if the node has been elected as next candidate or false
410 * otherwise.
413 */ 411 */
414static bool batadv_is_orig_node_eligible(struct batadv_dat_candidate *res, 412static bool batadv_is_orig_node_eligible(struct batadv_dat_candidate *res,
415 int select, batadv_dat_addr_t tmp_max, 413 int select, batadv_dat_addr_t tmp_max,
@@ -472,7 +470,7 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv,
472 */ 470 */
473 cands[select].type = BATADV_DAT_CANDIDATE_NOT_FOUND; 471 cands[select].type = BATADV_DAT_CANDIDATE_NOT_FOUND;
474 472
475 /* iterate over the originator list and find the node with closest 473 /* iterate over the originator list and find the node with the closest
476 * dat_address which has not been selected yet 474 * dat_address which has not been selected yet
477 */ 475 */
478 for (i = 0; i < hash->size; i++) { 476 for (i = 0; i < hash->size; i++) {
@@ -480,7 +478,7 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv,
480 478
481 rcu_read_lock(); 479 rcu_read_lock();
482 hlist_for_each_entry_rcu(orig_node, head, hash_entry) { 480 hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
483 /* the dht space is a ring and addresses are unsigned */ 481 /* the dht space is a ring using unsigned addresses */
484 tmp_max = BATADV_DAT_ADDR_MAX - orig_node->dat_addr + 482 tmp_max = BATADV_DAT_ADDR_MAX - orig_node->dat_addr +
485 ip_key; 483 ip_key;
486 484
@@ -512,7 +510,7 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv,
512} 510}
513 511
514/** 512/**
515 * batadv_dat_select_candidates - selects the nodes which the DHT message has to 513 * batadv_dat_select_candidates - select the nodes which the DHT message has to
516 * be sent to 514 * be sent to
517 * @bat_priv: the bat priv with all the soft interface information 515 * @bat_priv: the bat priv with all the soft interface information
518 * @ip_dst: ipv4 to look up in the DHT 516 * @ip_dst: ipv4 to look up in the DHT
@@ -521,7 +519,7 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv,
521 * closest values (from the LEFT, with wrap around if needed) then the hash 519 * closest values (from the LEFT, with wrap around if needed) then the hash
522 * value of the key. ip_dst is the key. 520 * value of the key. ip_dst is the key.
523 * 521 *
524 * Returns the candidate array of size BATADV_DAT_CANDIDATE_NUM 522 * Returns the candidate array of size BATADV_DAT_CANDIDATE_NUM.
525 */ 523 */
526static struct batadv_dat_candidate * 524static struct batadv_dat_candidate *
527batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) 525batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst)
@@ -558,10 +556,11 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst)
558 * @ip: the DHT key 556 * @ip: the DHT key
559 * @packet_subtype: unicast4addr packet subtype to use 557 * @packet_subtype: unicast4addr packet subtype to use
560 * 558 *
561 * In this function the skb is copied by means of pskb_copy() and is sent as 559 * This function copies the skb with pskb_copy() and is sent as unicast packet
562 * unicast packet to each of the selected candidates 560 * to each of the selected candidates.
563 * 561 *
564 * Returns true if the packet is sent to at least one candidate, false otherwise 562 * Returns true if the packet is sent to at least one candidate, false
563 * otherwise.
565 */ 564 */
566static bool batadv_dat_send_data(struct batadv_priv *bat_priv, 565static bool batadv_dat_send_data(struct batadv_priv *bat_priv,
567 struct sk_buff *skb, __be32 ip, 566 struct sk_buff *skb, __be32 ip,
@@ -727,7 +726,7 @@ out:
727 * @skb: packet to analyse 726 * @skb: packet to analyse
728 * @hdr_size: size of the possible header before the ARP packet in the skb 727 * @hdr_size: size of the possible header before the ARP packet in the skb
729 * 728 *
730 * Returns the ARP type if the skb contains a valid ARP packet, 0 otherwise 729 * Returns the ARP type if the skb contains a valid ARP packet, 0 otherwise.
731 */ 730 */
732static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv, 731static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv,
733 struct sk_buff *skb, int hdr_size) 732 struct sk_buff *skb, int hdr_size)
@@ -754,9 +753,7 @@ static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv,
754 753
755 arphdr = (struct arphdr *)(skb->data + hdr_size + ETH_HLEN); 754 arphdr = (struct arphdr *)(skb->data + hdr_size + ETH_HLEN);
756 755
757 /* Check whether the ARP packet carries a valid 756 /* check whether the ARP packet carries a valid IP information */
758 * IP information
759 */
760 if (arphdr->ar_hrd != htons(ARPHRD_ETHER)) 757 if (arphdr->ar_hrd != htons(ARPHRD_ETHER))
761 goto out; 758 goto out;
762 759
@@ -784,7 +781,7 @@ static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv,
784 if (is_zero_ether_addr(hw_src) || is_multicast_ether_addr(hw_src)) 781 if (is_zero_ether_addr(hw_src) || is_multicast_ether_addr(hw_src))
785 goto out; 782 goto out;
786 783
787 /* we don't care about the destination MAC address in ARP requests */ 784 /* don't care about the destination MAC address in ARP requests */
788 if (arphdr->ar_op != htons(ARPOP_REQUEST)) { 785 if (arphdr->ar_op != htons(ARPOP_REQUEST)) {
789 hw_dst = batadv_arp_hw_dst(skb, hdr_size); 786 hw_dst = batadv_arp_hw_dst(skb, hdr_size);
790 if (is_zero_ether_addr(hw_dst) || 787 if (is_zero_ether_addr(hw_dst) ||
@@ -804,8 +801,8 @@ out:
804 * @skb: packet to check 801 * @skb: packet to check
805 * 802 *
806 * Returns true if the message has been sent to the dht candidates, false 803 * Returns true if the message has been sent to the dht candidates, false
807 * otherwise. In case of true the message has to be enqueued to permit the 804 * otherwise. In case of a positive return value the message has to be enqueued
808 * fallback 805 * to permit the fallback.
809 */ 806 */
810bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv, 807bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
811 struct sk_buff *skb) 808 struct sk_buff *skb)
@@ -867,7 +864,7 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
867 batadv_dbg(BATADV_DBG_DAT, bat_priv, "ARP request replied locally\n"); 864 batadv_dbg(BATADV_DBG_DAT, bat_priv, "ARP request replied locally\n");
868 ret = true; 865 ret = true;
869 } else { 866 } else {
870 /* Send the request on the DHT */ 867 /* Send the request to the DHT */
871 ret = batadv_dat_send_data(bat_priv, skb, ip_dst, 868 ret = batadv_dat_send_data(bat_priv, skb, ip_dst,
872 BATADV_P_DAT_DHT_GET); 869 BATADV_P_DAT_DHT_GET);
873 } 870 }
@@ -884,7 +881,7 @@ out:
884 * @skb: packet to check 881 * @skb: packet to check
885 * @hdr_size: size of the encapsulation header 882 * @hdr_size: size of the encapsulation header
886 * 883 *
887 * Returns true if the request has been answered, false otherwise 884 * Returns true if the request has been answered, false otherwise.
888 */ 885 */
889bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv, 886bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv,
890 struct sk_buff *skb, int hdr_size) 887 struct sk_buff *skb, int hdr_size)
@@ -924,10 +921,9 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv,
924 if (!skb_new) 921 if (!skb_new)
925 goto out; 922 goto out;
926 923
927 /* to preserve backwards compatibility, here the node has to answer 924 /* To preserve backwards compatibility, the node has choose the outgoing
928 * using the same packet type it received for the request. This is due 925 * format based on the incoming request packet type. The assumption is
929 * to that if a node is not using the 4addr packet format it may not 926 * that a node not using the 4addr packet format doesn't support it.
930 * support it.
931 */ 927 */
932 if (hdr_size == sizeof(struct batadv_unicast_4addr_packet)) 928 if (hdr_size == sizeof(struct batadv_unicast_4addr_packet))
933 err = batadv_unicast_4addr_send_skb(bat_priv, skb_new, 929 err = batadv_unicast_4addr_send_skb(bat_priv, skb_new,
@@ -977,7 +973,7 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv,
977 batadv_dat_entry_add(bat_priv, ip_dst, hw_dst); 973 batadv_dat_entry_add(bat_priv, ip_dst, hw_dst);
978 974
979 /* Send the ARP reply to the candidates for both the IP addresses that 975 /* Send the ARP reply to the candidates for both the IP addresses that
980 * the node got within the ARP reply 976 * the node obtained from the ARP reply
981 */ 977 */
982 batadv_dat_send_data(bat_priv, skb, ip_src, BATADV_P_DAT_DHT_PUT); 978 batadv_dat_send_data(bat_priv, skb, ip_src, BATADV_P_DAT_DHT_PUT);
983 batadv_dat_send_data(bat_priv, skb, ip_dst, BATADV_P_DAT_DHT_PUT); 979 batadv_dat_send_data(bat_priv, skb, ip_dst, BATADV_P_DAT_DHT_PUT);
@@ -987,7 +983,7 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv,
987 * DAT storage only 983 * DAT storage only
988 * @bat_priv: the bat priv with all the soft interface information 984 * @bat_priv: the bat priv with all the soft interface information
989 * @skb: packet to check 985 * @skb: packet to check
990 * @hdr_size: siaze of the encapsulation header 986 * @hdr_size: size of the encapsulation header
991 */ 987 */
992bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, 988bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,
993 struct sk_buff *skb, int hdr_size) 989 struct sk_buff *skb, int hdr_size)
@@ -1031,11 +1027,11 @@ out:
1031 1027
1032/** 1028/**
1033 * batadv_dat_drop_broadcast_packet - check if an ARP request has to be dropped 1029 * batadv_dat_drop_broadcast_packet - check if an ARP request has to be dropped
1034 * (because the node has already got the reply via DAT) or not 1030 * (because the node has already obtained the reply via DAT) or not
1035 * @bat_priv: the bat priv with all the soft interface information 1031 * @bat_priv: the bat priv with all the soft interface information
1036 * @forw_packet: the broadcast packet 1032 * @forw_packet: the broadcast packet
1037 * 1033 *
1038 * Returns true if the node can drop the packet, false otherwise 1034 * Returns true if the node can drop the packet, false otherwise.
1039 */ 1035 */
1040bool batadv_dat_drop_broadcast_packet(struct batadv_priv *bat_priv, 1036bool batadv_dat_drop_broadcast_packet(struct batadv_priv *bat_priv,
1041 struct batadv_forw_packet *forw_packet) 1037 struct batadv_forw_packet *forw_packet)