public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH v2 00/13] Rework option parsing in preparation for destination remapping
@ 2026-07-01  5:31 David Gibson
  2026-07-01  5:31 ` [PATCH v2 01/13] Makefile: Add missing PESTO_HEADERS variable David Gibson
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: David Gibson @ 2026-07-01  5:31 UTC (permalink / raw)
  To: Stefano Brivio, passt-dev; +Cc: David Gibson

This was... a bit of a nightmare.  It took way too long and went down
a bunch of blind alleys.  I'm not sure how much I like the final
result: it's pleasingly terse in some cases, but in others it feels
dangerously subtle, requiring a pretty careful understanding of the
sequencing rules of C's &&, || and , operators.

That said, while I was at many points ready to pack it in and hack my
around the problems limiting the parsing for destination remapping, I
couldn't really think of feasible way to do that either.  So, here we
are.

v2:
 * Numerous minor tweaks based on Stefano's feedback.
 * The "minor issues" aren't actually minor - they're hard to solve in
   C, remain.

David Gibson (13):
  Makefile: Add missing PESTO_HEADERS variable
  conf: Use parameter instead of global in conf_nat()
  parse: Start splitting out parsing helpers
  conf: Remove duplicate parsing of -F option
  conf: Clean up conf_ip4_prefix()
  parse: Add helper to parse unsigned integer values
  parse: Move parse_port_range() to new parsing framework
  parse: Add helpers for parsing IP addresses
  conf: Move address configuration into helper function
  conf: Remove unnecessary mode checks from conf_addr()
  conf: Use new parsing tools to handle -a option
  fwd_rule: Allow "all" port specs to be combined with other options
  fwd_rule: Rewrite forward rule parsing using parse.c helpers

 Makefile   |  22 +--
 common.h   |   3 +
 conf.c     | 209 ++++++++++++++++------------
 conf.h     |   1 +
 fwd_rule.c | 398 +++++++++++++++++++++++------------------------------
 fwd_rule.h |   2 -
 inany.c    |  70 +---------
 inany.h    |   3 -
 parse.c    | 244 ++++++++++++++++++++++++++++++++
 parse.h    |  37 +++++
 util.c     |  12 +-
 11 files changed, 598 insertions(+), 403 deletions(-)
 create mode 100644 parse.c
 create mode 100644 parse.h

-- 
2.54.0


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-07-01  5:32 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-01  5:31 [PATCH v2 00/13] Rework option parsing in preparation for destination remapping David Gibson
2026-07-01  5:31 ` [PATCH v2 01/13] Makefile: Add missing PESTO_HEADERS variable David Gibson
2026-07-01  5:31 ` [PATCH v2 02/13] conf: Use parameter instead of global in conf_nat() David Gibson
2026-07-01  5:31 ` [PATCH v2 03/13] parse: Start splitting out parsing helpers David Gibson
2026-07-01  5:31 ` [PATCH v2 04/13] conf: Remove duplicate parsing of -F option David Gibson
2026-07-01  5:31 ` [PATCH v2 05/13] conf: Clean up conf_ip4_prefix() David Gibson
2026-07-01  5:31 ` [PATCH v2 06/13] parse: Add helper to parse unsigned integer values David Gibson
2026-07-01  5:31 ` [PATCH v2 07/13] parse: Move parse_port_range() to new parsing framework David Gibson
2026-07-01  5:31 ` [PATCH v2 08/13] parse: Add helpers for parsing IP addresses David Gibson
2026-07-01  5:31 ` [PATCH v2 09/13] conf: Move address configuration into helper function David Gibson
2026-07-01  5:31 ` [PATCH v2 10/13] conf: Remove unnecessary mode checks from conf_addr() David Gibson
2026-07-01  5:31 ` [PATCH v2 11/13] conf: Use new parsing tools to handle -a option David Gibson
2026-07-01  5:31 ` [PATCH v2 12/13] fwd_rule: Allow "all" port specs to be combined with other options David Gibson
2026-07-01  5:31 ` [PATCH v2 13/13] fwd_rule: Rewrite forward rule parsing using parse.c helpers David Gibson

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).