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(a)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
Reported-by: MK <mailing.m1(a)kkk-web.de>
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
README | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/README b/README
index 90a99de..205c156 100644
--- a/README
+++ b/README
@@ -256,6 +256,32 @@ To get JSON formatted output, use:
See gpsd_json(5) for documentation of the tpv object.
+Running alfred as non-root user
+-------------------------------
+
+Alfred currently requires special capabilities and access rights to work
+correctly. The user root is normally the only user having these
+capabilities/rights on a standard Linux system.
+
+Operations requiring special capabilities:
+
+ * bind to device
+ * creating the unix socket
+ * accessing the debugfs filesystem
+
+The first operation can still be executed when the admin grants the special
+capability CAP_NET_RAW to anyone executing the alfred binary. The unix socket
+can also be moved to a different directly which is accessible by the user by
+adding the parameter '-u'.
+
+ $ sudo setcap cap_net_raw+ep alfred
+ $ ./alfred -u alfred.sock -i eth0
+
+The user running alfred must still be in a group which is allowed to access
+/sys/kernel/debugfs to correctly choose best neighbors for communication.
+It is possible (but not recommended) to disable the neighbor
+selection/prioritization using the parameter '-b none'.
+
License
-------
--
2.1.4
orig_ifinfo is dereferenced multiple times in batadv_iv_ogm_update_seqnos
before the check for NULL is done. The function also exists at the beginning
when orig_ifinfo would have been NULL. This makes the check at the end
unnecessary and only confuses the reader/code analyzers.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
bat_iv_ogm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 554e0e0..04bd220 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -1357,8 +1357,7 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
out:
spin_unlock_bh(&orig_node->bat_iv.ogm_cnt_lock);
batadv_orig_node_free_ref(orig_node);
- if (orig_ifinfo)
- batadv_orig_ifinfo_free_ref(orig_ifinfo);
+ batadv_orig_ifinfo_free_ref(orig_ifinfo);
return ret;
}
--
2.1.4