[OT] Resolver API: problem with RES_USEVC

Jim Reid jim at rfc1035.com
Mon Jun 7 09:12:20 UTC 2004


>>>>> "Stephane" == Stephane Bortzmeyer <bortzmeyer at nic.fr> writes:

    Stephane> I cannot perform TCP requests with res_query. My code
    Stephane> includes:

    Stephane>   if (use_tcp) {
    Stephane>		 _res.options &= RES_USEVC;
    Stephane>   }

Shouldn't that be
	_res.options |= RES_USEVC;
??

    Stephane> and, even when use_tcp is true, requests are always made
    Stephane> with UDP (checked with tcpdump and with nameservers
    Stephane> refusing TCP).

Well in BIND9's lib/bind/resolv/res_send.c:

res_nsend()
...
        v_circuit = (statp->options & RES_USEVC) || buflen > PACKETSZ;
	...
	if (v_circuit) {
                        /* Use VC; at most one attempt per server. */
			try = statp->retry;
                        n = send_vc(....)
			...
	} else {
                        /* Use datagrams. */  
                        n = send_dg(..)
	}


    Stephane> If I use another resolver option (for instance
    Stephane> RES_NORECURSE), it is taken into account. But RES_USEVC
    Stephane> seems a noop?

Perhaps something is going wrong with the way you're setting the bits
in _res.options?


More information about the bind-users mailing list