diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2021-04-08 16:45:31 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2021-04-08 16:45:31 +0100 |
| commit | ce69aa92d71e13db9c3702a8e8305e8d2463aeb8 (patch) | |
| tree | db523c9f40dd1e69e3f0a829d20eb36898c25597 /net/tap-win32.c | |
| parent | d8724020dd13c88a72fc391a6a2cf63abbd3dcca (diff) | |
| parent | 21df394d9e2ffce9fa308f496d1ae228cf6cdb57 (diff) | |
| download | focaccia-qemu-ce69aa92d71e13db9c3702a8e8305e8d2463aeb8.tar.gz focaccia-qemu-ce69aa92d71e13db9c3702a8e8305e8d2463aeb8.zip | |
Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging
# gpg: Signature made Thu 08 Apr 2021 10:34:24 BST # gpg: using RSA key EF04965B398D6211 # gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" [marginal] # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 215D 46F4 8246 689E C77F 3562 EF04 965B 398D 6211 * remotes/jasowang/tags/net-pull-request: tap-win32: correctly recycle buffers Revert "qapi: net: Add query-netdev command" Revert "tests: Add tests for query-netdev command" Revert "net: Move NetClientState.info_str to dynamic allocations" Revert "hmp: Use QAPI NetdevInfo in hmp_info_network" Revert "net: Do not fill legacy info_str for backends" Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'net/tap-win32.c')
| -rw-r--r-- | net/tap-win32.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/net/tap-win32.c b/net/tap-win32.c index d7c2a8759c..897bd18e32 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -686,7 +686,7 @@ static ssize_t tap_receive(NetClientState *nc, const uint8_t *buf, size_t size) static void tap_win32_send(void *opaque) { TAPState *s = opaque; - uint8_t *buf; + uint8_t *buf, *orig_buf; int max_size = 4096; int size; uint8_t min_pkt[ETH_ZLEN]; @@ -694,6 +694,8 @@ static void tap_win32_send(void *opaque) size = tap_win32_read(s->handle, &buf, max_size); if (size > 0) { + orig_buf = buf; + if (!s->nc.peer->do_not_pad) { if (eth_pad_short_frame(min_pkt, &min_pktsz, buf, size)) { buf = min_pkt; @@ -702,7 +704,7 @@ static void tap_win32_send(void *opaque) } qemu_send_packet(&s->nc, buf, size); - tap_win32_free_buffer(s->handle, buf); + tap_win32_free_buffer(s->handle, orig_buf); } } @@ -778,7 +780,6 @@ static int tap_win32_init(NetClientState *peer, const char *model, NetClientState *nc; TAPState *s; tap_win32_overlapped_t *handle; - NetdevTapOptions *stored; if (tap_win32_open(&handle, ifname) < 0) { printf("tap: Could not open '%s'\n", ifname); @@ -789,13 +790,8 @@ static int tap_win32_init(NetClientState *peer, const char *model, s = DO_UPCAST(TAPState, nc, nc); - /* Store startup parameters */ - nc->stored_config = g_new0(NetdevInfo, 1); - nc->stored_config->type = NET_BACKEND_TAP; - stored = &nc->stored_config->u.tap; - - stored->has_ifname = true; - stored->ifname = g_strdup(ifname); + snprintf(s->nc.info_str, sizeof(s->nc.info_str), + "tap: ifname=%s", ifname); s->handle = handle; |