Skip to content

resolv.conf nameserver parsing is incorrect #23

@britcey

Description

@britcey

From the doc:

nameserver: a space-separated list of nameservers to query.

and the code:

when /^\s_nameserver\s+(._)/
self.nameservers = $1.split(" ")

But that's incorrect - resolv.conf lists 'nameserver' multiple times. e.g., from the Linux manpage:

"Up to MAXNS (currently 3, see <resolv.h>) name servers may be listed, one per keyword. If there are multiple servers, the resolver library queries them in the order listed. "

(Solaris is the same, as is OS X).

This means the last 'nameserver' listed (i.e., the lowest-priority one) will be used by Net::DNS.

The code should be more like:

when /^\s_nameserver\s+(._)/
self.nameservers << $1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions