From: Wietse Venema
Date: Sun, 24 Sep 2023 05:00:00 +0000 (-0500)
Subject: postfix-3.9-20230924
X-Git-Tag: v3.9.0~39
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba84e1106d8c8e29d11d0e452ad8567258205903;p=thirdparty%2Fpostfix.git
postfix-3.9-20230924
---
diff --git a/postfix/HISTORY b/postfix/HISTORY
index 14c278457..4471f993e 100644
--- a/postfix/HISTORY
+++ b/postfix/HISTORY
@@ -27422,3 +27422,12 @@ Apologies for any names omitted.
localpart, as in "-t localpart+@domain" or "-t localpart+"
where "+" is the Postfix recipient address delimiter. File:
smtpstone/smtp-source.c.
+
+20230924
+
+ Cleanup: simplified the smtp-source numbered recipient
+ implementation and documentation. File: smtpstone/smtp-source.c.
+
+ Documentation: added smtp_balance_inet_protocols to the
+ text with smtp_address_preference caveats. File:
+ proto/postconf.proto.
diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html
index 123d018fe..e3954b467 100644
--- a/postfix/html/postconf.5.html
+++ b/postfix/html/postconf.5.html
@@ -10949,11 +10949,15 @@ IPv6 connectivity:
-
The setting "smtp_address_preference = ipv6" is unsafe.
-It can fail to deliver mail when there is an outage that affects
-IPv6, while the destination is still reachable over IPv4.
+All deliveries will suffer delays when IPv6 is not available even
+while the destination is still reachable over IPv4. Mail may be
+stuck in the queue with Postfix versions < 3.3 that do not
+implement "smtp_balance_inet_protocols". For similar reasons, the
+setting "smtp_address_preference = ipv4" is also unsafe.
-
The setting "smtp_address_preference = any" is safe. With
-this, mail will eventually be delivered even if there is an outage
+this, and "smtp_balance_inet_protocols = yes" (the default), only
+half of deliveries will suffer delays if there is an outage
that affects IPv6 or IPv4, as long as it does not affect both.
diff --git a/postfix/html/smtp-source.1.html b/postfix/html/smtp-source.1.html
index 2e4b71a0d..63119715d 100644
--- a/postfix/html/smtp-source.1.html
+++ b/postfix/html/smtp-source.1.html
@@ -49,7 +49,7 @@ SMTP-SOURCE(1) SMTP-SOURCE(1)
over the same connection.
-f from
- Use the specified sender address (default: <foo@myhostname>).
+ Use the specified sender address (default: <foo@my-hostname>).
-F file
Send the pre-formatted message header and body in the specified
@@ -65,61 +65,65 @@ SMTP-SOURCE(1) SMTP-SOURCE(1)
-m message_count
Send the specified number of messages (default: 1).
- -M myhostname
+ -M my-hostname
Use the specified hostname or [address] in the HELO command and
in the default sender and recipient addresses, instead of the
machine hostname.
-N Generate each recipient address by appending a number (a
per-process recipient counter) to the recipient address local-
- part specified with the -t option. This avoids an artificial
- 100% hit rate in the trivial-rewrite daemon's resolve and re-
- write client caches, better approximating Postfix performance
- under real-life work-loads.
+ part specified with the -t option.
- Note: to use the number as an address extension, specify an
- explicit address delimiter at the end of the recipient local-
+ Note: to use the number as an address extension, specify an
+ explicit address delimiter at the end of the recipient local-
part, as in "-t localpart+@domain" or "-t localpart+", where "+"
- is the recipient address delimiter.
+ is a Postfix recipient address delimiter.
+
+ Benefits:
+
+ o A non-constant recipient address avoids an unrealistic
+ 100% cache hit rate in clients of the Postfix trivial-re-
+ write service, better approximating performance under
+ real-life work-loads.
+
+ o A fixed recipient address local-part with a non-constant
+ address extension avoids the need to configure a large
+ number of valid recipient addresses in the receiving
+ Postfix server.
-o Old mode: don't send HELO, and don't send message headers.
-r recipient_count
- Send the specified number of recipients per transaction
- (default: 1). Generate each recipient address by appending a
- number (a per-connection recipient counter) to the recipient
- address localpart specified with the -t option.
-
- Note: to use the number as an address extension, specify an
- explicit address delimiter at the end of the recipient local-
- part, as in "-t localpart+@domain" or "-t localpart+", where "+"
- is the recipient address delimiter.
+ Send the specified number of recipients per transaction
+ (default: 1), and generate recipient addresses as described
+ under the -N option.
-R interval
- Wait a random time (0 <= n <= interval) between messages. Sus-
+ Wait a random time (0 <= n <= interval) between messages. Sus-
pending one thread does not affect other delivery threads.
-s session_count
- Run the specified number of SMTP sessions in parallel (default:
+ Run the specified number of SMTP sessions in parallel (default:
1).
-S subject
Send mail with the named subject line (default: none).
- -t to Use the specified recipient address (default: <foo@myhostname>).
+ -t to Use the specified recipient address (default: <foo@my-host-
+ name>).
-T windowsize
- Override the default TCP window size. To work around broken TCP
+ Override the default TCP window size. To work around broken TCP
window scaling implementations, specify a value > 0 and < 65536.
-v Make the program more verbose, for debugging purposes.
-w interval
- Wait a fixed time between messages. Suspending one thread does
+ Wait a fixed time between messages. Suspending one thread does
not affect other delivery threads.
[inet:]host[:port]
- Connect via TCP to host host, port port. The default port is
+ Connect via TCP to host host, port port. The default port is
smtp.
unix:pathname
diff --git a/postfix/man/man1/smtp-source.1 b/postfix/man/man1/smtp-source.1
index cd5bef089..238bc2832 100644
--- a/postfix/man/man1/smtp-source.1
+++ b/postfix/man/man1/smtp-source.1
@@ -48,7 +48,7 @@ when the listen queue is full.
Don't disconnect after sending a message; send the next
message over the same connection.
.IP "\fB\-f \fIfrom\fR"
-Use the specified sender address (default: ).
+Use the specified sender address (default: ).
.IP "\fB\-F \fIfile\fR"
Send the pre\-formatted message header and body in the
specified \fIfile\fR, while prepending '.' before lines that
@@ -60,36 +60,40 @@ include message headers.
Speak LMTP rather than SMTP.
.IP "\fB\-m \fImessage_count\fR"
Send the specified number of messages (default: 1).
-.IP "\fB\-M \fImyhostname\fR"
+.IP "\fB\-M \fImy\-hostname\fR"
Use the specified hostname or [address] in the HELO command
and in the default sender and recipient addresses, instead
of the machine hostname.
.IP "\fB\-N\fR"
Generate each recipient address by appending a number (a
per\-process recipient counter) to the recipient address
-localpart specified with the \fB\-t\fR option. This avoids
-an artificial 100% hit rate in the trivial\-rewrite daemon's
-resolve and rewrite client caches, better approximating
-Postfix performance under real\-life work\-loads.
+localpart specified with the \fB\-t\fR option.
Note: to use the number as an address extension, specify
an explicit address delimiter at the end of the recipient
localpart, as in "\fB\-t localpart+@domain\fR" or "\fB\-t
-localpart+\fR", where "\fB+\fR" is the recipient address
-delimiter.
+localpart+\fR", where "\fB+\fR" is a Postfix recipient
+address delimiter.
+
+Benefits:
+.RS
+.IP \(bu
+A non\-constant recipient address avoids an unrealistic 100%
+cache hit rate in clients of the Postfix trivial\-rewrite
+service, better approximating performance under real\-life
+work\-loads.
+.IP \(bu
+A fixed recipient address local\-part with a non\-constant
+address extension avoids the need to configure a large
+number of valid recipient addresses in the receiving Postfix
+server.
+.RE
.IP \fB\-o\fR
Old mode: don't send HELO, and don't send message headers.
.IP "\fB\-r \fIrecipient_count\fR"
-Send the specified number of recipients per transaction (default: 1).
-Generate each recipient address by appending a number (a
-per\-connection recipient counter) to the recipient address
-localpart specified with the \fB\-t\fR option.
-
-Note: to use the number as an address extension, specify
-an explicit address delimiter at the end of the recipient
-localpart, as in "\fB\-t localpart+@domain\fR" or "\fB\-t
-localpart+\fR", where "\fB+\fR" is the recipient address
-delimiter.
+Send the specified number of recipients per transaction
+(default: 1), and generate recipient addresses as described
+under the \fB\-N\fR option.
.IP "\fB\-R \fIinterval\fR"
Wait a random time (0 <= n <= \fIinterval\fR) between messages.
Suspending one thread does not affect other delivery threads.
@@ -98,7 +102,7 @@ Run the specified number of SMTP sessions in parallel (default: 1).
.IP "\fB\-S \fIsubject\fR"
Send mail with the named subject line (default: none).
.IP "\fB\-t \fIto\fR"
-Use the specified recipient address (default: ).
+Use the specified recipient address (default: ).
.IP "\fB\-T \fIwindowsize\fR"
Override the default TCP window size. To work around
broken TCP window scaling implementations, specify a
diff --git a/postfix/man/man5/postconf.5 b/postfix/man/man5/postconf.5
index 496f2e3c0..0f25fdd2d 100644
--- a/postfix/man/man5/postconf.5
+++ b/postfix/man/man5/postconf.5
@@ -6966,11 +6966,15 @@ Notes for mail delivery between sites that have both IPv4 and
IPv6 connectivity:
.IP \(bu
The setting "smtp_address_preference = ipv6" is unsafe.
-It can fail to deliver mail when there is an outage that affects
-IPv6, while the destination is still reachable over IPv4.
+All deliveries will suffer delays when IPv6 is not available even
+while the destination is still reachable over IPv4. Mail may be
+stuck in the queue with Postfix versions < 3.3 that do not
+implement "smtp_balance_inet_protocols". For similar reasons, the
+setting "smtp_address_preference = ipv4" is also unsafe.
.IP \(bu
The setting "smtp_address_preference = any" is safe. With
-this, mail will eventually be delivered even if there is an outage
+this, and "smtp_balance_inet_protocols = yes" (the default), only
+half of deliveries will suffer delays if there is an outage
that affects IPv6 or IPv4, as long as it does not affect both.
.br
.PP
diff --git a/postfix/proto/postconf.proto b/postfix/proto/postconf.proto
index 6a0a52b93..ce17251c6 100644
--- a/postfix/proto/postconf.proto
+++ b/postfix/proto/postconf.proto
@@ -15023,11 +15023,15 @@ IPv6 connectivity:
-
The setting "smtp_address_preference = ipv6" is unsafe.
-It can fail to deliver mail when there is an outage that affects
-IPv6, while the destination is still reachable over IPv4.
+All deliveries will suffer delays when IPv6 is not available even
+while the destination is still reachable over IPv4. Mail may be
+stuck in the queue with Postfix versions < 3.3 that do not
+implement "smtp_balance_inet_protocols". For similar reasons, the
+setting "smtp_address_preference = ipv4" is also unsafe.
-
The setting "smtp_address_preference = any" is safe. With
-this, mail will eventually be delivered even if there is an outage
+this, and "smtp_balance_inet_protocols = yes" (the default), only
+half of deliveries will suffer delays if there is an outage
that affects IPv6 or IPv4, as long as it does not affect both.
diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h
index 49b73e3f2..c667582b4 100644
--- a/postfix/src/global/mail_version.h
+++ b/postfix/src/global/mail_version.h
@@ -20,7 +20,7 @@
* Patches change both the patchlevel and the release date. Snapshots have no
* patchlevel; they change the release date only.
*/
-#define MAIL_RELEASE_DATE "20230923"
+#define MAIL_RELEASE_DATE "20230924"
#define MAIL_VERSION_NUMBER "3.9"
#ifdef SNAPSHOT
diff --git a/postfix/src/smtpstone/smtp-source.c b/postfix/src/smtpstone/smtp-source.c
index ca8ec54ee..f9fa64f2b 100644
--- a/postfix/src/smtpstone/smtp-source.c
+++ b/postfix/src/smtpstone/smtp-source.c
@@ -42,7 +42,7 @@
/* Don't disconnect after sending a message; send the next
/* message over the same connection.
/* .IP "\fB-f \fIfrom\fR"
-/* Use the specified sender address (default: ).
+/* Use the specified sender address (default: ).
/* .IP "\fB-F \fIfile\fR"
/* Send the pre-formatted message header and body in the
/* specified \fIfile\fR, while prepending '.' before lines that
@@ -54,36 +54,40 @@
/* Speak LMTP rather than SMTP.
/* .IP "\fB-m \fImessage_count\fR"
/* Send the specified number of messages (default: 1).
-/* .IP "\fB-M \fImyhostname\fR"
+/* .IP "\fB-M \fImy-hostname\fR"
/* Use the specified hostname or [address] in the HELO command
/* and in the default sender and recipient addresses, instead
/* of the machine hostname.
/* .IP "\fB-N\fR"
/* Generate each recipient address by appending a number (a
/* per-process recipient counter) to the recipient address
-/* localpart specified with the \fB-t\fR option. This avoids
-/* an artificial 100% hit rate in the trivial-rewrite daemon's
-/* resolve and rewrite client caches, better approximating
-/* Postfix performance under real-life work-loads.
+/* localpart specified with the \fB-t\fR option.
/*
/* Note: to use the number as an address extension, specify
/* an explicit address delimiter at the end of the recipient
/* localpart, as in "\fB-t localpart+@domain\fR" or "\fB-t
-/* localpart+\fR", where "\fB+\fR" is the recipient address
-/* delimiter.
+/* localpart+\fR", where "\fB+\fR" is a Postfix recipient
+/* address delimiter.
+/*
+/* Benefits:
+/* .RS
+/* .IP \(bu
+/* A non-constant recipient address avoids an unrealistic 100%
+/* cache hit rate in clients of the Postfix trivial-rewrite
+/* service, better approximating performance under real-life
+/* work-loads.
+/* .IP \(bu
+/* A fixed recipient address local-part with a non-constant
+/* address extension avoids the need to configure a large
+/* number of valid recipient addresses in the receiving Postfix
+/* server.
+/* .RE
/* .IP \fB-o\fR
/* Old mode: don't send HELO, and don't send message headers.
/* .IP "\fB-r \fIrecipient_count\fR"
-/* Send the specified number of recipients per transaction (default: 1).
-/* Generate each recipient address by appending a number (a
-/* per-connection recipient counter) to the recipient address
-/* localpart specified with the \fB-t\fR option.
-/*
-/* Note: to use the number as an address extension, specify
-/* an explicit address delimiter at the end of the recipient
-/* localpart, as in "\fB-t localpart+@domain\fR" or "\fB-t
-/* localpart+\fR", where "\fB+\fR" is the recipient address
-/* delimiter.
+/* Send the specified number of recipients per transaction
+/* (default: 1), and generate recipient addresses as described
+/* under the \fB-N\fR option.
/* .IP "\fB-R \fIinterval\fR"
/* Wait a random time (0 <= n <= \fIinterval\fR) between messages.
/* Suspending one thread does not affect other delivery threads.
@@ -92,7 +96,7 @@
/* .IP "\fB-S \fIsubject\fR"
/* Send mail with the named subject line (default: none).
/* .IP "\fB-t \fIto\fR"
-/* Use the specified recipient address (default: ).
+/* Use the specified recipient address (default: ).
/* .IP "\fB-T \fIwindowsize\fR"
/* Override the default TCP window size. To work around
/* broken TCP window scaling implementations, specify a
@@ -163,7 +167,6 @@
#include
#include
#include
-#include
/* Global library. */
@@ -187,6 +190,7 @@ typedef struct SESSION {
int rcpt_done; /* # of recipients done */
int rcpt_count; /* # of recipients to go */
int rcpt_accepted; /* # of recipients accepted */
+ int rcpt_sample; /* Sample recipient # for To: header */
VSTREAM *stream; /* open connection */
int connect_count; /* # of connect()s to retry */
struct SESSION *next; /* connect() queue linkage */
@@ -216,7 +220,6 @@ static struct sockaddr_un sun;
static struct sockaddr *sa;
static int sa_length;
static int recipients = 1;
-static int session_rcpt_suffix = 0;
static char *defaddr;
typedef struct {
char *local;
@@ -690,12 +693,10 @@ static void send_rcpt(int unused_event, void *context)
if ((except = vstream_setjmp(session->stream)) != 0)
msg_fatal("%s while sending recipient", exception_text(except));
- if (session_rcpt_suffix)
+ if (global_rcpt_suffix)
command(session->stream, "RCPT TO:<%s%d%s>",
- recipient->local, session->rcpt_done, recipient->at_domain);
- else if (global_rcpt_suffix)
- command(session->stream, "RCPT TO:<%s%d%s>",
- recipient->local, global_rcpt_done++, recipient->at_domain);
+ recipient->local, session->rcpt_sample = global_rcpt_done++,
+ recipient->at_domain);
else
command(session->stream, "RCPT TO:<%s%s>",
recipient->local, recipient->at_domain);
@@ -805,10 +806,7 @@ static void data_done(int unused, void *context)
smtp_printf(session->stream, "From: <%s>", sender);
if (global_rcpt_suffix)
smtp_printf(session->stream, "To: <%s%d%s>", recipient->local,
- global_rcpt_done - 1, recipient->at_domain);
- else if (session_rcpt_suffix)
- smtp_printf(session->stream, "To: <%s%d%s>", recipient->local,
- session->rcpt_done - 1, recipient->at_domain);
+ session->rcpt_sample, recipient->at_domain);
else
smtp_printf(session->stream, "To: <%s%s>",
recipient->local, recipient->at_domain);
@@ -1068,8 +1066,6 @@ int main(int argc, char **argv)
var_myhostname = optarg;
break;
case 'N':
- if (session_rcpt_suffix)
- msg_fatal("do not use -N and -r options at the same time");
global_rcpt_suffix = 1;
break;
case 'o':
@@ -1077,13 +1073,9 @@ int main(int argc, char **argv)
send_headers = 0;
break;
case 'r':
- if (global_rcpt_suffix)
- msg_fatal("do not use -N and -r options at the same time");
- if (session_rcpt_suffix)
- msg_fatal("do not use -r option multiple times");
if ((recipients = atoi(optarg)) <= 0)
msg_fatal("bad recipient count: %s", optarg);
- session_rcpt_suffix = 1;
+ global_rcpt_suffix = 1;
break;
case 'R':
if (fixed_delay > 0)