public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: [B.A.T.M.A.N.] [PATCH 2/2] alfred: Only check for minimal length of fixed size packets
Date: Mon,  9 Oct 2017 17:33:07 +0200	[thread overview]
Message-ID: <20171009153307.29245-2-sven@narfation.org> (raw)
In-Reply-To: <20171009153307.29245-1-sven@narfation.org>

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


  reply	other threads:[~2017-10-09 15:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2017-10-23 15:27 ` Simon Wunderlich

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=20171009153307.29245-2-sven@narfation.org \
    --to=sven@narfation.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox