Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime option to enable IPv4 preference over IPv6 #1176

Open
ivanka2012 opened this issue Apr 21, 2022 · 3 comments
Open

Runtime option to enable IPv4 preference over IPv6 #1176

ivanka2012 opened this issue Apr 21, 2022 · 3 comments

Comments

@ivanka2012
Copy link

Is there any flag to make OpenSMTPD try resolving IPv4 addresses first instead of IPv6 addresses?

GMail seems to strongly prefer emails coming from IPv4 addresses, and the option to have IPv4 preference has been locked away a long time ago by a compile time flag (#182).

@clarfonthey
Copy link

Isn't this something you can configure via resolved directly? I tried looking locally for my own config but couldn't quite remember where it was located, and I think that in my case at least, I'm relying on systemd-specific configs to prefer v6 resolution over v4.

@ivanka2012
Copy link
Author

I configured the resolver to prefer IPv4 using /etc/gai.conf on Linux, but OpenSMTPD still sent emails from IPv6.

@omar-polo
Copy link
Contributor

Sorry for the long delay.

OpenSMTPD uses its own DNS resolver, which is a port of OpenBSD' asr, so I don't think it would honour /etc/gai.conf. We have a (hidden) configure-time knob to change the preference, see

/*
* opensmtpd-portable knob to prefer IPv6 over IPv4.
*
* See: https://github.com/poolpOrg/OpenSMTPD/issues/182
*/
#ifndef ASR_IPV4_BEFORE_IPV6
ac->ac_family[0] = AF_INET6;
ac->ac_family[1] = AF_INET;
#else
ac->ac_family[0] = AF_INET;
ac->ac_family[1] = AF_INET6;
#endif

but it is a build-item knob, it's not possible to change it via a configuration option.

(although I think we should, by default, mirror OpenBSD and have ipv4 before ipv6)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants