]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-3.9-20230924
authorWietse Venema <wietse@porcupine.org>
Sun, 24 Sep 2023 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <ietf-dane@dukhovni.org>
Mon, 25 Sep 2023 13:53:09 +0000 (09:53 -0400)
postfix/HISTORY
postfix/html/postconf.5.html
postfix/html/smtp-source.1.html
postfix/man/man1/smtp-source.1
postfix/man/man5/postconf.5
postfix/proto/postconf.proto
postfix/src/global/mail_version.h
postfix/src/smtpstone/smtp-source.c

index 14c278457bc6eb02e2350d37b3bfe71008014a1d..4471f993e7dafec9129af598d2bc287e5b64adea 100644 (file)
@@ -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.
index 123d018fe47652fec4dbb2aecada6ebe9558e606..e3954b4674ab95d9c4915bbbbf411d44640a017a 100644 (file)
@@ -10949,11 +10949,15 @@ IPv6 connectivity: </p>
 <ul>
 
 <li> <p> The setting "<a href="postconf.5.html#smtp_address_preference">smtp_address_preference</a> = 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. </p>
+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 &lt; 3.3 that do not
+implement "<a href="postconf.5.html#smtp_balance_inet_protocols">smtp_balance_inet_protocols</a>". For similar reasons, the
+setting "<a href="postconf.5.html#smtp_address_preference">smtp_address_preference</a> = ipv4" is also unsafe. </p>
 
 <li> <p> The setting "<a href="postconf.5.html#smtp_address_preference">smtp_address_preference</a> = any" is safe. With
-this, mail will eventually be delivered even if there is an outage
+this, and "<a href="postconf.5.html#smtp_balance_inet_protocols">smtp_balance_inet_protocols</a> = 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. </p>
 
 </ul>
index 2e4b71a0d45d76d296410616252a03a7a5e5b10a..63119715d0d899ac8c1bcaefa1171839a436d90d 100644 (file)
@@ -49,7 +49,7 @@ SMTP-SOURCE(1)                                                  SMTP-SOURCE(1)
               over the same connection.
 
        <b>-f</b> <i>from</i>
-              Use the specified sender address (default: &lt;foo@<a href="postconf.5.html#myhostname">myhostname</a>&gt;).
+              Use the specified sender address (default: &lt;foo@my-hostname&gt;).
 
        <b>-F</b> <i>file</i>
               Send the pre-formatted message header and body in the  specified
@@ -65,61 +65,65 @@ SMTP-SOURCE(1)                                                  SMTP-SOURCE(1)
        <b>-m</b> <i>message</i><b>_</b><i>count</i>
               Send the specified number of messages (default: 1).
 
-       <b>-M</b> <i><a href="postconf.5.html#myhostname">myhostname</a></i>
+       <b>-M</b> <i>my-hostname</i>
               Use  the specified hostname or [address] in the HELO command and
               in the default sender and recipient addresses,  instead  of  the
               machine hostname.
 
        <b>-N</b>     Generate  each  recipient  address  by  appending  a  number  (a
               per-process recipient counter) to the recipient  address  local-
-              part  specified  with  the  <b>-t</b> 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 <b>-t</b> 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 "<b>-t localpart+@domain</b>" or "<b>-t localpart+</b>", where "<b>+</b>"
-              is the recipient address delimiter.
+              is a Postfix recipient address delimiter.
+
+              Benefits:
+
+              <b>o</b>      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.
+
+              <b>o</b>      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.
 
        <b>-o</b>     Old mode: don't send HELO, and don't send message headers.
 
        <b>-r</b> <i>recipient</i><b>_</b><i>count</i>
-              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 <b>-t</b> 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 "<b>-t localpart+@domain</b>" or "<b>-t localpart+</b>", where "<b>+</b>"
-              is the recipient address delimiter.
+              Send  the  specified  number  of  recipients   per   transaction
+              (default:  1),  and  generate  recipient  addresses as described
+              under the <b>-N</b> option.
 
        <b>-R</b> <i>interval</i>
-              Wait  a random time (0 &lt;= n &lt;= <i>interval</i>) between messages.  Sus-
+              Wait a random time (0 &lt;= n &lt;= <i>interval</i>) between messages.   Sus-
               pending one thread does not affect other delivery threads.
 
        <b>-s</b> <i>session</i><b>_</b><i>count</i>
-              Run the specified number of SMTP sessions in parallel  (default:
+              Run  the specified number of SMTP sessions in parallel (default:
               1).
 
        <b>-S</b> <i>subject</i>
               Send mail with the named subject line (default: none).
 
-       <b>-t</b> <i>to</i>  Use the specified recipient address (default: &lt;foo@<a href="postconf.5.html#myhostname">myhostname</a>&gt;).
+       <b>-t</b> <i>to</i>  Use the  specified  recipient  address  (default:  &lt;foo@my-host-
+              name&gt;).
 
        <b>-T</b> <i>windowsize</i>
-              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 &gt; 0 and &lt; 65536.
 
        <b>-v</b>     Make the program more verbose, for debugging purposes.
 
        <b>-w</b> <i>interval</i>
-              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.
 
        [<b>inet:</b>]<i>host</i>[:<i>port</i>]
-              Connect  via  TCP  to  host <i>host</i>, port <i>port</i>. The default port is
+              Connect via TCP to host <i>host</i>, port <i>port</i>.  The  default  port  is
               <b>smtp</b>.
 
        <b>unix:</b><i>pathname</i>
index cd5bef089442486ec1d46c528ce7e1b1e9ab74b9..238bc2832be17f1293d928d26452101c5deb7430 100644 (file)
@@ -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: <foo@myhostname>).
+Use the specified sender address (default: <foo@my\-hostname>).
 .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: <foo@myhostname>).
+Use the specified recipient address (default: <foo@my\-hostname>).
 .IP "\fB\-T \fIwindowsize\fR"
 Override the default TCP window size. To work around
 broken TCP window scaling implementations, specify a
index 496f2e3c0c5040b244aff09a829f9397950df62d..0f25fdd2dce983b71c9974874756fb8fc65d8374 100644 (file)
@@ -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
index 6a0a52b939fa8cca9144e5ca3a588632a1fe81bb..ce17251c6a014d8b5d8b7ea8c5e873ae1331b10b 100644 (file)
@@ -15023,11 +15023,15 @@ IPv6 connectivity: </p>
 <ul>
 
 <li> <p> 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. </p>
+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 &lt; 3.3 that do not
+implement "smtp_balance_inet_protocols". For similar reasons, the
+setting "smtp_address_preference = ipv4" is also unsafe. </p>
 
 <li> <p> 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. </p>
 
 </ul>
index 49b73e3f2d360fdbe5bb2eb1e633437179e0886f..c667582b49161326c8411009f010f7c1cd1710b7 100644 (file)
@@ -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
index ca8ec54ee239c42bc402b5d0c4279c1164a92089..f9fa64f2b0c3544e580af5587a240394107eed86 100644 (file)
@@ -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: <foo@myhostname>).
+/*     Use the specified sender address (default: <foo@my-hostname>).
 /* .IP "\fB-F \fIfile\fR"
 /*     Send the pre-formatted message header and body in the
 /*     specified \fIfile\fR, while prepending '.' before lines that
 /*     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: <foo@myhostname>).
+/*     Use the specified recipient address (default: <foo@my-hostname>).
 /* .IP "\fB-T \fIwindowsize\fR"
 /*     Override the default TCP window size. To work around
 /*     broken TCP window scaling implementations, specify a
 #include <valid_hostname.h>
 #include <valid_mailhost_addr.h>
 #include <compat_va_copy.h>
-#include <mymalloc.h>
 
 /* 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)