Resolv

Parses /etc/resolv.conf

Author: Raphael Pinson rap.nosp@m.hink@gmai.nosp@m.l.com

Summary
ResolvParses /etc/resolv.conf
ReferenceThis lens tries to keep as close as possible to `man resolv.conf` where possible.
LicenceThis file is licensed under the LGPL v2+, like the rest of Augeas.
Lens Usage
Configuration filesThis lens applies to /etc/resolv.conf.
USEFUL PRIMITIVES
comment
comment_eol
empty
MAIN OPTIONS
netmaskA network mask for IP addresses
ipaddrAn IP address or range with an optional mask
nameserverA nameserver entry
domain
search
sortlist
lookup
family
SPECIAL OPTIONS
ip6_dotintip6-dotint option, which supports negation
optionsOptions values
entry
lns
filter

Reference

This lens tries to keep as close as possible to `man resolv.conf` where possible.

Licence

This file is licensed under the LGPL v2+, like the rest of Augeas.

Lens Usage

Configuration files

This lens applies to /etc/resolv.conf.  See filter.

USEFUL PRIMITIVES

comment

let comment = Util.comment_generic /[ \t]*[;#][ \t]*/ "# "

comment_eol

let comment_eol = Util.comment_generic /[ \t]*[;#][ \t]*/ " # "

empty

let empty = Util.empty_generic_dos /[ \t]*[#;]?[ \t]*/

MAIN OPTIONS

netmask

let netmask = [ label "netmask" . Util.del_str "/" . store Rx.ip ]

A network mask for IP addresses

ipaddr

let ipaddr = [label "ipaddr" . store Rx.ip . netmask?]

An IP address or range with an optional mask

nameserver

let nameserver = Build.key_value_line_comment "nameserver" Sep.space (store Rx.ip) comment_eol

A nameserver entry

domain

let domain = Build.key_value_line_comment "domain" Sep.space (store Rx.word) comment_eol

search

let search = Build.key_value_line_comment "search" Sep.space (Build.opt_list [label "domain" . store Rx.word] Sep.space) comment_eol

sortlist

let sortlist = Build.key_value_line_comment "sortlist" Sep.space (Build.opt_list ipaddr Sep.space) comment_eol

lookup

let lookup = let lookup_entry = Build.flag("bind"|"file"|"yp") in Build.key_value_line_comment "lookup" Sep.space (Build.opt_list lookup_entry Sep.space) comment_eol

family

let family = let family_entry = Build.flag("inet4"|"inet6") in Build.key_value_line_comment "family" Sep.space (Build.opt_list family_entry Sep.space) comment_eol

SPECIAL OPTIONS

ip6_dotint

let ip6_dotint = let negate = [ del "no-" "no-" . label "negate" ] in [ negate? . key "ip6-dotint" ]

ip6-dotint option, which supports negation

options

let options = let options_entry = Build.key_value ("ndots"|"timeout"|"attempts") (Util.del_str ":") (store Rx.integer) | Build.flag ("debug"|"rotate"|"no-check-names" |"inet6"|"ip6-bytestring"|"edns0" |"single-request-reopen") | ip6_dotint in Build.key_value_line_comment "options" Sep.space (Build.opt_list options_entry Sep.space) comment_eol

Options values

entry

let entry = nameserver | domain | search | sortlist | options | lookup | family

lns

let lns = ( empty | comment | entry )*

filter

let comment = Util.comment_generic /[ \t]*[;#][ \t]*/ "# "
let comment_eol = Util.comment_generic /[ \t]*[;#][ \t]*/ " # "
let empty = Util.empty_generic_dos /[ \t]*[#;]?[ \t]*/
let netmask = [ label "netmask" . Util.del_str "/" . store Rx.ip ]
A network mask for IP addresses
let ipaddr = [label "ipaddr" . store Rx.ip . netmask?]
An IP address or range with an optional mask
let nameserver = Build.key_value_line_comment "nameserver" Sep.space (store Rx.ip) comment_eol
A nameserver entry
let domain = Build.key_value_line_comment "domain" Sep.space (store Rx.word) comment_eol
let search = Build.key_value_line_comment "search" Sep.space (Build.opt_list [label "domain" . store Rx.word] Sep.space) comment_eol
let sortlist = Build.key_value_line_comment "sortlist" Sep.space (Build.opt_list ipaddr Sep.space) comment_eol
let lookup = let lookup_entry = Build.flag("bind"|"file"|"yp") in Build.key_value_line_comment "lookup" Sep.space (Build.opt_list lookup_entry Sep.space) comment_eol
let family = let family_entry = Build.flag("inet4"|"inet6") in Build.key_value_line_comment "family" Sep.space (Build.opt_list family_entry Sep.space) comment_eol
let ip6_dotint = let negate = [ del "no-" "no-" . label "negate" ] in [ negate? . key "ip6-dotint" ]
ip6-dotint option, which supports negation
let options = let options_entry = Build.key_value ("ndots"|"timeout"|"attempts") (Util.del_str ":") (store Rx.integer) | Build.flag ("debug"|"rotate"|"no-check-names" |"inet6"|"ip6-bytestring"|"edns0" |"single-request-reopen") | ip6_dotint in Build.key_value_line_comment "options" Sep.space (Build.opt_list options_entry Sep.space) comment_eol
Options values
let entry = nameserver | domain | search | sortlist | options | lookup | family
let lns = ( empty | comment | entry )*
Close