#include "qemu/osdep.h"
#include "tap_int.h"
-#include "qemu-common.h"
#include "clients.h" /* net_init_tap */
#include "net/eth.h"
#include "net/net.h"
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];
size = tap_win32_read(s->handle, &buf, max_size);
if (size > 0) {
- if (!s->nc.peer->do_not_pad) {
+ orig_buf = buf;
+
+ if (net_peer_needs_padding(&s->nc)) {
if (eth_pad_short_frame(min_pkt, &min_pktsz, buf, size)) {
buf = min_pkt;
size = min_pktsz;
}
qemu_send_packet(&s->nc, buf, size);
- tap_win32_free_buffer(s->handle, buf);
+ tap_win32_free_buffer(s->handle, orig_buf);
}
}
}
static void tap_set_offload(NetClientState *nc, int csum, int tso4,
- int tso6, int ecn, int ufo)
+ int tso6, int ecn, int ufo, int uso4, int uso6)
{
}
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);
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);
+ qemu_set_info_str(&s->nc, "tap: ifname=%s", ifname);
s->handle = handle;
assert(netdev->type == NET_CLIENT_DRIVER_TAP);
tap = &netdev->u.tap;
- if (!tap->has_ifname) {
+ if (!tap->ifname) {
error_report("tap: no interface name");
return -1;
}