b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: "Linus Lüssing" <linus.luessing@c0d3.blue>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: [B.A.T.M.A.N.] [PATCHv2 maint 2/4] batman-adv: Fix broken NC capability check
Date: Fri,  3 Jul 2015 18:29:57 +0200	[thread overview]
Message-ID: <1435940999-3829-3-git-send-email-linus.luessing@c0d3.blue> (raw)
In-Reply-To: <1435940999-3829-1-git-send-email-linus.luessing@c0d3.blue>

The introduction of set_bit() and clear_bit() calls in batman-adv
wrongly passed bitmasks and not the bit numbers to these functions.
This leads to broken capability checks.

Fixing this by making the capability enum a non-bitmasked one and by
that passing non-masked values to set_bit()/clear_bit().

Fixes: 586df9e2537b ("batman-adv: Make NC capability changes atomic")
Reported-by: Def <def@laposte.net>
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
---
 network-coding.c |    2 +-
 types.h          |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/network-coding.c b/network-coding.c
index 3ce493e..0309c2c 100644
--- a/network-coding.c
+++ b/network-coding.c
@@ -871,7 +871,7 @@ void batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
 		goto out;
 
 	/* check if orig node is network coding enabled */
-	if (!(orig_node->capabilities & BATADV_ORIG_CAPA_HAS_NC))
+	if (!(test_bit(BATADV_ORIG_CAPA_HAS_NC, &orig_node->capabilities)))
 		goto out;
 
 	/* accept ogms from 'good' neighbors and single hop neighbors */
diff --git a/types.h b/types.h
index 08a6343..cb7ccb1 100644
--- a/types.h
+++ b/types.h
@@ -300,7 +300,7 @@ struct batadv_orig_node {
  */
 enum batadv_orig_capabilities {
 	BATADV_ORIG_CAPA_HAS_DAT,
-	BATADV_ORIG_CAPA_HAS_NC = BIT(1),
+	BATADV_ORIG_CAPA_HAS_NC,
 	BATADV_ORIG_CAPA_HAS_TT = BIT(2),
 	BATADV_ORIG_CAPA_HAS_MCAST = BIT(3),
 };
-- 
1.7.10.4


  parent reply	other threads:[~2015-07-03 16:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-03 16:29 [B.A.T.M.A.N.] [PATCHv2 maint 0/4] batman-adv: Fix broken capability checks Linus Lüssing
2015-07-03 16:29 ` [B.A.T.M.A.N.] [PATCHv2 maint 1/4] batman-adv: Fix broken DAT capability check Linus Lüssing
2015-07-07  8:41   ` Marek Lindner
2015-07-03 16:29 ` Linus Lüssing [this message]
2015-07-07  8:45   ` [B.A.T.M.A.N.] [PATCHv2 maint 2/4] batman-adv: Fix broken NC " Marek Lindner
2015-07-03 16:29 ` [B.A.T.M.A.N.] [PATCHv2 maint 3/4] batman-adv: Fix broken TT " Linus Lüssing
2015-07-07  8:46   ` Marek Lindner
2015-07-03 16:29 ` [B.A.T.M.A.N.] [PATCHv2 maint 4/4] batman-adv: Fix broken MCAST " Linus Lüssing
2015-07-07  8:48   ` Marek Lindner

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=1435940999-3829-3-git-send-email-linus.luessing@c0d3.blue \
    --to=linus.luessing@c0d3.blue \
    --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;
as well as URLs for NNTP newsgroup(s).