View | Details | Raw Unified | Return to bug 401648
Collapse All | Expand All

(-)ip-up (-37 / +30 lines)
Lines 45-92 Link Here
45
	export ifcfg provider
45
	export ifcfg provider
46
}
46
}
47
47
48
# Automatic configuration of your resolv.conf for peer supplied DNS addresses
48
# Automatic configuration of your nameserver config for peer supplied DNS
49
# when using the 'usepeerdns' option ('ms-get-dns' for ipppd). Original
49
# and WINS servers when using the 'usepeerdns' option ('ms-get-dns' for
50
# resolv.conf is restored when ip-down is called by pppd when the link goes
50
# ipppd) according to the modify policy in netconfig.
51
# down.
51
# The modifications are restored by netconfig when ip-down is called by
52
# pppd when the link goes down.
52
add_nameservers()
53
add_nameservers()
53
{
54
{
54
	[ -z "$USEPEERDNS" ] && return
55
	# TODO: do we have to consider MODIFYDNS and USEPEERDNS? test it!
55
56
	NETCONFIG_VERBOSE="-v"
56
	if [ -z "$isdn" ]; then
57
	{
57
		[ ! -f /etc/ppp/resolv.conf ] && return
58
		echo "INTERFACE='$INTERFACE'"
58
		/sbin/modify_resolvconf modify -s pppd -p pppd -e "$INTERFACE" \
59
		echo "IPADDR='$LOCALIP'"
59
		    -f /etc/ppp/ip-up -n "$DNS1 $DNS2" -t - <<-EOT
60
		echo "PTPADDR='$REMOTEIP'"
60
		    If you do not want the pppd to change your nameserver settings
61
		#if [ "x$MODIFYDNS" = xyes ] ; then
61
		    set MODIFYDNS=no in the config file for this provider in
62
			dnsservers=()
62
		    /etc/sysconfig/network/providers/ and ensure that the option
63
			if   [ "x$DNS1" != x -o "x$DNS2" != x ] ; then
63
		    usepeerdns is not set in /etc/ppp/options.
64
				dnsservers=($DNS1 $DNS2)
64
		EOT
65
			elif [ "x$MS_DNS1" != x -o "x$MS_DNS2" != x ] ; then
65
	else
66
				dnsservers=($MS_DNS1 $MS_DNS2)
66
		[ -z "$MS_DNS1" ] && return
67
			fi
67
		/sbin/modify_resolvconf modify -s ipppd -p ipppd -e "$INTERFACE" \
68
			echo "DNSSERVERS='${dnsservers[@]}'"
68
		    -f /etc/ppp/ip-up -n "$MS_DNS1 $MS_DNS2" -t - <<-EOT
69
		#fi
69
		    If you do not like the ipppd to change your nameserver
70
		#if [ -n "x$MODIFYWINS" = xyes ] ; then
70
		    settings remove the option MODIFYDNS for this provider
71
			winsservers=()
71
		EOT
72
			if [ "x$MS_WINS1" != x -o "x$MS_WINS2" != x ] ; then
72
	fi
73
				winsservers=($MS_WINS1 $MS_WINS2)
73
74
			fi
75
			echo "NETBIOSNAMESERVER='${winsservers[@]}'"
76
		#fi
77
	} | /sbin/netconfig modify -s pppd -i "$INTERFACE" $NETCONFIG_VERBOSE
74
}
78
}
75
76
# restore the original resolv.conf saved when ip-up was called by the
77
# pppd which uses the `usepeerdns' option and resolv.conf was modified
78
# for the supplied dns server adresses.
79
restore_nameservers()
79
restore_nameservers()
80
{
80
{
81
	[ -z "$USEPEERDNS" ] && return
81
	NETCONFIG_VERBOSE="-v"
82
82
	/sbin/netconfig remove -s pppd -i "$INTERFACE" $NETCONFIG_VERBOSE
83
	if [ -z "$isdn" ]; then
84
		[ ! -f /etc/ppp/resolv.conf ] && return
85
		/sbin/modify_resolvconf restore -s pppd -e "$INTERFACE"
86
	else
87
		[ -z "$MS_DNS1" ] && return
88
		/sbin/modify_resolvconf restore -s ipppd -e "$INTERFACE"
89
	fi
90
}
83
}
91
84
92
# using this function currently breaks Dial On Demand setups, because
85
# using this function currently breaks Dial On Demand setups, because

Return to bug 401648