From ebd31d3e74d9417375b86766ee300be493044d39 Mon Sep 17 00:00:00 2001 From: Stoiko Ivanov Date: Thu, 29 Oct 2020 18:49:16 +0100 Subject: [PATCH] reinject_email: fix connecting for ipv6-only hosts When configuring PMG only with ipv6 addresses, reinject_email after processing fails to connect to the postfix/smtpd instance (with EINVAL). Setting the host to '::FFFF:127.0.0.1' fixes the issue. Tested with: * an ipv6only host (no ipv4 configured) * a host with ipv6 disabled via sysctl: ``` net.ipv6.conf.all.disable_ipv6=1 net.ipv6.conf.default.disable_ipv6=1 net.ipv6.conf.lo.disable_ipv6=1 ``` * a host with dual-stack setup Signed-off-by: Stoiko Ivanov --- src/PMG/Utils.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PMG/Utils.pm b/src/PMG/Utils.pm index d0654e1..c5cf7b8 100644 --- a/src/PMG/Utils.pm +++ b/src/PMG/Utils.pm @@ -211,7 +211,7 @@ sub reinject_mail { my $resmess; eval { - my $smtp = Net::SMTP->new('127.0.0.1', Port => 10025, Hello => $me) || + my $smtp = Net::SMTP->new('::FFFF:127.0.0.1', Port => 10025, Hello => $me) || die "unable to connect to localhost at port 10025"; if (defined($xforward)) { -- 2.39.5