Re: couriertcpd listening to the wrong IPv6 address

Sam Varshavchik <[email protected]> Fri, 31 May 2024 11:29:49 -0400
Newsgroups gmane.mail.imap.courier.general
Message-ID <[email protected]>
Alessandro Vesely writes:

> Sam,
>
> Since they are so many, I thought I can afford a different address for every  
> service, so I configured 2a02:29e1:500:6c00::2.25 in esmtpd.  That's the IP  
> of an MX host, but nobody wrote and now I got why:  Courier is not listening  
> to it.  It seems somehow it dropped the last byte of the address, or do I  
> have something wrong?
>
> Here's my configuration:
>
> 658-north:courier# ip -6 addr show dev ppp0 scope global
> 8: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 qdisc fq_codel  
> state UNKNOWN group default qlen 3
>     inet6 2a02:29e1:500:6c8f::1/64 scope global
>        valid_lft forever preferred_lft forever
>     inet6 2a02:29e1:500:6c01::1/64 scope global
>        valid_lft forever preferred_lft forever
>     inet6 2a02:29e1:500:6c00::4/64 scope global
>        valid_lft forever preferred_lft forever
>     inet6 2a02:29e1:500:6c00::2/64 scope global
>        valid_lft forever preferred_lft forever
>     inet6 2a02:29e1:500:6c00::1/64 scope global
>        valid_lft forever preferred_lft forever
> 659-north:courier#
> 659-north:courier#
> 659-north:courier#
> 659-north:courier# netstat -ltnp | grep 2a02| grep courier
> tcp6       0      0 2a02:29e1:500:6c00:::25 :::*                     
> LISTEN      7261/couriertcpd
> 660-north:courier#
> 660-north:courier#
> 660-north:courier# grep -E ^PORT esmtpd
> PORT=94.198.96.74.25,192.168.1.254.25,172.16.197.1.25,127.0.0.1.25,2a02:29e1:500:6c00::2.25
>
> Can you spot what's wrong?

It really looks to me like it's netstat's output that's chopping it off.

To reproduce this I added code to set the IP_FREEBIND option on the  
listening socket (and I'll keep this change), so that I can reproduce this  
verbatim:

$ strace -s 256 ./couriertcpd 2a02:29e1:500:6c00::2.2525 /bin/false 2>&1 | grep bind
bind(3, {sa_family=AF_INET6, sin6_port=htons(2525), sin6_flowinfo=htonl(0),  
inet_pton(AF_INET6, "2a02:29e1:500:6c00::2", &sin6_addr), sin6_scope_id=0},  
28) = 0

strace is logging the correct IP address dropping into the socket.

Once I saw that, a Google search confirmed this diagnosis:

https://askubuntu.com/questions/834807/format-of-ipv6-addresses-in-the-netstat-output

_______________________________________________
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-----

iHUEABYKAB0WIQRupkKLJP96aW75pIOKYPgoojZS4gUCZlns7gAKCRCKYPgoojZS
4oBgAQC9LyAixEBciEXFMpG74vL1aaJg2KU1SljF2h2TdZdCzwEAmHVe6JohrRLB
wAxxuDGFAvB3V433atmN77RwH2UV9gc=
=mhu7
-----END PGP SIGNATURE-----