aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorEnrique Llorente <ellorent@redhat.com>2025-02-17 10:28:14 +0100
committerStefano Brivio <sbrivio@redhat.com>2025-02-18 08:42:35 +0100
commitbcc4908c2b4a20c581f2b03fed40da97b804106f (patch)
tree097579f19fab419e7f681881e141955292d727e7
parenta1e48a02ff3550eb7875a7df6726086e9b3a1213 (diff)
downloadpasst-bcc4908c2b4a20c581f2b03fed40da97b804106f.tar
passt-bcc4908c2b4a20c581f2b03fed40da97b804106f.tar.gz
passt-bcc4908c2b4a20c581f2b03fed40da97b804106f.tar.bz2
passt-bcc4908c2b4a20c581f2b03fed40da97b804106f.tar.lz
passt-bcc4908c2b4a20c581f2b03fed40da97b804106f.tar.xz
passt-bcc4908c2b4a20c581f2b03fed40da97b804106f.tar.zst
passt-bcc4908c2b4a20c581f2b03fed40da97b804106f.zip
dhcp: Remove option 255 length byte
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> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--dhcp.c7
1 files 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);