aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/gateway_client.c
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-05-11 20:09:43 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-06-20 16:15:33 -0400
commit9cfc7bd608b97463993b4f3e4775d99022253f8d (patch)
treefcfcf1e714a91943a740dcaa2744ee66448f9f73 /net/batman-adv/gateway_client.c
parent3193e8fdfa355289892661d206d1954114a7be95 (diff)
batman-adv: Reformat multiline comments to consistent style
batman-adv doesn't follow the style for multiline comments that David S. Miller prefers. All comments should be reformatted to follow this consistent style to make the code slightly more readable. Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/gateway_client.c')
-rw-r--r--net/batman-adv/gateway_client.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index e396029e578b..0d90fffd9efb 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -1,5 +1,4 @@
1/* 1/* Copyright (C) 2009-2012 B.A.T.M.A.N. contributors:
2 * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors:
3 * 2 *
4 * Marek Lindner 3 * Marek Lindner
5 * 4 *
@@ -16,7 +15,6 @@
16 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA 17 * 02110-1301, USA
19 *
20 */ 18 */
21 19
22#include "main.h" 20#include "main.h"
@@ -33,7 +31,8 @@
33#include <linux/if_vlan.h> 31#include <linux/if_vlan.h>
34 32
35/* This is the offset of the options field in a dhcp packet starting at 33/* This is the offset of the options field in a dhcp packet starting at
36 * the beginning of the dhcp header */ 34 * the beginning of the dhcp header
35 */
37#define DHCP_OPTIONS_OFFSET 240 36#define DHCP_OPTIONS_OFFSET 240
38#define DHCP_REQUEST 3 37#define DHCP_REQUEST 3
39 38
@@ -151,14 +150,13 @@ static struct gw_node *gw_get_best_gw_node(struct bat_priv *bat_priv)
151 } 150 }
152 break; 151 break;
153 152
154 default: /** 153 default: /* 2: stable connection (use best statistic)
155 * 2: stable connection (use best statistic)
156 * 3: fast-switch (use best statistic but change as 154 * 3: fast-switch (use best statistic but change as
157 * soon as a better gateway appears) 155 * soon as a better gateway appears)
158 * XX: late-switch (use best statistic but change as 156 * XX: late-switch (use best statistic but change as
159 * soon as a better gateway appears which has 157 * soon as a better gateway appears which has
160 * $routing_class more tq points) 158 * $routing_class more tq points)
161 **/ 159 */
162 if (router->tq_avg > max_tq) { 160 if (router->tq_avg > max_tq) {
163 if (curr_gw) 161 if (curr_gw)
164 gw_node_free_ref(curr_gw); 162 gw_node_free_ref(curr_gw);
@@ -190,12 +188,11 @@ void batadv_gw_election(struct bat_priv *bat_priv)
190 struct neigh_node *router = NULL; 188 struct neigh_node *router = NULL;
191 char gw_addr[18] = { '\0' }; 189 char gw_addr[18] = { '\0' };
192 190
193 /** 191 /* The batman daemon checks here if we already passed a full originator
194 * The batman daemon checks here if we already passed a full originator
195 * cycle in order to make sure we don't choose the first gateway we 192 * cycle in order to make sure we don't choose the first gateway we
196 * hear about. This check is based on the daemon's uptime which we 193 * hear about. This check is based on the daemon's uptime which we
197 * don't have. 194 * don't have.
198 **/ 195 */
199 if (atomic_read(&bat_priv->gw_mode) != GW_MODE_CLIENT) 196 if (atomic_read(&bat_priv->gw_mode) != GW_MODE_CLIENT)
200 goto out; 197 goto out;
201 198
@@ -278,10 +275,9 @@ void batadv_gw_check_election(struct bat_priv *bat_priv,
278 if (orig_tq_avg < gw_tq_avg) 275 if (orig_tq_avg < gw_tq_avg)
279 goto out; 276 goto out;
280 277
281 /** 278 /* if the routing class is greater than 3 the value tells us how much
282 * if the routing class is greater than 3 the value tells us how much
283 * greater the TQ value of the new gateway must be 279 * greater the TQ value of the new gateway must be
284 **/ 280 */
285 if ((atomic_read(&bat_priv->gw_sel_class) > 3) && 281 if ((atomic_read(&bat_priv->gw_sel_class) > 3) &&
286 (orig_tq_avg - gw_tq_avg < atomic_read(&bat_priv->gw_sel_class))) 282 (orig_tq_avg - gw_tq_avg < atomic_read(&bat_priv->gw_sel_class)))
287 goto out; 283 goto out;
@@ -337,8 +333,7 @@ void batadv_gw_node_update(struct bat_priv *bat_priv,
337 struct hlist_node *node; 333 struct hlist_node *node;
338 struct gw_node *gw_node, *curr_gw; 334 struct gw_node *gw_node, *curr_gw;
339 335
340 /** 336 /* Note: We don't need a NULL check here, since curr_gw never gets
341 * Note: We don't need a NULL check here, since curr_gw never gets
342 * dereferenced. If curr_gw is NULL we also should not exit as we may 337 * dereferenced. If curr_gw is NULL we also should not exit as we may
343 * have this gateway in our list (duplication check!) even though we 338 * have this gateway in our list (duplication check!) even though we
344 * have no currently selected gateway. 339 * have no currently selected gateway.
@@ -426,9 +421,7 @@ void batadv_gw_node_purge(struct bat_priv *bat_priv)
426 gw_node_free_ref(curr_gw); 421 gw_node_free_ref(curr_gw);
427} 422}
428 423
429/** 424/* fails if orig_node has no router */
430 * fails if orig_node has no router
431 */
432static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq, 425static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq,
433 const struct gw_node *gw_node) 426 const struct gw_node *gw_node)
434{ 427{
@@ -534,12 +527,14 @@ static bool is_type_dhcprequest(struct sk_buff *skb, int header_len)
534 /* Access the dhcp option lists. Each entry is made up by: 527 /* Access the dhcp option lists. Each entry is made up by:
535 * - octet 1: option type 528 * - octet 1: option type
536 * - octet 2: option data len (only if type != 255 and 0) 529 * - octet 2: option data len (only if type != 255 and 0)
537 * - octet 3: option data */ 530 * - octet 3: option data
531 */
538 while (*p != 255 && !ret) { 532 while (*p != 255 && !ret) {
539 /* p now points to the first octet: option type */ 533 /* p now points to the first octet: option type */
540 if (*p == 53) { 534 if (*p == 53) {
541 /* type 53 is the message type option. 535 /* type 53 is the message type option.
542 * Jump the len octet and go to the data octet */ 536 * Jump the len octet and go to the data octet
537 */
543 if (pkt_len < 2) 538 if (pkt_len < 2)
544 goto out; 539 goto out;
545 p += 2; 540 p += 2;
@@ -667,7 +662,8 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv,
667 switch (atomic_read(&bat_priv->gw_mode)) { 662 switch (atomic_read(&bat_priv->gw_mode)) {
668 case GW_MODE_SERVER: 663 case GW_MODE_SERVER:
669 /* If we are a GW then we are our best GW. We can artificially 664 /* If we are a GW then we are our best GW. We can artificially
670 * set the tq towards ourself as the maximum value */ 665 * set the tq towards ourself as the maximum value
666 */
671 curr_tq_avg = TQ_MAX_VALUE; 667 curr_tq_avg = TQ_MAX_VALUE;
672 break; 668 break;
673 case GW_MODE_CLIENT: 669 case GW_MODE_CLIENT:
@@ -681,7 +677,8 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv,
681 677
682 /* If the dhcp packet has been sent to a different gw, 678 /* If the dhcp packet has been sent to a different gw,
683 * we have to evaluate whether the old gw is still 679 * we have to evaluate whether the old gw is still
684 * reliable enough */ 680 * reliable enough
681 */
685 neigh_curr = batadv_find_router(bat_priv, curr_gw->orig_node, 682 neigh_curr = batadv_find_router(bat_priv, curr_gw->orig_node,
686 NULL); 683 NULL);
687 if (!neigh_curr) 684 if (!neigh_curr)