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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
http://556.bugzilla.openvz.org/attachment.cgi?id=829
We need to test this patch. Hey, anybody?
diff --git a/Makefile.am b/Makefile.am
index 3b67cd8..ae05b3b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -53,6 +53,7 @@ DISTRO_TARGETS = \
$(DISTRO_TARGETS):
$(MAKE) $(AM_MAKEFLAGS) -C etc $@
+ $(MAKE) $(AM_MAKEFLAGS) -C scripts $@
install-data-hook:
@echo
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index a2bde7e..85ea8fd 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -22,7 +22,8 @@ vzlib_SCRIPTS = \
vps-functions \
vps-net_add \
vps-net_del \
- vps-stop
+ vps-stop \
+ ifup-vz-arp
vzcron_SCRIPTS = \
vpsnetclean \
@@ -35,3 +36,36 @@ EXTRA_DIST = \
CLEANFILES = \
$(vzlib_SCRIPTS) \
$(vzcron_SCRIPTS)
+
+# FIXME: what to do in case DESTDIR is set? I guess nothing...
+install-redhat:
+ if [ ! -e /sbin/ifup-local ]; then \
+ ln -sf @PKGLIBDIR@/scripts/ifup-vz-arp /sbin/ifup-local; \
+ else \
+ @echo; \
+ @echo " ***************************************************"; \
+ @echo " WARNING: /sbin/ifup-local is present!"; \
+ @echo " You have to manually edit /sbin/ifup-local so that "; \
+ @echo " @PKGLIBDIR@/scripts/ifup-vz-arp"; \
+ @echo " is called from it."; \
+ @echo " ***************************************************"; \
+ @echo; \
+ fi
+
+
+install-suse:
+ ln -sf @PKGLIBDIR@/scripts/ifup-vz-arp /etc/sysconfig/network/if-up.d/
+
+install-debian:
+ ln -sf @PKGLIBDIR@/scripts/ifup-vz-arp /etc/network/if-up.d/
+
+install-gentoo:
+ @echo
+ @echo " ***************************************************"
+ @echo " Please add the following code to /etc/conf.d/net:"
+ @echo
+ @echo "postup() {"
+ @echo " @PKGLIBDIR@/scripts/ifup-vz-arp" '"${IFACE}"'
+ @echo "}"
+ @echo " ***************************************************"
+ @echo
diff --git a/scripts/ifup-vz-arp.in b/scripts/ifup-vz-arp.in
new file mode 100755
index 0000000..7e2346b
--- /dev/null
+++ b/scripts/ifup-vz-arp.in
@@ -0,0 +1,25 @@
+#!/bin/bash
+# Copyright (C) 2008, Parallels, Inc. All rights reserved.
+#
+# Update ARP table for all containers on interface up
+
+[ ! -f /proc/vz/veinfo ] && exit 0
+
+test -f @PKGLIBDIR@/scripts/vps-functions || exit 1
+test -f @PKGCONFDIR@/vz.conf || exit 1
+. @PKGLIBDIR@/scripts/vps-functions
+. @PKGCONFDIR@/vz.conf
+
+update_arp()
+{
+ local veip
+ for veip in $(awk '!/^Version/ { print $1 }' /proc/vz/veip); do
+ vzarp add ${veip}
+ done
+}
+
+DEV=$1
+[ -z "${DEV}" ] && exit 0
+NETDEVICES="${DEV}"
+update_arp
+exit 0
diff --git a/vzctl.spec b/vzctl.spec
index ae3ed8c..adc6702 100644
--- a/vzctl.spec
+++ b/vzctl.spec
@@ -108,6 +108,7 @@ rm -rf $RPM_BUILD_ROOT
%attr(755,root,root) %{_sbindir}/vzmigrate
%attr(755,root,root) %{_scriptdir}/vpsreboot
%attr(755,root,root) %{_scriptdir}/vpsnetclean
+%attr(755,root,root) %{_scriptdir}/ifup-vz-arp
%attr(644,root,root) %{_logrdir}/vzctl
%attr(644,root,root) %{_distconfdir}/distribution.conf-template
%attr(644,root,root) %{_distconfdir}/default
@@ -161,6 +162,11 @@ if [ -f /etc/SuSE-release ]; then
for file in ${NET_CFG}; do
ln -sf /etc/sysconfig/network-scripts/${file} /etc/sysconfig/network/scripts/${file}
done
+ ln -sf /usr/share/vzctl/scripts/ifup-vz-arp /etc/sysconfig/network/if-up.d/ifup-arp
+else # RedHat/Fedora/CentOS case
+ if [ ! -e /sbin/ifup-local ]; then
+ ln -sf /usr/share/vzctl/scripts/ifup-vz-arp /sbin/ifup-local
+ fi
fi
%preun
|