From: Dor Laor <dlaor@redhat.com>
To: Alex Williamson <alex.williamson@hp.com>
Cc: kvm <kvm@vger.kernel.org>, qemu-devel <qemu-devel@nongnu.org>,
Mark McLoughlin <markmc@redhat.com>
Subject: Re: [PATCH 1/5] virtio-net: Allow setting the MAC address via set_config
Date: Wed, 14 Jan 2009 12:05:05 +0200 [thread overview]
Message-ID: <496DB8D1.2070101@redhat.com> (raw)
In-Reply-To: <1231881829.9095.191.camel@bling>
Alex Williamson wrote:
> Rename get_config for simplicity
>
> Signed-off-by: Alex Williamson <alex.williamson@hp.com>
> ---
>
> qemu/hw/virtio-net.c | 18 ++++++++++++++++--
> 1 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/qemu/hw/virtio-net.c b/qemu/hw/virtio-net.c
> index 1f9dc16..e9b3d46 100644
> --- a/qemu/hw/virtio-net.c
> +++ b/qemu/hw/virtio-net.c
> @@ -42,7 +42,7 @@ static VirtIONet *to_virtio_net(VirtIODevice *vdev)
> return (VirtIONet *)vdev;
> }
>
> -static void virtio_net_update_config(VirtIODevice *vdev, uint8_t *config)
> +static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config)
> {
> VirtIONet *n = to_virtio_net(vdev);
> struct virtio_net_config netcfg;
> @@ -51,6 +51,19 @@ static void virtio_net_update_config(VirtIODevice *vdev, uint8_t *config)
> memcpy(config, &netcfg, sizeof(netcfg));
> }
>
> +static void virtio_net_set_config(VirtIODevice *vdev, const uint8_t *config)
> +{
> + VirtIONet *n = to_virtio_net(vdev);
> + struct virtio_net_config netcfg;
> +
> + memcpy(&netcfg, config, sizeof(netcfg));
> +
> + if (memcmp(netcfg.mac, n->mac, 6)) {
> + memcpy(n->mac, netcfg.mac, 6);
> + qemu_format_nic_info_str(n->vc, n->mac);
> + }
> +}
> +
>
What if the guest will chose the host's mac?
Thinking about it, I don't think we should test that.
A concerned host mgmt app can add ebtables roles for such a case.
Maybe we can optionally allow/deny it?
next prev parent reply other threads:[~2009-01-14 10:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-13 21:23 [PATCH 1/5] virtio-net: Allow setting the MAC address via set_config Alex Williamson
2009-01-14 10:05 ` Dor Laor [this message]
2009-01-14 15:34 ` Alex Williamson
2009-01-14 16:41 ` [Qemu-devel] " Jamie Lokier
2009-01-14 22:06 ` Dor Laor
2009-01-14 22:14 ` Paul Brook
2009-01-15 13:11 ` Jamie Lokier
2009-01-15 13:12 ` Jamie Lokier
2009-01-15 13:41 ` Avi Kivity
2009-01-18 9:37 ` Dor Laor
2009-01-18 9:42 ` Avi Kivity
2009-01-14 22:08 ` Dor Laor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=496DB8D1.2070101@redhat.com \
--to=dlaor@redhat.com \
--cc=alex.williamson@hp.com \
--cc=kvm@vger.kernel.org \
--cc=markmc@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).