On Sun, Sep 24, 2023 at 07:55:16PM +0100, Polarian via Postfix-users wrote:
> > Use the Postfix smtp_address_preference default: random selection. > > If an MX host has IPv4 and IPv6 addresses, this ensures that mail > > won't get stuck in the queue when one of the protocols is not > > working for that destination. > > But this is meant to be a PRIORITY, not mandatory. > > preference implies priority, so what you are saying here is if you set > it to prefer IPv6, then it will ONLY attempt IPv6 addresses? Firstly, you're mostly tilting at windmills. Mail is getting through to you, and which address family was used is largely irrelevant. Secondly, no. Preference is about about ordering, not exclusion, both addresses will be tried when the first chosen does not work out. > What if I simply want to prioritise one, and use the other as a > fallback? That seems the more logical way of doing it. Actually, no, it is not "more logical". The logical thing is to deliver mail, via one of the available addresses, while ensuring also that problems that (perhaps temporarily) make all the purported IPv4 or IPv6 addresses unreachable don't break mail delivery. > > If a destination's MX host has no AAAA record, then Postfix will > > not try to connect to it with IPv6. On the other hand, if a > > destination's MX host has an AAAA record, but the Postfix host has > > no IPv6 routes, then you should turn off IPv6 support in Postfix. > > This doesn't answer my question, how does postfix decide between IPv4 > and IPv6 with the default preference? At random. The random number generator is the rather dated rand(3), which is seeded vi srand(3) with (pid ^ epoch time). Which may show some bias under test conditions, but should be adequate in real-world conditions. > I am unsure if I wasn't clear enough, I assume that is the problem > here so I will attempt to reclarify. There is no problem. > The expected behaviour is: > > - IPv6 should be attempted first No. That's unwise. > - IPv4 should be attempted as a fallback if the IPv6 route did not > exist (remote doesn't support IPv6, aka no AAAA record) No. That's unwise. > - Emails should ALWAYS be deliverable, it should NOT get stuck within > the queue trying to connect to a single protocol, IPv4 should only be > used as a fallback. No, the choice should be random, to give messages a decent chance of getting through under various conditions. > I am unsure if you have already explained this, I took this as "You > can tell it to only use IPv6, but this will prevent delivery of > IPv4-only email servers", or I have gotten completely confused. No. If you want to always try IPv6 first, Postfix will do that, and IPv4-only sites will still work, but given enough non-working IPv6 addresses, some difficulty may be expected. Bottom line, this topic is not worth discussing further. -- Viktor. _______________________________________________ Postfix-users mailing list -- postfix-users@postfix.org To unsubscribe send an email to postfix-users-le...@postfix.org