From: Marek Lindner <lindner_marek@yahoo.de>
To: The list for a Better Approach To Mobile Ad-hoc Networking
<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] [PATCH] batman-adv: properly handle Network Ordered variables
Date: Sun, 28 Apr 2013 00:46:11 +0800 [thread overview]
Message-ID: <201304280046.11511.lindner_marek@yahoo.de> (raw)
In-Reply-To: <1367078393-5646-1-git-send-email-ordex@autistici.org>
On Saturday, April 27, 2013 23:59:53 Antonio Quartulli wrote:
> --- a/gateway_common.c
> +++ b/gateway_common.c
> @@ -202,8 +202,8 @@ static void batadv_gw_tvlv_ogm_handler_v1(struct
> batadv_priv *bat_priv, gateway.bandwidth_up = 0;
> } else {
> gateway_ptr = tvlv_value;
> - gateway.bandwidth_down =
> ntohl(gateway_ptr->bandwidth_down); - gateway.bandwidth_up =
> ntohl(gateway_ptr->bandwidth_up); + gateway.bandwidth_down =
> gateway_ptr->bandwidth_down; + gateway.bandwidth_up =
> gateway_ptr->bandwidth_up;
> if ((gateway.bandwidth_down == 0) ||
> (gateway.bandwidth_up == 0)) {
> gateway.bandwidth_down = 0;
There is no bug. The original code converted the incoming big endian value to
host endian (whatever that is) and works with that value internally. Now that
you reversed the logic you have to adjust *all* occurences. Especially, when
the tvlv bandwidth value is copied into a gw_node struct. You can use sparse
to help you find the sections in the code by changing gw_node to be32 as well.
However, I am not convinced that converting the values every single time we
access the variable is the optimal approach.
Cheers,
Marek
next prev parent reply other threads:[~2013-04-27 16:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-27 15:59 [B.A.T.M.A.N.] [PATCH] batman-adv: properly handle Network Ordered variables Antonio Quartulli
2013-04-27 16:46 ` Marek Lindner [this message]
2013-04-27 16:59 ` Antonio Quartulli
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=201304280046.11511.lindner_marek@yahoo.de \
--to=lindner_marek@yahoo.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.