<feed xmlns='http://www.w3.org/2005/Atom'>
<title>passt/Makefile, branch bug209</title>
<subtitle>Plug A Simple Socket Transport</subtitle>
<link rel='alternate' type='text/html' href='https://passt.top/passt/'/>
<entry>
<title>conf: Use new parsing tools to handle -a option</title>
<updated>2026-07-04T11:14:25+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2026-07-03T03:54:43+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=289638b6d8cd22b5907af6ae1be6201e68103716'/>
<id>289638b6d8cd22b5907af6ae1be6201e68103716</id>
<content type='text'>
The -a command line option can take either an address prefix, or a bare
address.  Current parsing of this is pretty awkward, using the special
purpose helper inany_prefix_pton().  With the new incremental parsing
helpers this can be done more naturally.  Rework it to use them.

This does requiring extending parse_inany() to parse_inany_() which also
reports the format of the address as parse, as opposed to the family of
the resulting address.  This is so that ::ffff:192.0.1.1/112 will be
correctly interpreted the same as 192.0.1.1/16, rather than the
nonsensical 192.0.0.1/112.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The -a command line option can take either an address prefix, or a bare
address.  Current parsing of this is pretty awkward, using the special
purpose helper inany_prefix_pton().  With the new incremental parsing
helpers this can be done more naturally.  Rework it to use them.

This does requiring extending parse_inany() to parse_inany_() which also
reports the format of the address as parse, as opposed to the family of
the resulting address.  This is so that ::ffff:192.0.1.1/112 will be
correctly interpreted the same as 192.0.1.1/16, rather than the
nonsensical 192.0.0.1/112.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>parse: Add helpers for parsing IP addresses</title>
<updated>2026-07-04T11:14:09+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2026-07-03T03:54:40+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=11f4fba6a9a90efccf16d6438065d22c5878734a'/>
<id>11f4fba6a9a90efccf16d6438065d22c5878734a</id>
<content type='text'>
parse_ipv[46]() are wrappers around inet_pton() that are more
convenient for use when the IP is part of a longer string, rather than
the entire string.  parse_inany() replaces inany_pton() which again
will become more convenient for strings including IPs that aren't just
an IP.

For now we only have some simple and sometimes awkward use cases,
we'll replace these with more natural uses in future.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
parse_ipv[46]() are wrappers around inet_pton() that are more
convenient for use when the IP is part of a longer string, rather than
the entire string.  parse_inany() replaces inany_pton() which again
will become more convenient for strings including IPs that aren't just
an IP.

For now we only have some simple and sometimes awkward use cases,
we'll replace these with more natural uses in future.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>parse: Add helper to parse unsigned integer values</title>
<updated>2026-07-04T11:14:04+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2026-07-03T03:54:38+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=8ffff9b9fca92afb785a37ddde1397805122befc'/>
<id>8ffff9b9fca92afb785a37ddde1397805122befc</id>
<content type='text'>
Most places we need to parse an integer encoded as a string, we use
strtol() or strtoul().  These already work a bit like descent parser
helpers, in that they consume as much as they can, but don't require the
number parsed to be the whole of the einput string.  Make a wrapper to
parse unsigned integers as part of our parsing helper.  This wrapper
handles the mildly fiddly error checking requirements for strtoul().

We replace a number, though not all, of our existing strtoul() uses with
the new parse_unsigned().  We also replace a number of strtol() use cases,
because, despite using that instead of strtoul() they are only used for
non-negative values.  In some cases this makes the logic a little more
straightforward.  In some other cases it will catch some error cases we
previously could have missed.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Most places we need to parse an integer encoded as a string, we use
strtol() or strtoul().  These already work a bit like descent parser
helpers, in that they consume as much as they can, but don't require the
number parsed to be the whole of the einput string.  Make a wrapper to
parse unsigned integers as part of our parsing helper.  This wrapper
handles the mildly fiddly error checking requirements for strtoul().

We replace a number, though not all, of our existing strtoul() uses with
the new parse_unsigned().  We also replace a number of strtol() use cases,
because, despite using that instead of strtoul() they are only used for
non-negative values.  In some cases this makes the logic a little more
straightforward.  In some other cases it will catch some error cases we
previously could have missed.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>parse: Start splitting out parsing helpers</title>
<updated>2026-07-04T11:13:56+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2026-07-03T03:54:35+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=d29eb296a3004d435914d8be05d3bdb9e44bc755'/>
<id>d29eb296a3004d435914d8be05d3bdb9e44bc755</id>
<content type='text'>
As we add more complexity to what forwarding rules are allowed, our
existing ad-hoc C parsing is starting to become quite awkward.  We already
have some parts that resemble a very simple recursive[0] descent parser,
with composable subfunctions that consume as much input as they need,
rather than pre-splitting based on known delimiters.

Start extending this approach, by creating parse.[ch] with parsing helpers
with a uniform interface.  Initially we start with very simple cases: the
parse_keyword() function from fwd_rule.c and another helper to check that
we've reached the end of input.

Rename parse_keyword() to parse_literal(), because it's not just useful
for "keywords" as such.  We can use it in a bunch of additional places for
parsing delimiters and other symbols.  This doesn't gain us a lot now but
will make things clearer as we use more such parser helpers.

[0] Except that the grammars we have aren't actually recursive, so neither
    is the code.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&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 we add more complexity to what forwarding rules are allowed, our
existing ad-hoc C parsing is starting to become quite awkward.  We already
have some parts that resemble a very simple recursive[0] descent parser,
with composable subfunctions that consume as much input as they need,
rather than pre-splitting based on known delimiters.

Start extending this approach, by creating parse.[ch] with parsing helpers
with a uniform interface.  Initially we start with very simple cases: the
parse_keyword() function from fwd_rule.c and another helper to check that
we've reached the end of input.

Rename parse_keyword() to parse_literal(), because it's not just useful
for "keywords" as such.  We can use it in a bunch of additional places for
parsing delimiters and other symbols.  This doesn't gain us a lot now but
will make things clearer as we use more such parser helpers.

[0] Except that the grammars we have aren't actually recursive, so neither
    is the code.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Makefile: Add missing PESTO_HEADERS variable</title>
<updated>2026-07-04T11:13:50+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2026-07-03T03:54:33+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=e51a545f3b68b60c1488a13061fec54e01236e47'/>
<id>e51a545f3b68b60c1488a13061fec54e01236e47</id>
<content type='text'>
In several places we use a PESTO_HEADERS variable, with all the headers
that we need to build the pesto binary.  However, we never define it.
This looks like an error introduced by a bad rebase of the series
introducing pesto before it was merged.

It turns out the fact we didn't list the headers was the only reason we
weren't getting unusedStructMember cppcheck warnings for pesto as we
already do for passt and passt-repair.  So, reinstate that suppression for
pesto as well.

Fixes: 02236db32625 ("pesto: Introduce stub configuration tool")
Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In several places we use a PESTO_HEADERS variable, with all the headers
that we need to build the pesto binary.  However, we never define it.
This looks like an error introduced by a bad rebase of the series
introducing pesto before it was merged.

It turns out the fact we didn't list the headers was the only reason we
weren't getting unusedStructMember cppcheck warnings for pesto as we
already do for passt and passt-repair.  So, reinstate that suppression for
pesto as well.

Fixes: 02236db32625 ("pesto: Introduce stub configuration tool")
Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Makefile: Remove unused DUAL_STACK_SOCKETS define</title>
<updated>2026-06-16T21:49:55+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2026-06-16T01:09:34+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=d5ef43da648dbd83db1feddd662cdb8e095b8c11'/>
<id>d5ef43da648dbd83db1feddd662cdb8e095b8c11</id>
<content type='text'>
We have a make variable DUAL_STACK_SOCKETS which used to determine whether
we'd use dual stack sockets.  When we introduced it we were concerned that
we might have future ports to systems which did not support them.

We've since discovered that the dual stack interface is described in
RFC 3493, and supported by both Windows and BSD.  Platforms sometimes
differ in the default setting for the IPV6_V6ONLY socket option, but the
feature itself is widely supported.  So, since b8d4fac6a2e7 ("util, pif:
Replace sock_l4() with pif_sock_l4()") we've simply assumed its presence.

The makefile still defines the now unused variable, though.  Remove it.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We have a make variable DUAL_STACK_SOCKETS which used to determine whether
we'd use dual stack sockets.  When we introduced it we were concerned that
we might have future ports to systems which did not support them.

We've since discovered that the dual stack interface is described in
RFC 3493, and supported by both Windows and BSD.  Platforms sometimes
differ in the default setting for the IPV6_V6ONLY socket option, but the
feature itself is widely supported.  So, since b8d4fac6a2e7 ("util, pif:
Replace sock_l4() with pif_sock_l4()") we've simply assumed its presence.

The makefile still defines the now unused variable, though.  Remove it.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cppcheck: Remove unused CPPCHECK_6936</title>
<updated>2026-06-16T21:49:24+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2026-06-15T08:18:29+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=96c4a9db57118e4dccb6489bf93ed763ca3f18a5'/>
<id>96c4a9db57118e4dccb6489bf93ed763ca3f18a5</id>
<content type='text'>
Our flags for cppcheck include -D CPPCHECK_6936.  This used to enable a
workaround for a cppcheck bug, but the code where we used it went away
in commit 9153aca15bc1.  Remove the now unused flag.

Fixes: 9153aca15bc1 ("util: Add abort_with_msg() and ASSERT_WITH_MSG() helpers")
Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Our flags for cppcheck include -D CPPCHECK_6936.  This used to enable a
workaround for a cppcheck bug, but the code where we used it went away
in commit 9153aca15bc1.  Remove the now unused flag.

Fixes: 9153aca15bc1 ("util: Add abort_with_msg() and ASSERT_WITH_MSG() helpers")
Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Makefile: Remove misleading comments on BASE_*FLAGS</title>
<updated>2026-05-26T10:15:44+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2026-05-20T02:00:55+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=cea2d19329eb0088a738c60b92ddc06dcf50a4cd'/>
<id>cea2d19329eb0088a738c60b92ddc06dcf50a4cd</id>
<content type='text'>
I added these comments attempting to describe the difference between
BASE_CFLAGS and CFLAGS.  However, the description given isn't really
accurate, and I'm not even sure the concept I'm trying to describe is
coherent.  Just remove it.

Suggested-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I added these comments attempting to describe the difference between
BASE_CFLAGS and CFLAGS.  However, the description given isn't really
accurate, and I'm not even sure the concept I'm trying to describe is
coherent.  Just remove it.

Suggested-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pesto: Run static checkers on pesto sources</title>
<updated>2026-05-16T13:47:11+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2026-05-12T05:52:56+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=9b1ef47c1c27b7637e1442934f19fcdcdc3e1628'/>
<id>9b1ef47c1c27b7637e1442934f19fcdcdc3e1628</id>
<content type='text'>
Update the Makefile to run both clang-tidy and cppcheck on pesto as well
as on passt and passt-repair.  This requires a couple of secondary
corrections:
  * pesto.c had an inline suppression that is no longer correct now that
    the protocol version has been bumped to 1.  Remove it.
  * We were globally suppressing the unusedStructMember because it
    hit many false positives on both passt and passt-repair.  It doesn't
    in pesto, meaning it instead creates an unusedSuppression warning.
    Apply the suppression as a flag override for passt and passt-repair,
    instead of globally.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Update the Makefile to run both clang-tidy and cppcheck on pesto as well
as on passt and passt-repair.  This requires a couple of secondary
corrections:
  * pesto.c had an inline suppression that is no longer correct now that
    the protocol version has been bumped to 1.  Remove it.
  * We were globally suppressing the unusedStructMember because it
    hit many false positives on both passt and passt-repair.  It doesn't
    in pesto, meaning it instead creates an unusedSuppression warning.
    Apply the suppression as a flag override for passt and passt-repair,
    instead of globally.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>passt-repair: Run static checkers</title>
<updated>2026-05-16T13:47:08+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2026-05-12T05:52:55+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=bf639709726346f24362b09c065e39ae2cf73ea6'/>
<id>bf639709726346f24362b09c065e39ae2cf73ea6</id>
<content type='text'>
Run the static checkers, cppcheck and clang-tidy on passt-repair as well
as on passt proper.  This shows up handful of remaining minor warnings,
which we correct.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Run the static checkers, cppcheck and clang-tidy on passt-repair as well
as on passt proper.  This shows up handful of remaining minor warnings,
which we correct.

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