* [PATCH] dhcp: Remove option 255 length byte
@ 2025-02-11 11:14 Enrique Llorente
2025-02-12 1:14 ` David Gibson
0 siblings, 1 reply; 4+ messages in thread
From: Enrique Llorente @ 2025-02-11 11:14 UTC (permalink / raw)
To: passt-dev; +Cc: Enrique Llorente
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>
---
dhcp.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dhcp.c b/dhcp.c
index 401cb5b..3aef13f 100644
--- a/dhcp.c
+++ b/dhcp.c
@@ -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);
--
@@ -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);
--
2.47.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] dhcp: Remove option 255 length byte
2025-02-11 11:14 [PATCH] dhcp: Remove option 255 length byte Enrique Llorente
@ 2025-02-12 1:14 ` David Gibson
2025-02-12 1:38 ` Stefano Brivio
0 siblings, 1 reply; 4+ messages in thread
From: David Gibson @ 2025-02-12 1:14 UTC (permalink / raw)
To: Enrique Llorente; +Cc: passt-dev
[-- Attachment #1: Type: text/plain, Size: 1258 bytes --]
On Tue, Feb 11, 2025 at 12:14:34PM +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>
Thanks, change is good. However, could you also update the comment on
OPT_MAX's definition that appears to have the same error in it.
> ---
> dhcp.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/dhcp.c b/dhcp.c
> index 401cb5b..3aef13f 100644
> --- a/dhcp.c
> +++ b/dhcp.c
> @@ -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 --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] dhcp: Remove option 255 length byte
2025-02-12 1:14 ` David Gibson
@ 2025-02-12 1:38 ` Stefano Brivio
2025-02-17 9:24 ` Enrique Llorente Pastora
0 siblings, 1 reply; 4+ messages in thread
From: Stefano Brivio @ 2025-02-12 1:38 UTC (permalink / raw)
To: Enrique Llorente; +Cc: David Gibson, passt-dev
On Wed, 12 Feb 2025 12:14:32 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:
> On Tue, Feb 11, 2025 at 12:14:34PM +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>
>
> Thanks, change is good. However, could you also update the comment on
> OPT_MAX's definition that appears to have the same error in it.
I was about to apply this by amending the comment, but... it's not just
the comment (hence it needs to be re-tested a bit): OPT_MAX should be
307 now, otherwise you don't actually use the extra byte.
--
Stefano
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] dhcp: Remove option 255 length byte
2025-02-12 1:38 ` Stefano Brivio
@ 2025-02-17 9:24 ` Enrique Llorente Pastora
0 siblings, 0 replies; 4+ messages in thread
From: Enrique Llorente Pastora @ 2025-02-17 9:24 UTC (permalink / raw)
To: Stefano Brivio; +Cc: David Gibson, passt-dev
On Wed, Feb 12, 2025 at 2:38 AM Stefano Brivio <sbrivio@redhat.com> wrote:
>
> On Wed, 12 Feb 2025 12:14:32 +1100
> David Gibson <david@gibson.dropbear.id.au> wrote:
>
> > On Tue, Feb 11, 2025 at 12:14:34PM +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>
> >
> > Thanks, change is good. However, could you also update the comment on
> > OPT_MAX's definition that appears to have the same error in it.
>
> I was about to apply this by amending the comment, but... it's not just
> the comment (hence it needs to be re-tested a bit): OPT_MAX should be
> 307 now, otherwise you don't actually use the extra byte.
>
Good catch, changing.
> --
> Stefano
>
--
Quique Llorente
CNV networking Senior Software Engineer
Red Hat EMEA
ellorent@redhat.com
@RedHat Red Hat Red Hat
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-02-17 9:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-11 11:14 [PATCH] dhcp: Remove option 255 length byte Enrique Llorente
2025-02-12 1:14 ` David Gibson
2025-02-12 1:38 ` Stefano Brivio
2025-02-17 9:24 ` Enrique Llorente Pastora
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).