[v2,maint,2/4] batman-adv: Fix broken NC 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: 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(-)
Comments
On Friday, July 03, 2015 18:29:57 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: 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(-)
Applied in revision 188ac4f.
Thanks,
Marek
@@ -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 */
@@ -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),
};