@IPNAME (and more)

May 20, 2008
Syracuse, NY, USA
Using @IPNAME on my internet address ...

v:\> echo %_ip

v:\> echo %@ipname[]
That's a meaningless and useless (doesn't work with Winsock functions) combination of my computer's "given" name and LocalAreaConnection2's "Primary and connection-specific DNS suffixes".

Once upon a time (pre-W2K?), gethostbyaddr() (and related functions) would cause a DNS lookup and give the actual internet name of my computer, but no longer. According to a seemingly knowledgeable gent in microsoft.public.win32.programmer.network the computer's public address is considered local and you cannot get gethostbyaddr(), WSAAsyncGetHostByAddr(), or getnameinfo() to do a real lookup. All three functions give the same bogus name.

Recommend, for W2K and later:

#define IsRoutable(X,Y) \
    (!(X==10 || (X==192 && Y==168) || (X==172 && (Y&240)==16) || (X==169 && Y==254) ))

    /* do the lookup for routable IP */
    CHAR szNameBuf[32];
    /* address in already in network order */
    /* backwards, e.g., jpsoft:  ""
    wsprintf(szNameBuf, "%s.in-addr.arpa", inet_ntoa(address));
    PDNS_RECORD pDnsRecord;

    DNS_STATUS dnsResult = DnsQuery(szNameBuf, DNS_TYPE_PTR, 
            | DNS_QUERY_NO_NETBT
            | DNS_QUERY_WIRE_ONLY,
            &pDnsRecord, NULL);

    if ( dnsResult == NO_ERROR  )
        wsprintf(szName, "%s", pDnsRecord->Data.PTR.pNameHost);
        DnsRecordListFree(pDnsRecord, DnsFreeRecordListDeep);

I have more robust code that does GetBestInterface() and creates a list of DNS servers to give DnsQuery() (instead of NULL) but, at least on XP, that seems to be DnsQuery()'s default behavior.

To be continued.
May 20, 2008
Syracuse, NY, USA
(Chapter 2)

When I use SENDMAIL ...

Connection from, Sat Jun 20 12:27:40 2009
MAIL FROM: <vefatica@vefatica.net>
RCPT TO:<vefatica@lucky.syr.edu>
DATA - 7 lines, 177 bytes.
1 sec. elapsed, connection closed Sat Jun 20 12:27:41 2009

(1) the RSET is unnecessary and looks suspiciously like something a spammer would do.

(2) the EHLO (HELO) name, "ZZ", is not a very good internet name and I think an SMTP client should strive to provide a valid lookup-able name. My server, perhaps others, discriminate on that name. If my IP were not exempt from transaction-level filtering, that log would have looked like this:

Connection from, Sat Jun 20 12:27:40 2009
554 Not authorized
1 sec. elapsed, connection closed Sat Jun 20 12:27:41 2009

If you're in control, I'd recommend using a real name (from DnsQuery()). If you're not in control you might mention this to IPWORKS.
Similar threads
Thread starter Title Forum Replies Date
Joe Caverly @IPNAME Support 7
Frank output of @ipaddress/@ipname Support 1
Charles Dye More help nits Support 0
L detach /Q is more yappy than advertised Support 3
vefatica WAD More SET /A woes Support 4
D TCC has much more elegant ways for usebackq. What ways? Support 12
vefatica Make FFIND a bit more friendly? Support 14
vefatica More on the help Support 12
nikbackm WAD More Windows 10 woes Support 8
fromano How to? Everything finding directories with 2 or more files in them Support 3
vefatica WAD More on ACTIVATE Support 4
vefatica More on IFTP Support 7
mfarah More on pdir's options: /(fq) Support 5
Dan Glynhampton Documentation v15 help: More mailto: links Support 2
Dan Glynhampton Documentation v15 help: More odd mailto: links in the help Support 8
C Looking for files with more than 1 period Support 2
vefatica More on the installer Support 5
J DebugMonitor - More mystical than magnets? Support 6
D "Learn More" button on home page not working Support 3
J Colors in tcmd (one more try) Support 1
M More SafeChars type issues... Support 4
Y More v13 weirdness Support 4
S More HELP nits Support 5
vefatica WINDOW (and more closing TCC woes) Support 15
Jay Sage More on Problem with Tabbed Toolbar Support 0
Roedy more.com stops working Support 1
dcantor More date-related help items for V11 Support 0
Jay Sage More Problems with TCTOOLBAR Support 0
M More file-renaming problems involving commas... Support 0
R Reading an Unicode file with more than 8191 lines Support 1

Similar threads