Oracle iPlanet Web Proxy Server 4.0.14 Configuration File Reference

DNS

The DNS directive calls either the dns-config built-in function or a DNS function that you specify.

dns-config

Syntax

DNS fn=dns-config local-domain-levels=<n>

local-domain-levels specifies the number of levels of subdomains that the local network has. The default is 1.

The Proxy Server optimizes DNS lookups by reducing the time spent resolving hosts that are fully qualified domain names but which DNS would by default still try to resolve relative to the local domain.

For example, from the netscape.com domain, suppose you try to access the host www.xyzzy.com. At first, DNS will try to resolve:

    www.xyzzy.com.netscape.com

and only after that the real fully qualified domain name:

    www.xyzzy.com

If the local domain has subdomains, such as corp.netscape.com, DNS would try two additional lookups:

    www.xyzzy.com.corp.netscape.com    www.xyzzy.com.netscape.com

To avoid these extra DNS lookups, you can instruct the proxy to treat host names that are not local as remote. The proxy should instruct DNS not to resolve the name relative to the current domain.

If the local network has no subdomains, set the value to 0. Only if the host name has no domain (no dots in the host name) the name will be resolved relative to the local domain. Otherwise, DNS should always resolve the name as an absolute, fully qualified domain name.

If the local network has one level of subdomains, set the value to 1. Host names that include two or more dots will be treated as fully qualified domain names.

An example of one level of subdomains would be the netscape.com domain, with subdomains:

    corp.netscape.com    engr.netscape.com    mktg.netscape.com

Hosts without a dot, such as the step host are resolved with respect to the current domain, for example, engr.netscape.com. In this situation, the dns-config function will try this name:

    step.engr.netscape.com

If you are on corp.netscape.com domain but the destination host step is on the engr subdomain, you can type

    step.engr

instead of having to specify the fully qualified domain name:

    step.engr.netscape.com

your-dns-function

You define this DNS-class function.

Syntax

DNS fn=your-dns-function

Only the first applicable DNS function is called, starting from the most restrictive object. In the rare case that you need to call multiple DNS functions, the function can return REQ_NOACTION.

The DNS function must have this prototype:

int your_dns_function(pblock *pb, Session *sn, Request *rq);

To get the host name use:

pblock_findval("dns-host", rq->vars)

and set the host entry using the new NSAPI function

dns_set_hostent

The struct hostent * will not be freed by the caller but will be treated as a pointer to a static area, as with the gethostbyname call. Keep a pointer in a static variable in the custom DNS function and on the next call either use the same struct hostent or free it before allocating a new one.

The DNS function returns REQ_PROCEED if it is successful, and REQ_NOACTION if the next DNS function (or gethostbyname, if no other applicable DNS class functions exist) should be called instead. Any other return value is treated as failure to resolve the host name.

Example

This example uses the normal gethostbyname call to resolve the host name:


#include <nsapi.h>
int my_dns_func(pblock *pb, Session *sn, Request *rq)
{
    char *host = pblock_findval("dns-host", rq->vars);
    struct hostent *hostent;
hostent = gethostbyname(host); // replace with custom DNS implementation
    dns_set_hostent(hostent, sn, rq);
return REQ_PROCEED;
}