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), };