* [B.A.T.M.A.N.] Random bat_dbg cleanup patches
@ 2011-05-10 9:22 Sven Eckelmann
2011-05-10 9:22 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Remove unreachable code from gw_election Sven Eckelmann
2011-05-10 9:22 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Ensure that we really have route changes in update_route Sven Eckelmann
0 siblings, 2 replies; 4+ messages in thread
From: Sven Eckelmann @ 2011-05-10 9:22 UTC (permalink / raw)
To: b.a.t.m.a.n
Hi,
I would like to propose following patches, but hadn't much time to check
if they hide the real problem.
Kind regards,
Sven
^ permalink raw reply [flat|nested] 4+ messages in thread
* [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Remove unreachable code from gw_election
2011-05-10 9:22 [B.A.T.M.A.N.] Random bat_dbg cleanup patches Sven Eckelmann
@ 2011-05-10 9:22 ` Sven Eckelmann
2011-05-10 9:22 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Ensure that we really have route changes in update_route Sven Eckelmann
1 sibling, 0 replies; 4+ messages in thread
From: Sven Eckelmann @ 2011-05-10 9:22 UTC (permalink / raw)
To: b.a.t.m.a.n
One of the first actions of gw_election is to check whether curr_gw is
not NULL. In that case it will jumps to out. The rest of the code
(before out) can now assume that gw_node is NULL. Therefore the router
is only changed when curr_gw_tmp. This makes some printks in this block
unnecessary which handle the case that curr_gw_tmp is NULL.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
gateway_client.c | 24 +++++-------------------
1 files changed, 5 insertions(+), 19 deletions(-)
diff --git a/gateway_client.c b/gateway_client.c
index 65f3953..939fbfd 100644
--- a/gateway_client.c
+++ b/gateway_client.c
@@ -185,29 +185,15 @@ void gw_election(struct bat_priv *bat_priv)
neigh_node_free_ref(router);
}
- if (curr_gw != curr_gw_tmp) {
+ if (curr_gw_tmp) {
router = orig_node_get_router(curr_gw_tmp->orig_node);
if (!router)
goto unlock;
- if ((curr_gw) && (!curr_gw_tmp))
- bat_dbg(DBG_BATMAN, bat_priv,
- "Removing selected gateway - "
- "no gateway in range\n");
- else if ((!curr_gw) && (curr_gw_tmp))
- bat_dbg(DBG_BATMAN, bat_priv,
- "Adding route to gateway %pM "
- "(gw_flags: %i, tq: %i)\n",
- curr_gw_tmp->orig_node->orig,
- curr_gw_tmp->orig_node->gw_flags,
- router->tq_avg);
- else
- bat_dbg(DBG_BATMAN, bat_priv,
- "Changing route to gateway %pM "
- "(gw_flags: %i, tq: %i)\n",
- curr_gw_tmp->orig_node->orig,
- curr_gw_tmp->orig_node->gw_flags,
- router->tq_avg);
+ bat_dbg(DBG_BATMAN, bat_priv,
+ "Adding route to gateway %pM (gw_flags: %i, tq: %i)\n",
+ curr_gw_tmp->orig_node->orig,
+ curr_gw_tmp->orig_node->gw_flags, router->tq_avg);
neigh_node_free_ref(router);
gw_select(bat_priv, curr_gw_tmp);
--
1.7.5.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Ensure that we really have route changes in update_route
2011-05-10 9:22 [B.A.T.M.A.N.] Random bat_dbg cleanup patches Sven Eckelmann
2011-05-10 9:22 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Remove unreachable code from gw_election Sven Eckelmann
@ 2011-05-10 9:22 ` Sven Eckelmann
2011-05-22 10:29 ` Marek Lindner
1 sibling, 1 reply; 4+ messages in thread
From: Sven Eckelmann @ 2011-05-10 9:22 UTC (permalink / raw)
To: b.a.t.m.a.n
The debug output of update_route has tests for "route deleted" and "route
added". All other situations are handled as "route changed". This is not
true because neigh_node and curr_router could be both NULL.
The function is not called in this situation, but the code might be
interpreted wrong when reading it without this test.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
routing.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/routing.c b/routing.c
index 8c403ce..3f8355c 100644
--- a/routing.c
+++ b/routing.c
@@ -109,7 +109,7 @@ static void update_route(struct bat_priv *bat_priv,
tt_buff, tt_buff_len);
/* route changed */
- } else {
+ } else if (neigh_node && curr_router) {
bat_dbg(DBG_ROUTES, bat_priv,
"Changing route towards: %pM "
"(now via %pM - was via %pM)\n",
--
1.7.5.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Ensure that we really have route changes in update_route
2011-05-10 9:22 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Ensure that we really have route changes in update_route Sven Eckelmann
@ 2011-05-22 10:29 ` Marek Lindner
0 siblings, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2011-05-22 10:29 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Tuesday 10 May 2011 11:22:37 Sven Eckelmann wrote:
> The debug output of update_route has tests for "route deleted" and "route
> added". All other situations are handled as "route changed". This is not
> true because neigh_node and curr_router could be both NULL.
>
> The function is not called in this situation, but the code might be
> interpreted wrong when reading it without this test.
Applied in revision 3e7fe2e.
Thanks,
Marek
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-05-22 10:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-10 9:22 [B.A.T.M.A.N.] Random bat_dbg cleanup patches Sven Eckelmann
2011-05-10 9:22 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Remove unreachable code from gw_election Sven Eckelmann
2011-05-10 9:22 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Ensure that we really have route changes in update_route Sven Eckelmann
2011-05-22 10:29 ` Marek Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).