public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: fix network order complaints in the TVLV code
@ 2013-05-28 12:06 Antonio Quartulli
  2013-05-29  7:45 ` Marek Lindner
  0 siblings, 1 reply; 2+ messages in thread
From: Antonio Quartulli @ 2013-05-28 12:06 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Antonio Quartulli

Intorduced by 1ab746a3f2441d3466592b86134fbc72a9fe0558
("batman-adv: properly align tvlv infrastructure")

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 main.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/main.c b/main.c
index 9df71bc..1192e61 100644
--- a/main.c
+++ b/main.c
@@ -630,7 +630,7 @@ static uint16_t batadv_tvlv_container_list_size(struct batadv_priv *bat_priv)
 
 	hlist_for_each_entry(tvlv, &bat_priv->tvlv.container_list, list) {
 		tvlv_len += sizeof(struct batadv_tvlv_hdr);
-		tvlv_len += tvlv->tvlv_hdr.len;
+		tvlv_len += ntohs(tvlv->tvlv_hdr.len);
 	}
 
 	return tvlv_len;
@@ -701,9 +701,9 @@ void batadv_tvlv_container_register(struct batadv_priv *bat_priv,
 
 	tvlv_new->tvlv_hdr.version = version;
 	tvlv_new->tvlv_hdr.type = type;
-	tvlv_new->tvlv_hdr.len = tvlv_value_len;
+	tvlv_new->tvlv_hdr.len = htons(tvlv_value_len);
 
-	memcpy(tvlv_new + 1, tvlv_value, tvlv_new->tvlv_hdr.len);
+	memcpy(tvlv_new + 1, tvlv_value, ntohs(tvlv_new->tvlv_hdr.len));
 	INIT_HLIST_NODE(&tvlv_new->list);
 	atomic_set(&tvlv_new->refcount, 1);
 
@@ -790,10 +790,10 @@ uint16_t batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv,
 		tvlv_hdr = tvlv_value;
 		tvlv_hdr->type = tvlv->tvlv_hdr.type;
 		tvlv_hdr->version = tvlv->tvlv_hdr.version;
-		tvlv_hdr->len = htons(tvlv->tvlv_hdr.len);
+		tvlv_hdr->len = tvlv->tvlv_hdr.len;
 		tvlv_value = tvlv_hdr + 1;
-		memcpy(tvlv_value, tvlv + 1, tvlv->tvlv_hdr.len);
-		tvlv_value = (uint8_t *)tvlv_value + tvlv->tvlv_hdr.len;
+		memcpy(tvlv_value, tvlv + 1, ntohs(tvlv->tvlv_hdr.len));
+		tvlv_value = (uint8_t *)tvlv_value + ntohs(tvlv->tvlv_hdr.len);
 	}
 
 end:
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: fix network order complaints in the TVLV code
  2013-05-28 12:06 [B.A.T.M.A.N.] [PATCH] batman-adv: fix network order complaints in the TVLV code Antonio Quartulli
@ 2013-05-29  7:45 ` Marek Lindner
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Lindner @ 2013-05-29  7:45 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Antonio Quartulli

On Tuesday, May 28, 2013 20:06:06 Antonio Quartulli wrote:
> Intorduced by 1ab746a3f2441d3466592b86134fbc72a9fe0558
> ("batman-adv: properly align tvlv infrastructure")
> 
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> ---
>  main.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Applied in revision 422ec22.

Thanks,
Marek

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-29  7:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-28 12:06 [B.A.T.M.A.N.] [PATCH] batman-adv: fix network order complaints in the TVLV code Antonio Quartulli
2013-05-29  7:45 ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox