Deleted Added
full compact
resolv.subr (244675) resolv.subr (247280)
1if [ ! "$_NETWORKING_RESOLV_SUBR" ]; then _NETWORKING_RESOLV_SUBR=1
2#
1if [ ! "$_NETWORKING_RESOLV_SUBR" ]; then _NETWORKING_RESOLV_SUBR=1
2#
3# Copyright (c) 2006-2012 Devin Teske
3# Copyright (c) 2006-2013 Devin Teske
4# All Rights Reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright

--- 7 unchanged lines hidden (view full) ---

19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25# SUCH DAMAGE.
26#
4# All Rights Reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright

--- 7 unchanged lines hidden (view full) ---

19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25# SUCH DAMAGE.
26#
27# $FreeBSD: head/usr.sbin/bsdconfig/networking/share/resolv.subr 244675 2012-12-25 10:47:45Z dteske $
27# $FreeBSD: head/usr.sbin/bsdconfig/networking/share/resolv.subr 247280 2013-02-25 19:55:32Z dteske $
28#
29############################################################ INCLUDES
30
31BSDCFG_SHARE="/usr/share/bsdconfig"
32. $BSDCFG_SHARE/common.subr || exit 1
33f_dprintf "%s: loading includes..." networking/resolv.subr
34f_include $BSDCFG_SHARE/dialog.subr
35f_include $BSDCFG_SHARE/strings.subr
28#
29############################################################ INCLUDES
30
31BSDCFG_SHARE="/usr/share/bsdconfig"
32. $BSDCFG_SHARE/common.subr || exit 1
33f_dprintf "%s: loading includes..." networking/resolv.subr
34f_include $BSDCFG_SHARE/dialog.subr
35f_include $BSDCFG_SHARE/strings.subr
36f_include $BSDCFG_SHARE/media/tcpip.subr
36f_include $BSDCFG_SHARE/networking/common.subr
37f_include $BSDCFG_SHARE/networking/ipaddr.subr
38
39BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
40f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
41
42############################################################ CONFIGURATION
43
44#
37f_include $BSDCFG_SHARE/networking/common.subr
38f_include $BSDCFG_SHARE/networking/ipaddr.subr
39
40BSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
41f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
42
43############################################################ CONFIGURATION
44
45#
45# Path to resolv.conf(5).
46#
47: ${RESOLV_CONF:="/etc/resolv.conf"}
48
49#
50# When updating resolv.conf(5), should we populate the `search' directive with
51# all possible sub-domains? In example, if the domain is "sub.domain.com", when
52# the below option is set to 1, include both "sub.domain.com" and "domain.com"
53# in the `search' directive, otherwise use only "sub.domain.com".
54#
55# When enabled (set to 1), specify the minimum number of dots required for each
56# `search' domain by setting the second option below, `RESOLVER_SEARCH_NDOTS'.
57#

--- 40 unchanged lines hidden (view full) ---

98 found = 1
99 exit
100 }
101 }
102 END { exit ! found }
103 '
104}
105
46# When updating resolv.conf(5), should we populate the `search' directive with
47# all possible sub-domains? In example, if the domain is "sub.domain.com", when
48# the below option is set to 1, include both "sub.domain.com" and "domain.com"
49# in the `search' directive, otherwise use only "sub.domain.com".
50#
51# When enabled (set to 1), specify the minimum number of dots required for each
52# `search' domain by setting the second option below, `RESOLVER_SEARCH_NDOTS'.
53#

--- 40 unchanged lines hidden (view full) ---

94 found = 1
95 exit
96 }
97 }
98 END { exit ! found }
99 '
100}
101
106# f_resolv_conf_nameservers
107#
108# Returns nameserver(s) configured in resolv.conf(5).
109#
110f_resolv_conf_nameservers()
111{
112 awk \
113 '
114 BEGIN { found = 0 }
115 ( $1 == "nameserver" ) \
116 {
117 print $2
118 found = 1
119 }
120 END { exit ! found }
121 ' \
122 "$RESOLV_CONF" 2> /dev/null
123}
124
125# f_dialog_resolv_conf_update $hostname
126#
127# Updates the search/domain directives in resolv.conf(5) given a valid fully-
128# qualified hostname.
129#
130# This function is a two-parter. Below is the awk(1) portion of the function,
131# afterward is the sh(1) function which utilizes the below awk script.
132#

--- 364 unchanged lines hidden ---
102# f_dialog_resolv_conf_update $hostname
103#
104# Updates the search/domain directives in resolv.conf(5) given a valid fully-
105# qualified hostname.
106#
107# This function is a two-parter. Below is the awk(1) portion of the function,
108# afterward is the sh(1) function which utilizes the below awk script.
109#

--- 364 unchanged lines hidden ---