* [PATCH 1/2] kvm tools: Don't copy network autoconfiguration script
@ 2011-09-14 16:28 Sasha Levin
2011-09-14 16:28 ` [PATCH 2/2] kvm tools: Use host's resolv.conf within the guest Sasha Levin
0 siblings, 1 reply; 10+ messages in thread
From: Sasha Levin @ 2011-09-14 16:28 UTC (permalink / raw)
To: penberg; +Cc: kvm, mingo, asias.hejun, gorcunov, Sasha Levin
Network autoconfiguration was moved to the kernel, but the setup code still
tried to copy the script over to the rootfs. This prevented from /virt/ to
be properly created.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
tools/kvm/builtin-setup.c | 13 -------------
1 files changed, 0 insertions(+), 13 deletions(-)
diff --git a/tools/kvm/builtin-setup.c b/tools/kvm/builtin-setup.c
index c93eec3..6b8eb5b 100644
--- a/tools/kvm/builtin-setup.c
+++ b/tools/kvm/builtin-setup.c
@@ -129,15 +129,6 @@ static int copy_init(const char *guestfs_name)
return copy_file("guest/init", path);
}
-static int copy_net(const char *guestfs_name)
-{
- char path[PATH_MAX];
-
- snprintf(path, PATH_MAX, "%s%s%s/virt/setnet.sh", HOME_DIR, KVM_PID_FILE_PATH, guestfs_name);
-
- return copy_file("guest/setnet.sh", path);
-}
-
static int make_guestfs_symlink(const char *guestfs_name, const char *path)
{
char target[PATH_MAX];
@@ -195,10 +186,6 @@ static int do_setup(const char *guestfs_name)
make_guestfs_symlink(guestfs_name, guestfs_symlinks[i]);
}
- ret = copy_net(guestfs_name);
- if (ret < 0)
- return ret;
-
return copy_init(guestfs_name);
}
--
1.7.6.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/2] kvm tools: Use host's resolv.conf within the guest
2011-09-14 16:28 [PATCH 1/2] kvm tools: Don't copy network autoconfiguration script Sasha Levin
@ 2011-09-14 16:28 ` Sasha Levin
2011-09-15 5:29 ` Pekka Enberg
0 siblings, 1 reply; 10+ messages in thread
From: Sasha Levin @ 2011-09-14 16:28 UTC (permalink / raw)
To: penberg; +Cc: kvm, mingo, asias.hejun, gorcunov, Sasha Levin
Since kernel IP autoconfiguration doesn't set up /etc/resolv.conf, we'll
use the one located within the host, since this was anyway what we simulated
within the DHCP offer packets.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
tools/kvm/builtin-run.c | 2 ++
tools/kvm/builtin-setup.c | 9 +++++++++
tools/kvm/include/kvm/builtin-setup.h | 1 +
3 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c
index 5dafb15..9d61088 100644
--- a/tools/kvm/builtin-run.c
+++ b/tools/kvm/builtin-run.c
@@ -129,6 +129,7 @@ static int img_name_parser(const struct option *opt, const char *arg, int unset)
die("Unable to initialize virtio 9p");
if (virtio_9p__register(kvm, "/", "hostfs") < 0)
die("Unable to initialize virtio 9p");
+ kvm_setup_resolv(arg);
using_rootfs = custom_rootfs = 1;
return 0;
}
@@ -750,6 +751,7 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
char tmp[PATH_MAX];
kvm_setup_create_new("default");
+ kvm_setup_resolv("default");
snprintf(tmp, PATH_MAX, "%s%s%s", HOME_DIR, KVM_PID_FILE_PATH, "default");
if (virtio_9p__register(kvm, tmp, "/dev/root") < 0)
diff --git a/tools/kvm/builtin-setup.c b/tools/kvm/builtin-setup.c
index 6b8eb5b..3e569e7 100644
--- a/tools/kvm/builtin-setup.c
+++ b/tools/kvm/builtin-setup.c
@@ -168,6 +168,15 @@ static void make_guestfs_dir(const char *guestfs_name, const char *dir)
make_dir(name);
}
+void kvm_setup_resolv(const char *guestfs_name)
+{
+ char path[PATH_MAX];
+
+ snprintf(path, PATH_MAX, "%s%s%s/etc/resolv.conf", HOME_DIR, KVM_PID_FILE_PATH, guestfs_name);
+
+ copy_file("/etc/resolv.conf", path);
+}
+
static int do_setup(const char *guestfs_name)
{
unsigned int i;
diff --git a/tools/kvm/include/kvm/builtin-setup.h b/tools/kvm/include/kvm/builtin-setup.h
index 6e183a1..f70ae78 100644
--- a/tools/kvm/include/kvm/builtin-setup.h
+++ b/tools/kvm/include/kvm/builtin-setup.h
@@ -4,5 +4,6 @@
int kvm_cmd_setup(int argc, const char **argv, const char *prefix);
void kvm_setup_help(void);
int kvm_setup_create_new(const char *guestfs_name);
+void kvm_setup_resolv(const char *guestfs_name);
#endif
--
1.7.6.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] kvm tools: Use host's resolv.conf within the guest
2011-09-14 16:28 ` [PATCH 2/2] kvm tools: Use host's resolv.conf within the guest Sasha Levin
@ 2011-09-15 5:29 ` Pekka Enberg
2011-09-15 5:36 ` Sasha Levin
0 siblings, 1 reply; 10+ messages in thread
From: Pekka Enberg @ 2011-09-15 5:29 UTC (permalink / raw)
To: Sasha Levin; +Cc: kvm, mingo, asias.hejun, gorcunov
On Wed, Sep 14, 2011 at 7:28 PM, Sasha Levin <levinsasha928@gmail.com> wrote:
> Since kernel IP autoconfiguration doesn't set up /etc/resolv.conf, we'll
> use the one located within the host, since this was anyway what we simulated
> within the DHCP offer packets.
>
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Wouldn't a symlink to /host/etc/resolv.conf be more appropriate?
Remember, we're supposed to only need to setup the shared rootfs once.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] kvm tools: Use host's resolv.conf within the guest
2011-09-15 5:29 ` Pekka Enberg
@ 2011-09-15 5:36 ` Sasha Levin
2011-09-15 5:44 ` Pekka Enberg
0 siblings, 1 reply; 10+ messages in thread
From: Sasha Levin @ 2011-09-15 5:36 UTC (permalink / raw)
To: Pekka Enberg; +Cc: kvm, mingo, asias.hejun, gorcunov
On Thu, 2011-09-15 at 08:29 +0300, Pekka Enberg wrote:
> On Wed, Sep 14, 2011 at 7:28 PM, Sasha Levin <levinsasha928@gmail.com> wrote:
> > Since kernel IP autoconfiguration doesn't set up /etc/resolv.conf, we'll
> > use the one located within the host, since this was anyway what we simulated
> > within the DHCP offer packets.
> >
> > Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
>
> Wouldn't a symlink to /host/etc/resolv.conf be more appropriate?
> Remember, we're supposed to only need to setup the shared rootfs once.
It would mean the guest can screw up with the host's networking.
--
Sasha.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] kvm tools: Use host's resolv.conf within the guest
2011-09-15 5:36 ` Sasha Levin
@ 2011-09-15 5:44 ` Pekka Enberg
2011-09-15 6:00 ` Sasha Levin
0 siblings, 1 reply; 10+ messages in thread
From: Pekka Enberg @ 2011-09-15 5:44 UTC (permalink / raw)
To: Sasha Levin; +Cc: kvm, mingo, asias.hejun, gorcunov
On 9/15/11 8:36 AM, Sasha Levin wrote:
> On Thu, 2011-09-15 at 08:29 +0300, Pekka Enberg wrote:
>> On Wed, Sep 14, 2011 at 7:28 PM, Sasha Levin<levinsasha928@gmail.com> wrote:
>>> Since kernel IP autoconfiguration doesn't set up /etc/resolv.conf, we'll
>>> use the one located within the host, since this was anyway what we simulated
>>> within the DHCP offer packets.
>>>
>>> Signed-off-by: Sasha Levin<levinsasha928@gmail.com>
>>
>> Wouldn't a symlink to /host/etc/resolv.conf be more appropriate?
>> Remember, we're supposed to only need to setup the shared rootfs once.
>
> It would mean the guest can screw up with the host's networking.
How? You're not supposed to run the tool.
Pekka
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] kvm tools: Use host's resolv.conf within the guest
2011-09-15 5:44 ` Pekka Enberg
@ 2011-09-15 6:00 ` Sasha Levin
2011-09-15 6:04 ` Pekka Enberg
0 siblings, 1 reply; 10+ messages in thread
From: Sasha Levin @ 2011-09-15 6:00 UTC (permalink / raw)
To: Pekka Enberg; +Cc: kvm, mingo, asias.hejun, gorcunov
On Thu, 2011-09-15 at 08:44 +0300, Pekka Enberg wrote:
> On 9/15/11 8:36 AM, Sasha Levin wrote:
> > On Thu, 2011-09-15 at 08:29 +0300, Pekka Enberg wrote:
> >> On Wed, Sep 14, 2011 at 7:28 PM, Sasha Levin<levinsasha928@gmail.com> wrote:
> >>> Since kernel IP autoconfiguration doesn't set up /etc/resolv.conf, we'll
> >>> use the one located within the host, since this was anyway what we simulated
> >>> within the DHCP offer packets.
> >>>
> >>> Signed-off-by: Sasha Levin<levinsasha928@gmail.com>
> >>
> >> Wouldn't a symlink to /host/etc/resolv.conf be more appropriate?
> >> Remember, we're supposed to only need to setup the shared rootfs once.
> >
> > It would mean the guest can screw up with the host's networking.
>
> How? You're not supposed to run the tool.
Hm? If you it to the host's resolv.conf, a guest can edit host's file,
no?
Might even be not on purpose... For example, simply running dhcpcd on
the guest.
--
Sasha.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] kvm tools: Use host's resolv.conf within the guest
2011-09-15 6:00 ` Sasha Levin
@ 2011-09-15 6:04 ` Pekka Enberg
2011-09-15 6:04 ` Sasha Levin
0 siblings, 1 reply; 10+ messages in thread
From: Pekka Enberg @ 2011-09-15 6:04 UTC (permalink / raw)
To: Sasha Levin; +Cc: kvm, mingo, asias.hejun, gorcunov
On Thu, Sep 15, 2011 at 9:00 AM, Sasha Levin <levinsasha928@gmail.com> wrote:
> Hm? If you it to the host's resolv.conf, a guest can edit host's file,
> no?
>
> Might even be not on purpose... For example, simply running dhcpcd on
> the guest.
How is that going to happen if you're not running kvmtool as root?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] kvm tools: Use host's resolv.conf within the guest
2011-09-15 6:04 ` Pekka Enberg
@ 2011-09-15 6:04 ` Sasha Levin
2011-09-15 6:22 ` Pekka Enberg
0 siblings, 1 reply; 10+ messages in thread
From: Sasha Levin @ 2011-09-15 6:04 UTC (permalink / raw)
To: Pekka Enberg; +Cc: kvm, mingo, asias.hejun, gorcunov
On Thu, 2011-09-15 at 09:04 +0300, Pekka Enberg wrote:
> On Thu, Sep 15, 2011 at 9:00 AM, Sasha Levin <levinsasha928@gmail.com> wrote:
> > Hm? If you it to the host's resolv.conf, a guest can edit host's file,
> > no?
> >
> > Might even be not on purpose... For example, simply running dhcpcd on
> > the guest.
>
> How is that going to happen if you're not running kvmtool as root?
In that case, dhcpcd in the guest will simply break because it can't
modify resolv.conf, no?
--
Sasha.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] kvm tools: Use host's resolv.conf within the guest
2011-09-15 6:04 ` Sasha Levin
@ 2011-09-15 6:22 ` Pekka Enberg
2011-09-15 7:11 ` Sasha Levin
0 siblings, 1 reply; 10+ messages in thread
From: Pekka Enberg @ 2011-09-15 6:22 UTC (permalink / raw)
To: Sasha Levin; +Cc: kvm, mingo, asias.hejun, gorcunov
On 9/15/11 9:04 AM, Sasha Levin wrote:
> On Thu, 2011-09-15 at 09:04 +0300, Pekka Enberg wrote:
>> On Thu, Sep 15, 2011 at 9:00 AM, Sasha Levin<levinsasha928@gmail.com> wrote:
>>> Hm? If you it to the host's resolv.conf, a guest can edit host's file,
>>> no?
>>>
>>> Might even be not on purpose... For example, simply running dhcpcd on
>>> the guest.
>>
>> How is that going to happen if you're not running kvmtool as root?
>
> In that case, dhcpcd in the guest will simply break because it can't
> modify resolv.conf, no?
Yes. Why is that a problem? You're not supposed to launch a dhcp client
when using shared rootfs because kvmtool takes care of that for you.
Pekka
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] kvm tools: Use host's resolv.conf within the guest
2011-09-15 6:22 ` Pekka Enberg
@ 2011-09-15 7:11 ` Sasha Levin
0 siblings, 0 replies; 10+ messages in thread
From: Sasha Levin @ 2011-09-15 7:11 UTC (permalink / raw)
To: Pekka Enberg; +Cc: kvm, mingo, asias.hejun, gorcunov
On Thu, 2011-09-15 at 09:22 +0300, Pekka Enberg wrote:
> On 9/15/11 9:04 AM, Sasha Levin wrote:
> > On Thu, 2011-09-15 at 09:04 +0300, Pekka Enberg wrote:
> >> On Thu, Sep 15, 2011 at 9:00 AM, Sasha Levin<levinsasha928@gmail.com> wrote:
> >>> Hm? If you it to the host's resolv.conf, a guest can edit host's file,
> >>> no?
> >>>
> >>> Might even be not on purpose... For example, simply running dhcpcd on
> >>> the guest.
> >>
> >> How is that going to happen if you're not running kvmtool as root?
> >
> > In that case, dhcpcd in the guest will simply break because it can't
> > modify resolv.conf, no?
>
> Yes. Why is that a problem? You're not supposed to launch a dhcp client
> when using shared rootfs because kvmtool takes care of that for you.
Why? Testing a brand new dhcp client for example :)
We can't block the user from editing guest configuration files...
--
Sasha.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-09-15 7:12 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-14 16:28 [PATCH 1/2] kvm tools: Don't copy network autoconfiguration script Sasha Levin
2011-09-14 16:28 ` [PATCH 2/2] kvm tools: Use host's resolv.conf within the guest Sasha Levin
2011-09-15 5:29 ` Pekka Enberg
2011-09-15 5:36 ` Sasha Levin
2011-09-15 5:44 ` Pekka Enberg
2011-09-15 6:00 ` Sasha Levin
2011-09-15 6:04 ` Pekka Enberg
2011-09-15 6:04 ` Sasha Levin
2011-09-15 6:22 ` Pekka Enberg
2011-09-15 7:11 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).