This file is indexed.

/etc/vz/dists/scripts/etcnet-del_ip.sh is in vzctl 4.9.4-5.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh
#  Copyright (C) 2006-2007 Dmitry V. Levin <ldv@altlinux.org>
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
# Deletes IP address(es) from a container running a etcnet-based system.

VENET_DEV=venet0
IFACE_DIR=/etc/net/ifaces

# Function to quote argument for sed regexp.
quote_sed_regexp()
{
	local out="$*"
	if [ -z "${out##*[\[\].^\$\\/]*}" ]; then
		out="$(printf %s "$out" |sed 's/[].^$[\/]/\\&/g')" ||
			return 1
	fi
	printf %s "$out"
}

destroy_venet_config()
{
	local dir="$1"; shift

	rm -rf "$dir" ||
		error "Cannot destroy $dir" ${VZ_FS_NO_DISK_SPACE}
}

# Function to delete IP addresses for etcnet-based systems.
del_ip()
{
	set -- ${IP_ADDR}

	if [ "$IPDELALL" = 'yes' ]; then
		ifdown "$VENET_DEV"
		destroy_venet_config "$VENET_DEV"

		if [ -d /etc/hooks/del_ip.d ] &&
		   type run-parts >/dev/null 2>&1; then
			run-parts /etc/hooks/del_ip.d all
		fi
		return 0
	fi

	local ipm quoted
	for ipm; do
		ip_conv $ipm
		quoted="$(quote_sed_regexp "$_IP/$_MASK")"
		if [ -n "$_IPV6ADDR" ]; then
			sed -i -e "/^$quoted/d" "$VENET_DEV/ipv6address"
			if [ ! -s "$VENET_DEV/ipv6address" ]; then
				rm -f -- "$VENET_DEV/ipv6address"
				rm -f -- "$VENET_DEV/ipv6route"
				sed -i -e "/^CONFIG_IPV6/d" "$VENET_DEV/options"
			fi
		else
			sed -i -e "/^$quoted/d" "$VENET_DEV/ipv4address"
		fi
		ip addr del dev "$VENET_DEV" "$_IP/$_MASK"
	done

	if [ $# -gt 0 -a -d /etc/hooks/del_ip.d ] &&
	   type run-parts >/dev/null 2>&1; then
		run-parts /etc/hooks/del_ip.d "$@"
	fi
}

[ -d "$IFACE_DIR" ] &&
cd "$IFACE_DIR" &&
del_ip
exit 0