This is what I came up with.  It's been tested on both 32-bit and 64-bit
Linux (amd64).

If you call IfAddrs::get() and you only get a single interface name/address
pair, test it via isunroutable().  If the address ISN'T unroutable, then you
shouldn't be seeing anyone connecting to you with this address as the
helo (i.e. it's yours and unique).

On the other hand, if, like me, your local address *is* unroutable, then it
means that you're behind a firewall, and need to do a gethostbyname() on
your own name to figure out what your outside address is (i.e. what the
address of your firewall is that proxies for you).

-Philip

Attachment: myips.pm
Description: Perl program

_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

Reply via email to