Re: Really not prefer IPv6 MX

Sam Varshavchik <[email protected]> Tue, 03 Dec 2024 16:29:48 -0500
Newsgroups gmane.mail.imap.courier.general
Message-ID <[email protected]>
Alessandro Vesely writes:

> On Tue 03/Dec/2024 14:30:26 +0100 Sam Varshavchik wrote:
>> Alessandro Vesely writes:
>>
>>> Hi Sam,
>>>
>>> as I have IPv6 addresses, I'd like to be able to (try to) send messages to  
>>> domains that have no IPv4 addresses.  However, I have no chance to set up  
>>> reverse PTR, as my provider itself didn't claim its reverse zone.  Hence, if  
>>> it's possible to use IPv4, I'd rather re-queue than use IPv6.
>>>
>>> I have ESMTP_PREFER_IPV6_MX=0 in courierd.  It doesn't seem to have any  
>>> effect, as I introduced it after having fared without it for a while and  
>>> didn't see much difference (similar preference is probably driven by  
>>> gai.conf).  I get sporadic rejects like so:
>>
>> How recent is the code you're running? There were some issues related to  
>> that which were fixed in 1.3.7, but having said that:
>>
>> ESMTP_PREFER_IPV6_MX=0 does not mean no IPv6 ever, it means that IPv4 is  
>> tried first before trying IPv6. So if there was a connection failure to the  
>> IPv4 address then the IPv6 address gets attempted, so in the outlined  
>> scenario you could still get an occasional failure, because of that.
>
>
> I'm still at 1.3.5.  I browsed the code and that confirms me that setting  
> ESMTP_PREFER_IPV6_MX=0 is the same as not setting it.  To get the behavior  
> I'd like one would have to code something like, say,
>
>    if (rc == MX_OK && *prefer_ipv6 == 'N') rc2 = MX_NONE;
>
> That is, if IPv6 is really not preferred and IPv4 exist, pretend IPv6 does  
> not.  But I won't propose a patch of that kind if I'd be the only one who  
> ever uses it.  What you think?

Not sure where the above snippet is from, but 1.3.7 made some changes to  
this logic, addressing some flaws that result in failures in some edge  
cases. Also, there's still code that extracts A and AAAA records from MX  
query responses.

I think this change needs to be done at a higher level, in libesmtp.c when  
it actually goes through the list of MXes, and then introduce the logic  
there to skip unwanted IP addresses.

_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQRupkKLJP96aW75pIOKYPgoojZS4gUCZ094TAAKCRCKYPgoojZS
4qbyAPoDq2UamwAKpaPDLu0nteOog3nhO/eXlh2K4nPtEwRG/AEA7ToP7xbHdTzA
0eQ9wVzK5b7+QJQ7th00UpJuwgfJRwM=
=f/8/
-----END PGP SIGNATURE-----