[v2,maint,1/4] batman-adv: Fix broken DAT capability check
Commit Message
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: bfd0fbaef270 ("batman-adv: Make DAT capability changes atomic")
Reported-by: Def <def@laposte.net>
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
---
distributed-arp-table.c | 2 +-
types.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Comments
On Friday, July 03, 2015 18:29:56 Linus Lüssing wrote:
> 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: bfd0fbaef270 ("batman-adv: Make DAT capability changes atomic")
> Reported-by: Def <def@laposte.net>
> Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
> ---
> distributed-arp-table.c | 2 +-
> types.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
Applied in revision de46667.
Thanks,
Marek
@@ -422,7 +422,7 @@ static bool batadv_is_orig_node_eligible(struct batadv_dat_candidate *res,
int j;
/* check if orig node candidate is running DAT */
- if (!(candidate->capabilities & BATADV_ORIG_CAPA_HAS_DAT))
+ if (!(test_bit(BATADV_ORIG_CAPA_HAS_DAT, &candidate->capabilities)))
goto out;
/* Check if this node has already been selected... */
@@ -299,7 +299,7 @@ struct batadv_orig_node {
* (= orig node announces a tvlv of type BATADV_TVLV_MCAST)
*/
enum batadv_orig_capabilities {
- BATADV_ORIG_CAPA_HAS_DAT = BIT(0),
+ BATADV_ORIG_CAPA_HAS_DAT,
BATADV_ORIG_CAPA_HAS_NC = BIT(1),
BATADV_ORIG_CAPA_HAS_TT = BIT(2),
BATADV_ORIG_CAPA_HAS_MCAST = BIT(3),