<feed xmlns='http://www.w3.org/2005/Atom'>
<title>passt/dhcp.c, branch 2026_12_04.a39d958</title>
<subtitle>Plug A Simple Socket Transport</subtitle>
<link rel='alternate' type='text/html' href='https://passt.top/passt/'/>
<entry>
<title>dhcp: Add bounds check on DNS search domain option buffer</title>
<updated>2026-11-22T17:26:12+00:00</updated>
<author>
<name>Anshu Kumari</name>
<email>anskuma@redhat.com</email>
</author>
<published>2026-11-17T12:06:17+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=0b616b3a7159ee15140feb163579e79e061869ef'/>
<id>0b616b3a7159ee15140feb163579e79e061869ef</id>
<content type='text'>
Add an explicit check that the encoded DNS search domain data
does not exceed the capacity of opts[119].s before each memcpy()
in opt_set_dns_search().

Reported-by: Lakshitha Perera &lt;eonzylakshitha@gmail.com&gt;
Signed-off-by: Anshu Kumari &lt;anskuma@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add an explicit check that the encoded DNS search domain data
does not exceed the capacity of opts[119].s before each memcpy()
in opt_set_dns_search().

Reported-by: Lakshitha Perera &lt;eonzylakshitha@gmail.com&gt;
Signed-off-by: Anshu Kumari &lt;anskuma@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dhcp: Use unsigned int for opts[].slen</title>
<updated>2026-11-22T17:25:54+00:00</updated>
<author>
<name>Anshu Kumari</name>
<email>anskuma@redhat.com</email>
</author>
<published>2026-11-17T12:06:16+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=0263ae544528cf62fa35798f7cb4143ff0ed66a5'/>
<id>0263ae544528cf62fa35798f7cb4143ff0ed66a5</id>
<content type='text'>
Now that negative value (-1) is no longer used to do the
opts[].slen initialization (removed by commit 64e69136ecbc,
"dhcp: Add option configuration tracking with enum opt_conf"),
change slen from int to unsigned int. Hence, removed the
explicit (size_t) casts in comparisons.

Reported-by: Lakshitha Perera &lt;eonzylakshitha@gmail.com&gt;
Signed-off-by: Anshu Kumari &lt;anskuma@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that negative value (-1) is no longer used to do the
opts[].slen initialization (removed by commit 64e69136ecbc,
"dhcp: Add option configuration tracking with enum opt_conf"),
change slen from int to unsigned int. Hence, removed the
explicit (size_t) casts in comparisons.

Reported-by: Lakshitha Perera &lt;eonzylakshitha@gmail.com&gt;
Signed-off-by: Anshu Kumari &lt;anskuma@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>passt, pasta: Introduce unified multi-address data structures</title>
<updated>2026-11-10T23:16:36+00:00</updated>
<author>
<name>Jon Maloy</name>
<email>jmaloy@redhat.com</email>
</author>
<published>2026-11-05T00:11:12+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=7380393df27ec3ae4aacb40b6f9f25f75a11acf5'/>
<id>7380393df27ec3ae4aacb40b6f9f25f75a11acf5</id>
<content type='text'>
As preparation for supporting multiple addresses per interface,
we replace the single addr/prefix_len fields with an array. The
array consists of a new struct inany_addr_entry containing an
address and prefix length, both in inany_addr format.

Despite some code refactoring, there are only two real functional
changes:
- The indicated IPv6 prefix length is now properly stored, instead
  of being ignored and overridden with the hardcoded value 64, as
  has been the case until now.
- Since even IPv4 addresses now are stored in IPv6 format, we
  also store the corresponding prefix length in that format,
  i.e. using the range [96,128] instead of [0,32].

In conf_ip6(), the explicit IN6_IS_ADDR_UNSPECIFIED() check on the
address at the end of the function is no longer needed: for
host-discovered addresses, it is now checked inside the if (!a) block
before calling fwd_set_addr(); for user-provided addresses (via -a),
validation already rejects unspecified addresses at parse time.

Signed-off-by: Jon Maloy &lt;jmaloy@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As preparation for supporting multiple addresses per interface,
we replace the single addr/prefix_len fields with an array. The
array consists of a new struct inany_addr_entry containing an
address and prefix length, both in inany_addr format.

Despite some code refactoring, there are only two real functional
changes:
- The indicated IPv6 prefix length is now properly stored, instead
  of being ignored and overridden with the hardcoded value 64, as
  has been the case until now.
- Since even IPv4 addresses now are stored in IPv6 format, we
  also store the corresponding prefix length in that format,
  i.e. using the range [96,128] instead of [0,32].

In conf_ip6(), the explicit IN6_IS_ADDR_UNSPECIFIED() check on the
address at the end of the function is no longer needed: for
host-discovered addresses, it is now checked inside the if (!a) block
before calling fwd_set_addr(); for user-provided addresses (via -a),
validation already rejects unspecified addresses at parse time.

Signed-off-by: Jon Maloy &lt;jmaloy@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dhcp: Add RFC 3396 option splitting for concatenation-requiring options</title>
<updated>2026-11-10T22:03:14+00:00</updated>
<author>
<name>Anshu Kumari</name>
<email>anskuma@redhat.com</email>
</author>
<published>2026-10-26T10:56:58+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=ad57ae2e65ac7405156470fcf2dccc791677e8df'/>
<id>ad57ae2e65ac7405156470fcf2dccc791677e8df</id>
<content type='text'>
Implement option splitting per RFC 3396 for options that may exceed
255 bytes.  A concat_req[] lookup table marks options requiring
concatenation (currently option 81, Client FQDN per RFC 4702).

The opts[].s buffer is resized from 255 to OPT_CONCAT_MAX to
hold the maximum data that can be split across the options
field, file field, and sname field.

When a concatenation-requiring option does not fit as a single
option in any field, fill() calls fill_split() to split it across
fields in RFC 3396 order: options field first, then file, then
sname.  Each split chunk is capped at 255 bytes per the DHCP
option length field limit.

Link: https://bugs.passt.top/show_bug.cgi?id=192
Signed-off-by: Anshu Kumari &lt;anskuma@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Implement option splitting per RFC 3396 for options that may exceed
255 bytes.  A concat_req[] lookup table marks options requiring
concatenation (currently option 81, Client FQDN per RFC 4702).

The opts[].s buffer is resized from 255 to OPT_CONCAT_MAX to
hold the maximum data that can be split across the options
field, file field, and sname field.

When a concatenation-requiring option does not fit as a single
option in any field, fill() calls fill_split() to split it across
fields in RFC 3396 order: options field first, then file, then
sname.  Each split chunk is capped at 255 bytes per the DHCP
option length field limit.

Link: https://bugs.passt.top/show_bug.cgi?id=192
Signed-off-by: Anshu Kumari &lt;anskuma@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dhcp: Add option overload</title>
<updated>2026-11-10T22:03:12+00:00</updated>
<author>
<name>Anshu Kumari</name>
<email>anskuma@redhat.com</email>
</author>
<published>2026-10-26T10:56:57+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=be69f7139f3c0dfb6f04aa44fc8f4cbc2243ffb4'/>
<id>be69f7139f3c0dfb6f04aa44fc8f4cbc2243ffb4</id>
<content type='text'>
Change fill_one() to return void because now we use a single loop
to report all unsent options.

When the options field is full, overflow remaining DHCP options into
the sname and file fields per RFC 2132 option 52. Per RFC 2132,
Section 9.5, the boot file name is always placed in the
'file' header field.  When a boot file is set, the file field is
reserved from overload and overflow uses only the sname field.

Link: https://bugs.passt.top/show_bug.cgi?id=192
Signed-off-by: Anshu Kumari &lt;anskuma@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change fill_one() to return void because now we use a single loop
to report all unsent options.

When the options field is full, overflow remaining DHCP options into
the sname and file fields per RFC 2132 option 52. Per RFC 2132,
Section 9.5, the boot file name is always placed in the
'file' header field.  When a boot file is set, the file field is
reserved from overload and overflow uses only the sname field.

Link: https://bugs.passt.top/show_bug.cgi?id=192
Signed-off-by: Anshu Kumari &lt;anskuma@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dhcp: Add --dhcp-boot command-line option</title>
<updated>2026-11-10T22:03:09+00:00</updated>
<author>
<name>Anshu Kumari</name>
<email>anskuma@redhat.com</email>
</author>
<published>2026-10-26T10:56:56+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=4901b1cff81c9314ce2f50fedfde938c4104b97c'/>
<id>4901b1cff81c9314ce2f50fedfde938c4104b97c</id>
<content type='text'>
Add --dhcp-boot FILE as convenience shorthand for --dhcp-opt 67,FILE.
Copy the boot file name into the 'file' header field of the BOOTP
message (RFC 2132, Section 9.5).

Link: https://bugs.passt.top/show_bug.cgi?id=192
Signed-off-by: Anshu Kumari &lt;anskuma@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add --dhcp-boot FILE as convenience shorthand for --dhcp-opt 67,FILE.
Copy the boot file name into the 'file' header field of the BOOTP
message (RFC 2132, Section 9.5).

Link: https://bugs.passt.top/show_bug.cgi?id=192
Signed-off-by: Anshu Kumari &lt;anskuma@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dhcp: Add --dhcp-opt with option table and value parser</title>
<updated>2026-11-10T22:03:07+00:00</updated>
<author>
<name>Anshu Kumari</name>
<email>anskuma@redhat.com</email>
</author>
<published>2026-10-26T10:56:55+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=5e00f7ac41b1e0d3c85106ac8dc78fd216a93529'/>
<id>5e00f7ac41b1e0d3c85106ac8dc78fd216a93529</id>
<content type='text'>
Add a --dhcp-opt CODE,VALUE flag that sets any DHCP option by
numeric code with type-aware parsing per RFC 2132.

A type lookup table maps option codes to RFC 2132 value types
(IPv4, IPv4 list, integer, string).  dhcp_opt_parse() converts
CLI strings to binary wire format; parsed options are stored in
opts[] and injected into DHCP replies.  Options set via --dhcp-opt
(OPT_USER) take priority over host-derived defaults (OPT_DEFAULT).

Link: https://bugs.passt.top/show_bug.cgi?id=192
Signed-off-by: Anshu Kumari &lt;anskuma@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a --dhcp-opt CODE,VALUE flag that sets any DHCP option by
numeric code with type-aware parsing per RFC 2132.

A type lookup table maps option codes to RFC 2132 value types
(IPv4, IPv4 list, integer, string).  dhcp_opt_parse() converts
CLI strings to binary wire format; parsed options are stored in
opts[] and injected into DHCP replies.  Options set via --dhcp-opt
(OPT_USER) take priority over host-derived defaults (OPT_DEFAULT).

Link: https://bugs.passt.top/show_bug.cgi?id=192
Signed-off-by: Anshu Kumari &lt;anskuma@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dhcp: Add option configuration tracking with enum opt_conf</title>
<updated>2026-11-10T22:03:04+00:00</updated>
<author>
<name>Anshu Kumari</name>
<email>anskuma@redhat.com</email>
</author>
<published>2026-10-26T10:56:54+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=64e69136ecbcc5fedfd779d929d713b451c91b67'/>
<id>64e69136ecbcc5fedfd779d929d713b451c91b67</id>
<content type='text'>
Overloading slen = -1 to mean "not set" conflates the option
length with its lifecycle state, and can't express additional
states such as "set by the user via command-line" which will
be needed for --dhcp-opt support.

Introduce enum opt_conf with OPT_UNSET (option not
configured) and OPT_DEFAULT (derived from host
configuration).  Replace all slen = -1 / slen != -1 checks
with conf comparisons, and set conf = OPT_DEFAULT for
options initialised in dhcp_init() and at reply time in
dhcp().

Link: https://bugs.passt.top/show_bug.cgi?id=192
Signed-off-by: Anshu Kumari &lt;anskuma@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Overloading slen = -1 to mean "not set" conflates the option
length with its lifecycle state, and can't express additional
states such as "set by the user via command-line" which will
be needed for --dhcp-opt support.

Introduce enum opt_conf with OPT_UNSET (option not
configured) and OPT_DEFAULT (derived from host
configuration).  Replace all slen = -1 / slen != -1 checks
with conf comparisons, and set conf = OPT_DEFAULT for
options initialised in dhcp_init() and at reply time in
dhcp().

Link: https://bugs.passt.top/show_bug.cgi?id=192
Signed-off-by: Anshu Kumari &lt;anskuma@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dhcp: Refactor fill_one() to operate on a generic buffer</title>
<updated>2026-11-10T22:02:51+00:00</updated>
<author>
<name>Anshu Kumari</name>
<email>anskuma@redhat.com</email>
</author>
<published>2026-10-26T10:56:53+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=aec33b09f60b0e4a8766d4007e20b1757168158c'/>
<id>aec33b09f60b0e4a8766d4007e20b1757168158c</id>
<content type='text'>
Change fill_one() to accept a buffer pointer and capacity instead of
a struct msg pointer.  This is a pure refactor with no behavior change,
preparing for option overload support where fill_one() will also write
into the file and sname fields.

Link: https://bugs.passt.top/show_bug.cgi?id=192
Signed-off-by: Anshu Kumari &lt;anskuma@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change fill_one() to accept a buffer pointer and capacity instead of
a struct msg pointer.  This is a pure refactor with no behavior change,
preparing for option overload support where fill_one() will also write
into the file and sname fields.

Link: https://bugs.passt.top/show_bug.cgi?id=192
Signed-off-by: Anshu Kumari &lt;anskuma@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dhcp: Make option parsing more robust, explicitly handle options 0 and 255</title>
<updated>2026-07-16T08:46:22+00:00</updated>
<author>
<name>Stefano Brivio</name>
<email>sbrivio@redhat.com</email>
</author>
<published>2026-07-15T22:56:23+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=7d0c07728813880d6049abb3dc33dcaf8154ff66'/>
<id>7d0c07728813880d6049abb3dc33dcaf8154ff66</id>
<content type='text'>
The initial option-scanning loop in dhcp(), so far, ignored options 0
(Pad Option, RFC 2132, Section 3.1) and 255 (End Option, RFC 2132,
Section 3.2).

As a result:

- if we ever encountered option 0 in the middle of option fields
  (never seen in practice), we would potentially terminate the loop
  too early, before scanning remaining options

- a malformed message with an option 255 followed by a length byte
  would (reliably) cause us to terminate as we would exceed the
  allocated size for the 'opts' array, which is detected as buffer
  overflow by the FORTIFY_SOURCE mechanism

The latter was reported as potential vulnerability by AISLE, but it's
not actually a vulnerability as we always terminate without carrying
on further handling, and in our security model the guest is able to
sabotage its own connectivity in any case (for example, a malformed
frame from the hypervisor would cause us to reset the connection, or
entirely flooding the flow table would cause inbound connectivity to
stop working, etc.).

The reported behaviour, however, is indeed a defect, as it affects
the functional robustness to a hypothetical issue in a DHCP client,
and that's something we definitely want to fix.

Make the option parsing loop more robust by:

- resizing 'opts' from 255 to 256 elements: there's no particular
  reason to try to save a tiny bit of memory (which shouldn't even
  be allocated in practice) instead of being defensive about it

- explicitly handle options 0 (skip one byte, continue) and 255 (stop
  processing options) in the option-scanning loop

- scanning the last two bytes of options as well and using
  iov_tail_size(data) directly as loop condition, instead of a rather
  inconsistent usage of opt_len

This bug was found and an initial version of the patch was written by
the AISLE AI security scanning tool (https://aisle.com/platform).

Reported-by: AISLE
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
Reviewed-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The initial option-scanning loop in dhcp(), so far, ignored options 0
(Pad Option, RFC 2132, Section 3.1) and 255 (End Option, RFC 2132,
Section 3.2).

As a result:

- if we ever encountered option 0 in the middle of option fields
  (never seen in practice), we would potentially terminate the loop
  too early, before scanning remaining options

- a malformed message with an option 255 followed by a length byte
  would (reliably) cause us to terminate as we would exceed the
  allocated size for the 'opts' array, which is detected as buffer
  overflow by the FORTIFY_SOURCE mechanism

The latter was reported as potential vulnerability by AISLE, but it's
not actually a vulnerability as we always terminate without carrying
on further handling, and in our security model the guest is able to
sabotage its own connectivity in any case (for example, a malformed
frame from the hypervisor would cause us to reset the connection, or
entirely flooding the flow table would cause inbound connectivity to
stop working, etc.).

The reported behaviour, however, is indeed a defect, as it affects
the functional robustness to a hypothetical issue in a DHCP client,
and that's something we definitely want to fix.

Make the option parsing loop more robust by:

- resizing 'opts' from 255 to 256 elements: there's no particular
  reason to try to save a tiny bit of memory (which shouldn't even
  be allocated in practice) instead of being defensive about it

- explicitly handle options 0 (skip one byte, continue) and 255 (stop
  processing options) in the option-scanning loop

- scanning the last two bytes of options as well and using
  iov_tail_size(data) directly as loop condition, instead of a rather
  inconsistent usage of opt_len

This bug was found and an initial version of the patch was written by
the AISLE AI security scanning tool (https://aisle.com/platform).

Reported-by: AISLE
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
Reviewed-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
</pre>
</div>
</content>
</entry>
</feed>
