File: print-dhcpv6-info

package info (click to toggle)
netcfg 1.160
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,532 kB
  • sloc: ansic: 5,361; sh: 183; makefile: 77
file content (62 lines) | stat: -rwxr-xr-x 1,211 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh

set -e

case $reason in
    BOUND6|RENEW6|REBIND6)
	;;
    *)
	exit 0
	;;
esac

# update /etc/resolv.conf based on received values
make_resolv_conf() {
	local new_resolv_conf

	if [ -n "$new_dhcp6_domain_search" ] || [ -n "$new_dhcp6_name_servers" ]; then
		new_resolv_conf=/etc/resolv.conf.dhclient-new
		rm -f $new_resolv_conf

		if [ -n "$new_dhcp6_domain_search" ]; then
			echo "search $new_dhcp6_domain_search" >> $new_resolv_conf
		fi

		if [ -n "$new_dhcp6_name_servers" ]; then
			for nameserver in $new_dhcp6_name_servers; do
				echo "nameserver $nameserver" >> $new_resolv_conf
			done
		else # keep 'old' nameservers
			grep -i '^nameserver' /etc/resolv.conf >> $new_resolv_conf
		fi

		mv $new_resolv_conf /etc/resolv.conf
	fi
}

if [ "$new_ip6_address" ] && [ "$new_ip6_prefixlen" ]; then
	ip -6 addr add $new_ip6_address/$new_ip6_prefixlen \
		dev $interface scope global
fi

make_resolv_conf

i=0
for srv in $new_dhcp6_name_servers; do
	echo "nameserver[$i] $srv"
	i=$(($i+1))
done

i=0
for srv in $new_dhcp6_domain_search; do
	echo "Domain search list[$i] $srv"
	i=$(($i+1))
done

i=0
for srv in $new_dhcp6_sntp_servers; do
	echo "NTP server[$i] $srv"
	i=$(($i+1))
done

echo "end"