summaryrefslogtreecommitdiff
path: root/emulators/qemu/files/pcap-patch-net_net.c
diff options
context:
space:
mode:
authorMuhammad Moinur Rahman <bofh@FreeBSD.org>2017-03-10 12:54:21 +0000
committerMuhammad Moinur Rahman <bofh@FreeBSD.org>2017-03-10 12:54:21 +0000
commitcf2484d8a11b91323cf9783f7685068689694b00 (patch)
tree32640703d95bca8ff9ecae9614ce63a733644af3 /emulators/qemu/files/pcap-patch-net_net.c
parent- Update to 7.7.2 (diff)
emulators/qemu: Update version 2.6.1=>2.8.0
- Fix ncurses build uses to use base version and remove from CONFIGURE_ARGS for OPTIONS usage [1] PR: 211973[1] Submitted by: ilavsky.martin@gmail.com[1]
Notes
Notes: svn path=/head/; revision=435826
Diffstat (limited to 'emulators/qemu/files/pcap-patch-net_net.c')
-rw-r--r--emulators/qemu/files/pcap-patch-net_net.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/emulators/qemu/files/pcap-patch-net_net.c b/emulators/qemu/files/pcap-patch-net_net.c
index 735ae04776d7..2744f44f18c8 100644
--- a/emulators/qemu/files/pcap-patch-net_net.c
+++ b/emulators/qemu/files/pcap-patch-net_net.c
@@ -1,5 +1,5 @@
---- net/net.c.orig 2016-04-14 20:19:54 UTC
-+++ net/net.c
+--- net/net.c.orig 2016-12-20 13:16:48.000000000 -0700
++++ net/net.c 2017-03-05 08:04:17.606428000 -0700
@@ -48,6 +48,11 @@
#include "net/filter.h"
#include "qapi/string-output-visitor.h"
@@ -12,7 +12,7 @@
/* Net bridge is currently not supported for W32. */
#if !defined(_WIN32)
# define CONFIG_NET_BRIDGE
-@@ -931,7 +936,223 @@ static int net_init_nic(const NetClientO
+@@ -933,7 +938,225 @@
return idx;
}
@@ -75,7 +75,7 @@
+}
+
+static NetClientInfo net_pcap_info = {
-+ .type = NET_CLIENT_OPTIONS_KIND_PCAP,
++ .type = NET_CLIENT_DRIVER_PCAP,
+ .size = sizeof(struct PCAPState),
+ .receive = pcap_receive,
+// .receive_raw = pcap_receive_raw,
@@ -87,10 +87,10 @@
+ * ... -net pcap,ifname="..."
+ */
+
-+int net_init_pcap(const NetClientOptions *opts,
++int net_init_pcap(const Netdev *netdev,
+ const char *name, NetClientState *peer, Error **errp)
+{
-+ const NetdevPcapOptions *pcap_opts = opts->u.pcap.data;
++ const NetdevPcapOptions *pcap_opts;
+ NetClientState *nc;
+ struct PCAPState *s;
+ const char *ifname;
@@ -100,6 +100,8 @@
+#endif
+ int i;
+
++ assert(netdev->type == NET_CLIENT_DRIVER_PCAP);
++ pcap_opts = &netdev->u.pcap;
+ if (!pcap_opts->has_ifname)
+ return -1;
+
@@ -113,13 +115,13 @@
+ fprintf(stderr, "qemu: pcap_create: %s\n", errbuf);
+ goto fail;
+ }
-
++
+#ifdef __FreeBSD__
+ /*
+ * We want to avoid passing oversize packets to the guest, which
+ * at least on FreeBSD can happen if the host interface uses tso
+ * (seen with an em(4) in this case) - so find out the host
-+ * interface's mtu and assume the guest is configured the same.
++ * interface's mtu and assume the guest is configured the same.
+ */
+ s->max_eth_frame_size = 1514;
+ i = socket(AF_INET, SOCK_DGRAM, 0);
@@ -147,7 +149,7 @@
+ pcap_perror(s->handle, (char *)"qemu: pcap_set_promisc:");
+ goto fail;
+ }
-+ if (pcap_activate(s->handle) != 0) {
++ if (pcap_activate(s->handle) != 0) {
+ pcap_perror(s->handle, (char *)"qemu: pcap_activate:");
+ goto fail;
+ }
@@ -219,7 +221,7 @@
+ }
+ qemu_set_fd_handler(i, pcap_send, NULL, s);
+#endif /* _WIN32 */
-+
+
+ return 0;
+
+fail:
@@ -233,16 +235,16 @@
+
+#endif
+
- static int (* const net_client_init_fun[NET_CLIENT_OPTIONS_KIND__MAX])(
- const NetClientOptions *opts,
+ static int (* const net_client_init_fun[NET_CLIENT_DRIVER__MAX])(
+ const Netdev *netdev,
const char *name,
-@@ -952,6 +1172,9 @@ static int (* const net_client_init_fun[
- #ifdef CONFIG_NET_BRIDGE
- [NET_CLIENT_OPTIONS_KIND_BRIDGE] = net_init_bridge,
+@@ -961,6 +1182,9 @@
+ #ifdef CONFIG_L2TPV3
+ [NET_CLIENT_DRIVER_L2TPV3] = net_init_l2tpv3,
#endif
+#ifdef CONFIG_PCAP
-+ [NET_CLIENT_OPTIONS_KIND_PCAP] = net_init_pcap,
++ [NET_CLIENT_DRIVER_PCAP] = net_init_pcap,
+#endif
- [NET_CLIENT_OPTIONS_KIND_HUBPORT] = net_init_hubport,
- #ifdef CONFIG_VHOST_NET_USED
- [NET_CLIENT_OPTIONS_KIND_VHOST_USER] = net_init_vhost_user,
+ };
+
+