* [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: print OGM seq numbers as unsigned long
@ 2012-02-26 14:39 Antonio Quartulli
2012-02-26 14:39 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: skip the window protection test when the originator has no neighbours Antonio Quartulli
2012-02-27 11:02 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: print OGM seq numbers as unsigned long Marek Lindner
0 siblings, 2 replies; 5+ messages in thread
From: Antonio Quartulli @ 2012-02-26 14:39 UTC (permalink / raw)
To: b.a.t.m.a.n
OGM sequence numbers are declared as uint32_t and so they have to printed
using %u instead of %d in order to avoid wrong representations.
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
bat_iv_ogm.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 42c121d..c42e030 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -152,7 +152,7 @@ static void bat_iv_ogm_send_to_if(struct forw_packet *forw_packet,
"Sending own" :
"Forwarding"));
bat_dbg(DBG_BATMAN, bat_priv,
- "%s %spacket (originator %pM, seqno %d, TQ %d, TTL %d,"
+ "%s %spacket (originator %pM, seqno %u, TQ %d, TTL %d,"
" IDF %s, ttvn %d) on interface %s [%pM]\n",
fwd_str, (packet_num > 0 ? "aggregated " : ""),
batman_ogm_packet->orig,
@@ -213,7 +213,7 @@ static void bat_iv_ogm_emit(struct forw_packet *forw_packet)
/* FIXME: what about aggregated packets ? */
bat_dbg(DBG_BATMAN, bat_priv,
- "%s packet (originator %pM, seqno %d, TTL %d) "
+ "%s packet (originator %pM, seqno %u, TTL %d) "
"on interface %s [%pM]\n",
(forw_packet->own ? "Sending own" : "Forwarding"),
batman_ogm_packet->orig,
@@ -900,7 +900,7 @@ static int bat_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
if (need_update) {
bat_dbg(DBG_BATMAN, bat_priv,
- "updating last_seqno: old %d, new %d\n",
+ "updating last_seqno: old %u, new %u\n",
orig_node->last_real_seqno, batman_ogm_packet->seqno);
orig_node->last_real_seqno = batman_ogm_packet->seqno;
}
@@ -954,7 +954,7 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,
bat_dbg(DBG_BATMAN, bat_priv,
"Received BATMAN packet via NB: %pM, IF: %s [%pM] "
- "(from OG: %pM, via prev OG: %pM, seqno %d, ttvn %u, "
+ "(from OG: %pM, via prev OG: %pM, seqno %u, ttvn %u, "
"crc %u, changes %u, td %d, TTL %d, V %d, IDF %d)\n",
ethhdr->h_source, if_incoming->net_dev->name,
if_incoming->net_dev->dev_addr, batman_ogm_packet->orig,
--
1.7.3.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: skip the window protection test when the originator has no neighbours
2012-02-26 14:39 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: print OGM seq numbers as unsigned long Antonio Quartulli
@ 2012-02-26 14:39 ` Antonio Quartulli
2012-02-26 16:49 ` Martin Hundebøll
2012-02-27 11:03 ` Marek Lindner
2012-02-27 11:02 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: print OGM seq numbers as unsigned long Marek Lindner
1 sibling, 2 replies; 5+ messages in thread
From: Antonio Quartulli @ 2012-02-26 14:39 UTC (permalink / raw)
To: b.a.t.m.a.n
When we receive an OGM from from a node for the first time, the last_real_seqno
field of the orig_node structure has not been initialised yet. The value of this
field is used to compute the current ogm-seqno window and therefore the
protection mechanism will probably drop the packet due to an out-of-window error.
To avoid this situation this patch adds a check to skip the window protection
mechanism if no neighbour nodes have already been added. When the first
neighbour node is added, the last_real_seqno field is initialised too.
Reported-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
bat_iv_ogm.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index c42e030..d9195b3 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -869,7 +869,8 @@ static int bat_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
seq_diff = batman_ogm_packet->seqno - orig_node->last_real_seqno;
/* signalize caller that the packet is to be dropped. */
- if (window_protected(bat_priv, seq_diff,
+ if (!hlist_empty(&orig_node->neigh_list) &&
+ window_protected(bat_priv, seq_diff,
&orig_node->batman_seqno_reset))
goto out;
--
1.7.3.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: skip the window protection test when the originator has no neighbours
2012-02-26 14:39 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: skip the window protection test when the originator has no neighbours Antonio Quartulli
@ 2012-02-26 16:49 ` Martin Hundebøll
2012-02-27 11:03 ` Marek Lindner
1 sibling, 0 replies; 5+ messages in thread
From: Martin Hundebøll @ 2012-02-26 16:49 UTC (permalink / raw)
To: b.a.t.m.a.n
On 02/26/2012 03:39 PM, Antonio Quartulli wrote:
> When we receive an OGM from from a node for the first time, the last_real_seqno
> field of the orig_node structure has not been initialised yet. The value of this
> field is used to compute the current ogm-seqno window and therefore the
> protection mechanism will probably drop the packet due to an out-of-window error.
> To avoid this situation this patch adds a check to skip the window protection
> mechanism if no neighbour nodes have already been added. When the first
> neighbour node is added, the last_real_seqno field is initialised too.
>
> Reported-by: Marek Lindner<lindner_marek@yahoo.de>
> Signed-off-by: Antonio Quartulli<ordex@autistici.org>
> ---
> bat_iv_ogm.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
> index c42e030..d9195b3 100644
> --- a/bat_iv_ogm.c
> +++ b/bat_iv_ogm.c
> @@ -869,7 +869,8 @@ static int bat_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
> seq_diff = batman_ogm_packet->seqno - orig_node->last_real_seqno;
>
> /* signalize caller that the packet is to be dropped. */
> - if (window_protected(bat_priv, seq_diff,
> + if (!hlist_empty(&orig_node->neigh_list)&&
> + window_protected(bat_priv, seq_diff,
> &orig_node->batman_seqno_reset))
> goto out;
>
Tested this and originators now appear within 3 seconds after being added to the mesh network. Good work, Antonio and Marek!
--
Kind regards,
Martin Hundebøll
Nordborggade 57, 2. 1
8000 Aarhus C
+45 61 65 54 61
martin@hundeboll.net
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: skip the window protection test when the originator has no neighbours
2012-02-26 14:39 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: skip the window protection test when the originator has no neighbours Antonio Quartulli
2012-02-26 16:49 ` Martin Hundebøll
@ 2012-02-27 11:03 ` Marek Lindner
1 sibling, 0 replies; 5+ messages in thread
From: Marek Lindner @ 2012-02-27 11:03 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Sunday, February 26, 2012 22:39:42 Antonio Quartulli wrote:
> When we receive an OGM from from a node for the first time, the
> last_real_seqno field of the orig_node structure has not been initialised
> yet. The value of this field is used to compute the current ogm-seqno
> window and therefore the protection mechanism will probably drop the
> packet due to an out-of-window error. To avoid this situation this patch
> adds a check to skip the window protection mechanism if no neighbour nodes
> have already been added. When the first neighbour node is added, the
> last_real_seqno field is initialised too.
Applied in revision a85b0bc.
Thanks,
Marek
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: print OGM seq numbers as unsigned long
2012-02-26 14:39 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: print OGM seq numbers as unsigned long Antonio Quartulli
2012-02-26 14:39 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: skip the window protection test when the originator has no neighbours Antonio Quartulli
@ 2012-02-27 11:02 ` Marek Lindner
1 sibling, 0 replies; 5+ messages in thread
From: Marek Lindner @ 2012-02-27 11:02 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Sunday, February 26, 2012 22:39:41 Antonio Quartulli wrote:
> OGM sequence numbers are declared as uint32_t and so they have to printed
> using %u instead of %d in order to avoid wrong representations.
Applied in revision 14b1316.
Thanks,
Marek
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-02-27 11:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-26 14:39 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: print OGM seq numbers as unsigned long Antonio Quartulli
2012-02-26 14:39 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: skip the window protection test when the originator has no neighbours Antonio Quartulli
2012-02-26 16:49 ` Martin Hundebøll
2012-02-27 11:03 ` Marek Lindner
2012-02-27 11:02 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: print OGM seq numbers as unsigned long 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).