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 1/2] alfred: Update version when adding data to dataset
@ 2015-03-07 22:41 Sven Eckelmann
  2015-03-07 22:41 ` [B.A.T.M.A.N.] [PATCH 2/2] alfred: Add option to the client to print extra data information Sven Eckelmann
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Sven Eckelmann @ 2015-03-07 22:41 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann

The dataset stores the source and the alfred_tlv of the send data next to the
actual data buffer. The source and alfred_tlv::type was used to find an entry
in the dataset hashtable when reading/updating the buffer. The
alfred_tlv::length is always updated when the size of the associated buffer
gets modified.

But the alfred_tlv::version is only written when receiving the first data for a
dataset. But this initial (maybe outdated) version is always propagated when a
client asks over the unix socket or the dataset is exchanged between alfred
servers. This has to also be updated when new data is added to the dataset to
avoid clients to interpret the data using the wrong data format version.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 recv.c      | 1 +
 unix_sock.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/recv.c b/recv.c
index 34a16fc..e0252eb 100644
--- a/recv.c
+++ b/recv.c
@@ -91,6 +91,7 @@ static int finish_alfred_push_data(struct globals *globals,
 			goto err;
 
 		dataset->data.header.length = data_len;
+		dataset->data.header.version = data->header.version;
 		memcpy(dataset->buf, data->data, data_len);
 
 		/* if the sender is also the the source of the dataset, we
diff --git a/unix_sock.c b/unix_sock.c
index ae86956..0707252 100644
--- a/unix_sock.c
+++ b/unix_sock.c
@@ -151,6 +151,7 @@ static int unix_sock_add_data(struct globals *globals,
 		goto err;
 
 	dataset->data.header.length = data_len;
+	dataset->data.header.version = data->header.version;
 	memcpy(dataset->buf, data->data, data_len);
 
 	ret = 0;
-- 
2.1.4


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

end of thread, other threads:[~2015-03-11 12:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-07 22:41 [B.A.T.M.A.N.] [PATCH 1/2] alfred: Update version when adding data to dataset Sven Eckelmann
2015-03-07 22:41 ` [B.A.T.M.A.N.] [PATCH 2/2] alfred: Add option to the client to print extra data information Sven Eckelmann
2015-03-07 22:45 ` [B.A.T.M.A.N.] [PATCHv2 " Sven Eckelmann
2015-03-11 12:08   ` Simon Wunderlich
2015-03-11 12:08 ` [B.A.T.M.A.N.] [PATCH 1/2] alfred: Update version when adding data to dataset Simon Wunderlich

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