3 Parses /etc/resolv.conf
5 Author: Raphael Pinson <raphink@gmail.com>
8 This lens tries to keep as close as possible to `man resolv.conf` where possible.
11 This file is licensed under the LGPLv2+, like the rest of Augeas.
15 About: Configuration files
16 This lens applies to /etc/resolv.conf. See <filter>.
22 (************************************************************************
23 * Group: USEFUL PRIMITIVES
24 *************************************************************************)
27 let comment = Util.comment_generic /[ \t]*[;#][ \t]*/ "# "
30 let empty = Util.empty
33 (************************************************************************
35 *************************************************************************)
38 A network mask for IP addresses *)
39 let netmask = [ label "netmask" . Util.del_str "/" . store Rx.ip ]
42 An IP address or range with an optional mask *)
43 let ipaddr = [label "ipaddr" . store Rx.ip . netmask?]
48 let nameserver = Build.key_value_line
49 "nameserver" Sep.space (store Rx.ip)
52 let domain = Build.key_value_line
53 "domain" Sep.space (store Rx.word)
56 let search = Build.key_value_line
59 [label "domain" . store Rx.word]
63 let sortlist = Build.key_value_line
69 (************************************************************************
70 * Group: SPECIAL OPTIONS
71 *************************************************************************)
74 ip6-dotint option, which supports negation *)
76 let negate = [ del "no-" "no-" . label "negate" ]
77 in [ negate? . key "ip6-dotint" ]
82 let options_entry = Build.key_value ("ndots"|"timeout"|"attempts")
83 (Util.del_str ":") (store Rx.integer)
84 | Build.flag ("debug"|"rotate"|"no-check-names"
85 |"inet6"|"ip6-bytestring"|"edns0")
88 in Build.key_value_line
95 let entry = nameserver
102 let lns = ( empty | comment | entry )*
104 (* Variable: filter *)
105 let filter = (incl "/etc/resolv.conf")
108 let xfm = transform lns filter