public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] dhcp: Actually note down the length of options received by the client
@ 2023-09-21 16:50 Stefano Brivio
  2023-09-23  7:42 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Stefano Brivio @ 2023-09-21 16:50 UTC (permalink / raw)
  To: passt-dev; +Cc: Stas Sergeev

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


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

* Re: [PATCH] dhcp: Actually note down the length of options received by the client
  2023-09-21 16:50 [PATCH] dhcp: Actually note down the length of options received by the client Stefano Brivio
@ 2023-09-23  7:42 ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2023-09-23  7:42 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: passt-dev, Stas Sergeev

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

On Thu, Sep 21, 2023 at 06:50:56PM +0200, Stefano Brivio wrote:
> 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>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  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;
>  	}
>  

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2023-09-23  7:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-21 16:50 [PATCH] dhcp: Actually note down the length of options received by the client Stefano Brivio
2023-09-23  7:42 ` David Gibson

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).