File: 426796.patch

package info (click to toggle)
vserver-debiantools 0.7.2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 212 kB
  • ctags: 24
  • sloc: sh: 1,609; makefile: 90
file content (33 lines) | stat: -rw-r--r-- 1,209 bytes parent folder | download | duplicates (3)
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
Hi,

this is a suggested fix for bug #426796: if the host uses 127.0.0.1 as
a nameserver, this cannot be used as a nameserver inside the
container.

One (partial) solution would be, to replace 127.0.0.1 with the host
address on the interface given for the vserver subnet.  This mewthod
could be implemented by the following patch:

----------------------------------------------------------------------
--- /usr/sbin/newvserver.orig	2007-04-10 04:49:31.000000000 +0100
+++ /usr/sbin/newvserver	2007-08-19 16:59:27.000000000 +0100
@@ -477,7 +477,10 @@
 EOF
 
 # grab DNS servers from the host-server for `resolv.conf'
-(echo search $VDOMAIN ; grep '^nameserver' /etc/resolv.conf) \
+HOST_IP=$(ip -o addr show dev $INTERFACE primary scope global | \
+          sed -n 's;.*inet \([^/]*\)/.*;\1;p')
+(echo search $VDOMAIN;
+ grep '^nameserver' /etc/resolv.conf | sed "s/127.0.0.1/$HOST_IP/") \
     > "$VROOTDIR/$VHOST/etc/resolv.conf"
 
 # If there is a proxy server statement in-use in the Host server, copy it across
----------------------------------------------------------------------

This will work as long as the hosts nameserver listens on $INTERFACE.

I hope this helps,
Jochen
-- 
http://seehuhn.de/