b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH 1/2] alfred: Only query debugfs when netlink failed
@ 2017-10-09 15:33 Sven Eckelmann
  2017-10-09 15:33 ` [B.A.T.M.A.N.] [PATCH 2/2] alfred: Only check for minimal length of fixed size packets Sven Eckelmann
  2017-10-23 15:27 ` [B.A.T.M.A.N.] [PATCH 1/2] alfred: Only query debugfs when netlink failed Simon Wunderlich
  0 siblings, 2 replies; 3+ messages in thread
From: Sven Eckelmann @ 2017-10-09 15:33 UTC (permalink / raw)
  To: b.a.t.m.a.n

It is enough to just request the data from netlink and skip debugfs when
netlink didn't return an error. The overwrite of the ret variable was only
for testing purposes and should no longer be used.

Fixes: a7bc3d9a2b3f ("alfred: Cache the global translation table entries")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 batadv_query.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/batadv_query.c b/batadv_query.c
index 8580f1b..78b92cd 100644
--- a/batadv_query.c
+++ b/batadv_query.c
@@ -308,7 +308,6 @@ struct hashtable_t *tg_hash_new(const char *mesh_iface)
 	ret = translate_mac_netlink(mesh_iface, tg_hash);
 	enable_net_admin_capability(0);
 
-	ret = -EOPNOTSUPP;
 	if (ret == -EOPNOTSUPP)
 		translate_mac_debugfs(mesh_iface, tg_hash);
 
@@ -477,7 +476,6 @@ struct hashtable_t *orig_hash_new(const char *mesh_iface)
 	ret = get_tq_netlink(mesh_iface, orig_hash);
 	enable_net_admin_capability(0);
 
-	ret = -EOPNOTSUPP;
 	if (ret == -EOPNOTSUPP)
 		get_tq_debugfs(mesh_iface, orig_hash);
 
-- 
2.11.0


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

* [B.A.T.M.A.N.] [PATCH 2/2] alfred: Only check for minimal length of fixed size packets
  2017-10-09 15:33 [B.A.T.M.A.N.] [PATCH 1/2] alfred: Only query debugfs when netlink failed Sven Eckelmann
@ 2017-10-09 15:33 ` Sven Eckelmann
  2017-10-23 15:27 ` [B.A.T.M.A.N.] [PATCH 1/2] alfred: Only query debugfs when netlink failed Simon Wunderlich
  1 sibling, 0 replies; 3+ messages in thread
From: Sven Eckelmann @ 2017-10-09 15:33 UTC (permalink / raw)
  To: b.a.t.m.a.n

These fixed size packets could have some optional information in the
future. We should therefore not limit the size of these packets to the size
of the non-tlv header.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
Any objections? Not sure if this is really necessary. But could be useful
in the future.
---
 recv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/recv.c b/recv.c
index 12bb3f1..e897e3d 100644
--- a/recv.c
+++ b/recv.c
@@ -284,7 +284,7 @@ process_alfred_announce_master(struct globals *globals,
 	if (announce->header.version != ALFRED_VERSION)
 		return -1;
 
-	if (len != (sizeof(*announce) - sizeof(announce->header)))
+	if (len < (sizeof(*announce) - sizeof(announce->header)))
 		return -1;
 
 	server = hash_find(interface->server_hash, &mac);
@@ -320,7 +320,7 @@ static int process_alfred_request(struct globals *globals,
 	if (request->header.version != ALFRED_VERSION)
 		return -1;
 
-	if (len != (sizeof(*request) - sizeof(request->header)))
+	if (len < (sizeof(*request) - sizeof(request->header)))
 		return -1;
 
 	push_data(globals, interface, source, SOURCE_SYNCED,
@@ -343,7 +343,7 @@ static int process_alfred_status_txend(struct globals *globals,
 	if (request->header.version != ALFRED_VERSION)
 		return -1;
 
-	if (len != (sizeof(*request) - sizeof(request->header)))
+	if (len < (sizeof(*request) - sizeof(request->header)))
 		return -1;
 
 	if (globals->ipv4mode)
-- 
2.11.0


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

* Re: [B.A.T.M.A.N.] [PATCH 1/2] alfred: Only query debugfs when netlink failed
  2017-10-09 15:33 [B.A.T.M.A.N.] [PATCH 1/2] alfred: Only query debugfs when netlink failed Sven Eckelmann
  2017-10-09 15:33 ` [B.A.T.M.A.N.] [PATCH 2/2] alfred: Only check for minimal length of fixed size packets Sven Eckelmann
@ 2017-10-23 15:27 ` Simon Wunderlich
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Wunderlich @ 2017-10-23 15:27 UTC (permalink / raw)
  To: b.a.t.m.a.n

[-- Attachment #1: Type: text/plain, Size: 471 bytes --]

On Monday, October 9, 2017 5:33:06 PM CEST Sven Eckelmann wrote:
> It is enough to just request the data from netlink and skip debugfs when
> netlink didn't return an error. The overwrite of the ret variable was only
> for testing purposes and should no longer be used.
> 
> Fixes: a7bc3d9a2b3f ("alfred: Cache the global translation table entries")
> Signed-off-by: Sven Eckelmann <sven@narfation.org>

I've applied this series (b5e24fc, 6084780).

Thank you!
     Simon

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2017-10-23 15:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-09 15:33 [B.A.T.M.A.N.] [PATCH 1/2] alfred: Only query debugfs when netlink failed Sven Eckelmann
2017-10-09 15:33 ` [B.A.T.M.A.N.] [PATCH 2/2] alfred: Only check for minimal length of fixed size packets Sven Eckelmann
2017-10-23 15:27 ` [B.A.T.M.A.N.] [PATCH 1/2] alfred: Only query debugfs when netlink failed Simon Wunderlich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).