public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Marek Lindner <mareklindner@neomailbox.ch>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: Re: [B.A.T.M.A.N.] [PATCH] batman-adv: fix delayed foreign originator recognition
Date: Sun, 09 Nov 2014 12:46:53 +0800	[thread overview]
Message-ID: <35392227.73ozm9CNQu@diderot> (raw)
In-Reply-To: <1414646620-6022-1-git-send-email-linus.luessing@c0d3.blue>

[-- Attachment #1: Type: text/plain, Size: 1693 bytes --]

On Thursday 30 October 2014 06:23:40 Linus Lüssing wrote:
> Currently it can happen that the reception of an OGM from a new
> originator is not being accepted. More precisely it can happen that
> an originator struct gets allocated and initialized
> (batadv_orig_node_new()), even the TQ gets calculated and set correctly
> (batadv_iv_ogm_calc_tq()) but still the periodic orig_node purging
> thread will decide to delete it if it has a chance to jump between
> these two function calls.
> 
> This is because batadv_orig_node_new() initializes the last_seen value
> to zero and its caller (batadv_iv_ogm_orig_get()) makes it visible to
> other threads by adding it to the hash table already.
> batadv_iv_ogm_calc_tq() will set the last_seen variable to the correct,
> current time a few lines later but if the purging thread jumps in between
> that it will think that the orig_node timed out and will wrongly
> schedule it for deletion already.
> 
> If the purging interval is the same as the originator interval (which is
> the default: 1 second), then this game can continue for several rounds
> until the random OGM jitter added enough difference between these
> two (in tests, two to about four rounds seemed common).
> 
> Fixing this by initializing the last_seen variable of an orig_node
> to the current time before adding it to the hash table.
> 
> Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
> ---
>  originator.c |    1 +
>  1 file changed, 1 insertion(+)

You're definitely contending for this year's highest code to commit message 
ratio. Kudos to you for this well documented fix!

Applied in revision  8a2ad52.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

      reply	other threads:[~2014-11-09  4:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30  5:23 [B.A.T.M.A.N.] [PATCH] batman-adv: fix delayed foreign originator recognition Linus Lüssing
2014-11-09  4:46 ` Marek Lindner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=35392227.73ozm9CNQu@diderot \
    --to=mareklindner@neomailbox.ch \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox