summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@amazon.com>2013-11-13 11:48:02 -0800
committerAnthony Liguori <aliguori@amazon.com>2013-11-13 11:48:03 -0800
commitb873a55cf45f1fbff7026de885848d52939d18e1 (patch)
treec13513f8d4083f9b31399ab3cc80ea12332866cf
parentdeb0f500651317863922964c87b4fa64eecdbd73 (diff)
parentcc386e96727442f5b67052d4e0a602f6f652ffe6 (diff)
downloadhqemu-b873a55cf45f1fbff7026de885848d52939d18e1.zip
hqemu-b873a55cf45f1fbff7026de885848d52939d18e1.tar.gz
Merge remote-tracking branch 'stefanha/net' into staging
# By Dmitry Fleytman (1) and others # Via Stefan Hajnoczi * stefanha/net: virtio-net: broken RX filtering logic fixed net: fix qemu_flush_queued_packets() in presence of a hub net: disallow to specify multicast MAC address Message-id: 1383928804-28866-1-git-send-email-stefanha@redhat.com Signed-off-by: Anthony Liguori <aliguori@amazon.com>
-rw-r--r--hw/net/virtio-net.c3
-rw-r--r--include/net/eth.h6
-rw-r--r--net/net.c7
3 files changed, 11 insertions, 5 deletions
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index ae51d96..613f144 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -657,7 +657,8 @@ static int virtio_net_handle_mac(VirtIONet *n, uint8_t cmd,
}
if (n->mac_table.in_use + mac_data.entries <= MAC_TABLE_ENTRIES) {
- s = iov_to_buf(iov, iov_cnt, 0, n->mac_table.macs,
+ s = iov_to_buf(iov, iov_cnt, 0,
+ &n->mac_table.macs[n->mac_table.in_use * ETH_ALEN],
mac_data.entries * ETH_ALEN);
if (s != mac_data.entries * ETH_ALEN) {
goto error;
diff --git a/include/net/eth.h b/include/net/eth.h
index 1d48e06..b3273b8 100644
--- a/include/net/eth.h
+++ b/include/net/eth.h
@@ -84,7 +84,7 @@ typedef struct ip_pseudo_header {
} ip_pseudo_header;
/* IPv6 address */
-struct in6_addr {
+struct in6_address {
union {
uint8_t __u6_addr8[16];
} __in6_u;
@@ -105,8 +105,8 @@ struct ip6_header {
uint8_t ip6_un3_ecn; /* 2 bits ECN, top 6 bits payload length */
} ip6_un3;
} ip6_ctlun;
- struct in6_addr ip6_src; /* source address */
- struct in6_addr ip6_dst; /* destination address */
+ struct in6_address ip6_src; /* source address */
+ struct in6_address ip6_dst; /* destination address */
};
struct ip6_ext_hdr {
diff --git a/net/net.c b/net/net.c
index c330c9a..0a88e68 100644
--- a/net/net.c
+++ b/net/net.c
@@ -27,6 +27,7 @@
#include "clients.h"
#include "hub.h"
#include "net/slirp.h"
+#include "net/eth.h"
#include "util.h"
#include "monitor/monitor.h"
@@ -442,7 +443,6 @@ void qemu_flush_queued_packets(NetClientState *nc)
if (net_hub_flush(nc->peer)) {
qemu_notify_event();
}
- return;
}
if (qemu_net_queue_flush(nc->incoming_queue)) {
/* We emptied the queue successfully, signal to the IO thread to repoll
@@ -689,6 +689,11 @@ static int net_init_nic(const NetClientOptions *opts, const char *name,
error_report("invalid syntax for ethernet address");
return -1;
}
+ if (nic->has_macaddr &&
+ is_multicast_ether_addr(nd->macaddr.a)) {
+ error_report("NIC cannot have multicast MAC address (odd 1st byte)");
+ return -1;
+ }
qemu_macaddr_default_if_unset(&nd->macaddr);
if (nic->has_vectors) {
OpenPOWER on IntegriCloud