public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Enrique Llorente <ellorent@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH v2] dhcp: Remove option 255 length byte
Date: Tue, 18 Feb 2025 12:26:39 +1100	[thread overview]
Message-ID: <Z7Phz1Tfr5pGyTxb@zatzit> (raw)
In-Reply-To: <20250217092814.424375-1-ellorent@redhat.com>

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

On Mon, Feb 17, 2025 at 10:28:14AM +0100, Enrique Llorente wrote:
> The option 255 (end of options) do not need the length byte, this change
> remove that allowing to have one extra byte at other dynamic options.
> 
> Signed-off-by: Enrique Llorente <ellorent@redhat.com>

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

> ---
>  dhcp.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/dhcp.c b/dhcp.c
> index 401cb5b..4a209f1 100644
> --- a/dhcp.c
> +++ b/dhcp.c
> @@ -64,9 +64,9 @@ static struct opt opts[255];
>  #define OPT_MIN		60 /* RFC 951 */
>  
>  /* Total option size (excluding end option) is 576 (RFC 2131), minus
> - * offset of options (268), minus end option and its length (2).
> + * offset of options (268), minus end option (1).
>   */
> -#define OPT_MAX		306
> +#define OPT_MAX		307
>  
>  /**
>   * dhcp_init() - Initialise DHCP options
> @@ -127,7 +127,7 @@ struct msg {
>  	uint8_t sname[64];
>  	uint8_t file[128];
>  	uint32_t magic;
> -	uint8_t o[OPT_MAX + 2 /* End option and its length */ ];
> +	uint8_t o[OPT_MAX + 1 /* End option */ ];
>  } __attribute__((__packed__));
>  
>  /**
> @@ -194,7 +194,6 @@ static int fill(struct msg *m)
>  	}
>  
>  	m->o[offset++] = 255;
> -	m->o[offset++] = 0;
>  
>  	if (offset < OPT_MIN) {
>  		memset(&m->o[offset], 0, OPT_MIN - offset);

-- 
David Gibson (he or they)	| 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 --]

  reply	other threads:[~2025-02-18  2:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-17  9:28 [PATCH v2] dhcp: Remove option 255 length byte Enrique Llorente
2025-02-18  1:26 ` David Gibson [this message]
2025-02-18  8:14 ` Stefano Brivio

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=Z7Phz1Tfr5pGyTxb@zatzit \
    --to=david@gibson.dropbear.id.au \
    --cc=ellorent@redhat.com \
    --cc=passt-dev@passt.top \
    /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).