Hi,

I'm trying to setup a test environment using smtp-sink as a mail
receiver. For ipv4 I'm running smtp-sink on random addresses in
127.0.0.0/8, and was looking for the same trick on ipv6. My OS allows me
to (ab)use ::ffff:0:0/96 for this, but unfortunately, smtp-sink does not:

$ smtp-sink -v ::ffff:127.1.2.3:12345 100
smtp-sink: name_mask: all
smtp-sink: trying... [::ffff:127.1.2.3]:12345
smtp-sink: fatal: bind ::ffff:127.1.2.3 port 12345: Invalid argument

$ smtp-sink -v ::ffff:7f01:203:12345 100
smtp-sink: name_mask: all
smtp-sink: trying... [::ffff:127.1.2.3]:12345
smtp-sink: fatal: bind ::ffff:127.1.2.3 port 12345: Invalid argument

As shown below, postfix and smtp-sink are built with ipv6 support:

$ smtp-sink -v ::1:12345 100
smtp-sink: name_mask: all
smtp-sink: trying... [::1]:12345
<waiting for connections>
smtp-sink: connect (AF_INET6 ::5b00:0:6e00:0)
smtp-sink: vstream_tweak_tcp: TCP_MAXSEG 21888
smtp-sink: fd=5: stream buffer size old=0 new=43776
smtp-sink: smtp_stream_setup: maxtime=100 enable_deadline=0
smtp-sink: helo test
smtp-sink: quit
smtp-sink: disconnect

And this is the way I want to actually connect to it (using postfix in
stead of smtp-sink, seems to work fine):

$ python3
Python 3.4.3+ (default, Oct 14 2015, 16:03:50)
[GCC 5.2.1 20151010] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> sock = socket.socket(socket.AF_INET6)
>>> sock.bind(('::ffff:127.1.2.3', 0))
>>> sock.connect(('::ffff:127.0.0.1', 25))
>>> sock.recv(1024)
b'220 tom-workstation ESMTP Postfix (Ubuntu)\r\n'
>>>

For the record: I'm hoping to be able to use an ipv6 address that is
available by default on a unix system (i.e. without explicitly setting
up an actual route-able address). Any ideas why this is isn't working?

Using postfix 2.11.3

Regards,
        Tom

Reply via email to