I've spent several hours debugging an issue.
table(5) specifies addrname format as a mapping from inet4 or inet6
addresses to hostnames:
::1 localhost
127.0.0.1 localhost
88.190.23.165 www.opensmtpd.org
But I can't get IPv6 mappings to work. So I've given up, and use helo
instead of helo-src.
But helo-src is useful (not on this particular setup, though).
For a month or so I had a static addrname table like this:
table helo-names { \
65.108.153.125 = com.krot.org, \
2a01:4f9:c010:9411::1 = com.krot.org
}
I suppose this was the cause of the frequent "Failed to retrieve helo
string" errors I was getting -- smtpd would not get helo name for IPv6
address.
At first I thought it was space around equal signs, but table(5) uses
space in the example. So I had to dig further.
Doing tracing, I saw that for IPv6 it -- apparently -- would be looking
up IPv6 address enclosed in brackets:
lookup: lookup "[2a01:4f9:c010:9411::1]" as ADDRNAME in table
static:helo-names -> none
So, I went ahead and did:
table helo-names { \
65.108.153.125 = com.krot.org, \
"[2a01:4f9:c010:9411::1]" = com.krot.org \
}
This didn't help, either:
lookup: lookup "[2a01:4f9:c010:9411::1]" as ADDRNAME in table
static:helo-names -> "com.krot.org"
warn: failure during helo lookup helo-names:[2a01:4f9:c010:9411::1]
Now it did find "com.krot.org", but why did it report "failure during
helo lookup"? It found a match, but still reported failure...
Thinking that it could be a static-map issue, I did a file: map. First
as documented in the man page:
2a01:4f9:c010:9411::1 com.krot.org
65.108.153.125 com.krot.org
This didn't work:
lookup: lookup "[2a01:4f9:c010:9411::1]" as ADDRNAME in table
static:helo-names -> none
Then with square brackets:
65.108.153.125 com.krot.org
[2a01:4f9:c010:9411::1] com.krot.org
And this time square bracked didn't help.
lookup: lookup "[2a01:4f9:c010:9411::1]" as ADDRNAME in table
static:helo-names -> none
New try with db:
makemap -d hash -o helo-names.db -t set helo-names
When reading makemap(8), I noticed this:
In all cases, makemap reads lines consisting of words separated by
whitespace. The first word of a line is the database key; the remainder
represents the mapped value. The database key and value may optionally
be separated by the colon character.
Colon character! In makemap.c there's:
strsep(&valp, " \t:");
So it would be splitting IPv6 addresses, IIUC.
table(5) doesn't say anything about colons.
So I did a dump, and it indeed does separate the IPv6 address:
# makemap -U helo-names.db
65.108.153.125 com.krot.org
[2a01 4f9:c010:9411::1] com.krot.org
How would one put IPv6 addresses in such a map?