Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow config & checking of nameserver rotation option #48

Closed
wants to merge 1 commit into from

Commits on Mar 4, 2016

  1. api: add ARES_OPT_NOROTATE optmask value

    Fix up a couple of problems with configuring whether c-ares rotates
    between different name servers between requests.
    
    Firstly, ares_save_options() returns (in *optmask) the value of
    (channel->optmask & ARES_OPT_ROTATE), which doesn't necessarily
    indicate whether the channel is or is not actually doing rotation.
    This can be confusing/incorrect if:
     - the channel was originally configured without ARES_OPT_ROTATE
       (so it appears that the channel is not rotating)
     - the /etc/resolv.conf file includes the 'rotate' option
       (so the channel is actually performing rotation).
    
    Secondly, it is not possible to reliably configure a channel
    to not-rotate; leaving off ARES_OPT_ROTATE is not enough, since
    a 'rotate' option in /etc/resolv.conf will turn it on again.
    
    Therefore:
     - add an ARES_OPT_NOROTATE optmask value to allow explicit
       configuration of no-rotate behaviour
     - in ares_save_options(), report the value of channel->rotate
       as exactly one of (optmask & ARES_OPT_ROTATE) or
       (optmask & ARES_OPT_NOROTATE).
    
    In terms of back-compatibility:
     - existing apps that set ARES_OPT_ROTATE will continue to rotate,
       and to have ARES_OPT_ROTATE reported back from ares_save_options()
     - existing apps that don't set ARES_OPT_ROTATE will continue to
       use local config/defaults to decide whether to rotate, and will
       now get ARES_OPT_ROTATE or ARES_OPT_NOROTATE reported back from
       ares_save_options() rather than 0.
    daviddrysdale committed Mar 4, 2016
    Configuration menu
    Copy the full SHA
    751d74b View commit details
    Browse the repository at this point in the history