Menu

#66 New Ns_GetAllAddrByHost(), add "-all" to ns_addrbyhost

aolserver_v40
closed-accepted
None
6
2004-12-06
2004-07-28
No

Currently, the ns_addrbyhost and ns_hostbyaddr commands
only return the FIRST IP address or host name from DNS.
Should add an optional -all argument to instead get a
Tcl list of all results.

The attached patch implements 'ns_addrbyhost -all' and
stubs in (with a "not yet implemented" error message)
'ns_hostbyaddr -all'. It also adds two new public C
API functions, Ns_GetAllHostByAddr() and
Ns_GetAllAddrByHost(), which implement the -all stuff.

I generated the patch like this:

$ cvs diff -u -r aolserver_v40_r7
aolserver/{include/ns.h,nsd/dns.c,nsd/tclsock.c} >
patch-all-addr-20040728

I think it should apply cleanly against
aolserver_v40_r7 like this:

$ patch -p0 < patch-all-addr-20040728

Discussion

  • Andrew Piskorski

    Logged In: YES
    user_id=43168

    Found a few bugs in my above patch, deleting it for now.

     
  • Andrew Piskorski

    Logged In: YES
    user_id=43168

    New fixed patch "patch-all-addr-20040728-b" uploaded.
    Results for 'ns_addrbyhost -all yahoo.com' are now correct.

     
  • Andrew Piskorski

     
  • Andrew Piskorski

     
  • Andrew Piskorski

    Logged In: YES
    user_id=43168

    Here's an updated patch against AOLserver 4.0.8:

    Of the 3 ifdef'd implementations of GetAddr(), the 1st one
    using getaddrinfo() and the 3rd and oldest one using
    gethostbyname both support the new -all functionality. This
    patch does not add the -all functionality to the 2nd
    GetAddr() which uses gethostbyname_r.

    I created the patch like this:

    $ cvs diff -u -r aolserver_v40_r8
    aolserver/{include/ns.h,nsd/dns.c,nsd/tclsock.c} >
    patch-all-addr-20040923

     
  • Andrew Piskorski

     
  • Andrew Piskorski

    Logged In: YES
    user_id=43168

    Per Dossy's suggestion, I changed the implemenation to a
    cleaner single cache arrangement. Here's the patch against
    AOLserver 4.0.8:

    Patch generated like so:

    $ cvs diff -u -r aolserver_v40_r8
    aolserver/{include/ns.h,nsd/dns.c,nsd/tclsock.c} >
    patch-all-addr-20040924

     
  • Andrew Piskorski

    Logged In: YES
    user_id=43168

    This patch should go into the AOLserver 4.0 branch for
    AOLserver 4.0.10, or at the least, should go onto the Head, now.

    This patch is simple, low impact, and fills in an obvious
    hole in the ns_addrbyhost API functionality that really
    never should have been there in the first place. Also,
    several other feature enhancements of what sound like
    similar or greater complexity went in for 4.0.9, so clearly
    point releases are NOT just for bug fixes, but for
    enhancements like this one as well. I've already gone
    through the hassle of forward porting this patch once, I see
    no reason why I should have to waste the effort to do so again.

    Let's get this in the AOLserver core ASAP, please. If I can
    help make that happen, please let me know how.

     
  • Dossy Shiobara

    Dossy Shiobara - 2004-12-06
    • assigned_to: nobody --> dossy
     
  • Dossy Shiobara

    Dossy Shiobara - 2004-12-06

    Logged In: YES
    user_id=21885

    For the record, since an IP can only have one IN PTR record
    mapping it back to a hostname, the "-all" switch doesn't
    make sense for [ns_hostbyaddr] and Ns_GetAllHostByAddr()
    doesn't need to exist.

    I'm attaching the diff (includes updated tests) against CVS
    HEAD for this RFE.

     
  • Dossy Shiobara

    Dossy Shiobara - 2004-12-06

    patch against HEAD for 4.1.0a - 20041206

     
  • Dossy Shiobara

    Dossy Shiobara - 2004-12-06
    • priority: 5 --> 6
    • summary: Add -all switch to ns_addrbyhost, ns_hostbyaddr --> New Ns_GetAllHostByAddr(), add "-all" to ns_hostbyaddr
    • status: open --> open-accepted
     
  • Dossy Shiobara

    Dossy Shiobara - 2004-12-06
    • summary: New Ns_GetAllHostByAddr(), add "-all" to ns_hostbyaddr --> New Ns_GetAllAddrByHost(), add "-all" to ns_addrbyhost
     
  • Dossy Shiobara

    Dossy Shiobara - 2004-12-06

    Logged In: YES
    user_id=21885

    Just tested, and the patch applies cleanly (except for
    tests/new/ns_addrbyhost.test) against 4.0.9.

     
  • Dossy Shiobara

    Dossy Shiobara - 2004-12-06
    • status: open-accepted --> closed-accepted
     
  • Dossy Shiobara

    Dossy Shiobara - 2004-12-06

    Logged In: YES
    user_id=21885

    OK, change has been committed to HEAD and aolserver_v40_bp
    branch for inclusion in AOLserver 4.0.10.

     

Log in to post a comment.