[1/3] batman: Correct gw_speed down bit mask

Message ID 1275519516-21394-1-git-send-email-sven.eckelmann@gmx.de (mailing list archive)
State Accepted, archived
Headers

Commit Message

Sven Eckelmann June 2, 2010, 10:58 p.m. UTC
  We want to get bits .OOOO... and not as the mask would suggest .OOOOO..
when we decode the encoded bits for the download part of the gateway
speed.

Reported-By: Bill Meier <wmeier@newsguy.com>
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
---
 batman/batman.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
  

Comments

Simon Wunderlich June 5, 2010, 5:58 p.m. UTC | #1
Thanks, applied in svn r1691.

On Thu, Jun 03, 2010 at 12:58:34AM +0200, Sven Eckelmann wrote:
> We want to get bits .OOOO... and not as the mask would suggest .OOOOO..
> when we decode the encoded bits for the download part of the gateway
> speed.
> 
> Reported-By: Bill Meier <wmeier@newsguy.com>
> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
> ---
>  batman/batman.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/batman/batman.c b/batman/batman.c
> index 4374af5..ab689b2 100644
> --- a/batman/batman.c
> +++ b/batman/batman.c
> @@ -482,7 +482,7 @@ void update_gw_list(struct orig_node *orig_node, uint8_t new_gwflags, uint16_t g
>  void get_gw_speeds(unsigned char gw_class, int *down, int *up)
>  {
>  	char sbit = (gw_class & 0x80) >> 7;
> -	char dpart = (gw_class & 0x7C) >> 3;
> +	char dpart = (gw_class & 0x78) >> 3;
>  	char upart = (gw_class & 0x07);
>  
>  	*down = 32 * (sbit + 2) * (1 << dpart);
> -- 
> 1.7.1
> 
>
  

Patch

diff --git a/batman/batman.c b/batman/batman.c
index 4374af5..ab689b2 100644
--- a/batman/batman.c
+++ b/batman/batman.c
@@ -482,7 +482,7 @@  void update_gw_list(struct orig_node *orig_node, uint8_t new_gwflags, uint16_t g
 void get_gw_speeds(unsigned char gw_class, int *down, int *up)
 {
 	char sbit = (gw_class & 0x80) >> 7;
-	char dpart = (gw_class & 0x7C) >> 3;
+	char dpart = (gw_class & 0x78) >> 3;
 	char upart = (gw_class & 0x07);
 
 	*down = 32 * (sbit + 2) * (1 << dpart);