public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: passt-dev@passt.top
Cc: Stas Sergeev <stsp2@yandex.ru>
Subject: [PATCH] dhcp: Actually note down the length of options received by the client
Date: Thu, 21 Sep 2023 18:50:56 +0200	[thread overview]
Message-ID: <20230921165056.3761503-1-sbrivio@redhat.com> (raw)

It turns out we never used 'clen' until commit 1f24d3efb499 ("dhcp:
support BOOTP clients"), and we always ignored option 55 (Parameter
Request List), while, according to RFC 2132, we MUST try to insert
the requested options in the order requested by the client.

The commit mentioned above made this visible because now every client
is reported as sending a DHCPREQUEST as an old BOOTP client, based on
the lack of option 53 (that is, zero length).

Fixes: b439984641ed ("merd: ARP and DHCP handlers, connection tracking fixes")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
 dhcp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dhcp.c b/dhcp.c
index c1ac95e..46c258e 100644
--- a/dhcp.c
+++ b/dhcp.c
@@ -317,6 +317,7 @@ int dhcp(const struct ctx *c, const struct pool *p)
 			return -1;
 
 		memcpy(&opts[*type].c, val, *olen);
+		opts[*type].clen = *olen;
 		opt_off += *olen + 2;
 	}
 
-- 
@@ -317,6 +317,7 @@ int dhcp(const struct ctx *c, const struct pool *p)
 			return -1;
 
 		memcpy(&opts[*type].c, val, *olen);
+		opts[*type].clen = *olen;
 		opt_off += *olen + 2;
 	}
 
-- 
2.39.2


             reply	other threads:[~2023-09-21 16:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 16:50 Stefano Brivio [this message]
2023-09-23  7:42 ` [PATCH] dhcp: Actually note down the length of options received by the client David Gibson

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=20230921165056.3761503-1-sbrivio@redhat.com \
    --to=sbrivio@redhat.com \
    --cc=passt-dev@passt.top \
    --cc=stsp2@yandex.ru \
    /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.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

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 IMAP folder(s).