|
Packit Service |
a2ae7a |
(*
|
|
Packit Service |
a2ae7a |
Module: Resolv
|
|
Packit Service |
a2ae7a |
Parses /etc/resolv.conf
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
Author: Raphael Pinson <raphink@gmail.com>
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Reference
|
|
Packit Service |
a2ae7a |
This lens tries to keep as close as possible to `man resolv.conf` where possible.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Licence
|
|
Packit Service |
a2ae7a |
This file is licensed under the LGPL v2+, like the rest of Augeas.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Lens Usage
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Configuration files
|
|
Packit Service |
a2ae7a |
This lens applies to /etc/resolv.conf. See <filter>.
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
module Resolv =
|
|
Packit Service |
a2ae7a |
autoload xfm
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Group: USEFUL PRIMITIVES
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: comment *)
|
|
Packit Service |
a2ae7a |
let comment = Util.comment_generic /[ \t]*[;#][ \t]*/ "# "
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: comment_eol *)
|
|
Packit Service |
a2ae7a |
let comment_eol = Util.comment_generic /[ \t]*[;#][ \t]*/ " # "
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: empty *)
|
|
Packit Service |
a2ae7a |
let empty = Util.empty_generic_dos /[ \t]*[#;]?[ \t]*/
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Group: MAIN OPTIONS
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: netmask
|
|
Packit Service |
a2ae7a |
A network mask for IP addresses *)
|
|
Packit Service |
a2ae7a |
let netmask = [ label "netmask" . Util.del_str "/" . store Rx.ip ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: ipaddr
|
|
Packit Service |
a2ae7a |
An IP address or range with an optional mask *)
|
|
Packit Service |
a2ae7a |
let ipaddr = [label "ipaddr" . store Rx.ip . netmask?]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: nameserver
|
|
Packit Service |
a2ae7a |
A nameserver entry *)
|
|
Packit Service |
a2ae7a |
let nameserver = Build.key_value_line_comment
|
|
Packit Service |
a2ae7a |
"nameserver" Sep.space (store Rx.ip) comment_eol
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: domain *)
|
|
Packit Service |
a2ae7a |
let domain = Build.key_value_line_comment
|
|
Packit Service |
a2ae7a |
"domain" Sep.space (store Rx.word) comment_eol
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: search *)
|
|
Packit Service |
a2ae7a |
let search = Build.key_value_line_comment
|
|
Packit Service |
a2ae7a |
"search" Sep.space
|
|
Packit Service |
a2ae7a |
(Build.opt_list
|
|
Packit Service |
a2ae7a |
[label "domain" . store Rx.word]
|
|
Packit Service |
a2ae7a |
Sep.space)
|
|
Packit Service |
a2ae7a |
comment_eol
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: sortlist *)
|
|
Packit Service |
a2ae7a |
let sortlist = Build.key_value_line_comment
|
|
Packit Service |
a2ae7a |
"sortlist" Sep.space
|
|
Packit Service |
a2ae7a |
(Build.opt_list
|
|
Packit Service |
a2ae7a |
ipaddr
|
|
Packit Service |
a2ae7a |
Sep.space)
|
|
Packit Service |
a2ae7a |
comment_eol
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: lookup *)
|
|
Packit Service |
a2ae7a |
let lookup =
|
|
Packit Service |
a2ae7a |
let lookup_entry = Build.flag("bind"|"file"|"yp")
|
|
Packit Service |
a2ae7a |
in Build.key_value_line_comment
|
|
Packit Service |
a2ae7a |
"lookup" Sep.space
|
|
Packit Service |
a2ae7a |
(Build.opt_list
|
|
Packit Service |
a2ae7a |
lookup_entry
|
|
Packit Service |
a2ae7a |
Sep.space)
|
|
Packit Service |
a2ae7a |
comment_eol
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: family *)
|
|
Packit Service |
a2ae7a |
let family =
|
|
Packit Service |
a2ae7a |
let family_entry = Build.flag("inet4"|"inet6")
|
|
Packit Service |
a2ae7a |
in Build.key_value_line_comment
|
|
Packit Service |
a2ae7a |
"family" Sep.space
|
|
Packit Service |
a2ae7a |
(Build.opt_list
|
|
Packit Service |
a2ae7a |
family_entry
|
|
Packit Service |
a2ae7a |
Sep.space)
|
|
Packit Service |
a2ae7a |
comment_eol
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Group: SPECIAL OPTIONS
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: ip6_dotint
|
|
Packit Service |
a2ae7a |
ip6-dotint option, which supports negation *)
|
|
Packit Service |
a2ae7a |
let ip6_dotint =
|
|
Packit Service |
a2ae7a |
let negate = [ del "no-" "no-" . label "negate" ]
|
|
Packit Service |
a2ae7a |
in [ negate? . key "ip6-dotint" ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: options
|
|
Packit Service |
a2ae7a |
Options values *)
|
|
Packit Service |
a2ae7a |
let options =
|
|
Packit Service |
a2ae7a |
let options_entry = Build.key_value ("ndots"|"timeout"|"attempts")
|
|
Packit Service |
a2ae7a |
(Util.del_str ":") (store Rx.integer)
|
|
Packit Service |
a2ae7a |
| Build.flag ("debug"|"rotate"|"no-check-names"
|
|
Packit Service |
a2ae7a |
|"inet6"|"ip6-bytestring"|"edns0"
|
|
Packit Service |
a2ae7a |
|"single-request-reopen")
|
|
Packit Service |
a2ae7a |
| ip6_dotint
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
in Build.key_value_line_comment
|
|
Packit Service |
a2ae7a |
"options" Sep.space
|
|
Packit Service |
a2ae7a |
(Build.opt_list
|
|
Packit Service |
a2ae7a |
options_entry
|
|
Packit Service |
a2ae7a |
Sep.space)
|
|
Packit Service |
a2ae7a |
comment_eol
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: entry *)
|
|
Packit Service |
a2ae7a |
let entry = nameserver
|
|
Packit Service |
a2ae7a |
| domain
|
|
Packit Service |
a2ae7a |
| search
|
|
Packit Service |
a2ae7a |
| sortlist
|
|
Packit Service |
a2ae7a |
| options
|
|
Packit Service |
a2ae7a |
| lookup
|
|
Packit Service |
a2ae7a |
| family
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: lns *)
|
|
Packit Service |
a2ae7a |
let lns = ( empty | comment | entry )*
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Variable: filter *)
|
|
Packit Service |
a2ae7a |
let filter = (incl "/etc/resolv.conf")
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let xfm = transform lns filter
|