From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Alex Williamson <alex.williamson@hp.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
netdev@vger.kernel.org, kvm@vger.kernel.org
Subject: virtio_net: MAC address releated breakage if there is no MAC area in config
Date: Thu, 2 Apr 2009 13:33:24 +0200 [thread overview]
Message-ID: <200904021333.25119.borntraeger@de.ibm.com> (raw)
Hello,
commit 9c46f6d42f1b5627c49a5906cb5b315ad8716ff0
Author: Alex Williamson <alex.williamson@hp.com>
Date: Wed Feb 4 16:36:34 2009 -0800
virtio_net: Allow setting the MAC address of the NIC
Introduced an unconditional config->set to the MAC address field of
the device config.
+ } else {
random_ether_addr(dev->dev_addr);
+ vdev->config->set(vdev, offsetof(struct virtio_net_config, mac),
+ dev->dev_addr, dev->addr_len);
+ }
Since our kuli userspace sample does not set VIRTIO_NET_F_MAC, there is no
config space assigned for this device. When virtio_net tries to overwrite
the non-existing field, this triggers a bug.
virtio_net.h specifies:
struct virtio_net_config
{
/* The config defining mac address (if VIRTIO_NET_F_MAC) */
__u8 mac[6];
[...]
I read this as the mac config field is optional (similar to all the optional
fields we added in virtio_blk later).
I see two options:
1. Change our sample userspace to always allocate the config (like lguest and
qemu)
2. Change the kernel code to not write into the config unless a specific feature
bit is set. (e.g. VIRTIO_NET_F_SETMAC)
Opinions?
PS: The same is true for virtnet_set_mac_address. it crashes as well
next reply other threads:[~2009-04-02 11:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-02 11:33 Christian Borntraeger [this message]
2009-04-02 16:06 ` virtio_net: MAC address releated breakage if there is no MAC area in config Alex Williamson
2009-04-02 17:23 ` Christian Borntraeger
2009-04-04 23:40 ` David Miller
2009-04-05 13:19 ` Rusty Russell
2009-04-05 3:41 ` Rusty Russell
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=200904021333.25119.borntraeger@de.ibm.com \
--to=borntraeger@de.ibm.com \
--cc=alex.williamson@hp.com \
--cc=kvm@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
/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