Revision 4f1c942b hw/usb-net.c
b/hw/usb-net.c | ||
---|---|---|
1369 | 1369 |
return ret; |
1370 | 1370 |
} |
1371 | 1371 |
|
1372 |
static void usbnet_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
|
|
1372 |
static ssize_t usbnet_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
|
|
1373 | 1373 |
{ |
1374 | 1374 |
USBNetState *s = vc->opaque; |
1375 | 1375 |
struct rndis_packet_msg_type *msg; |
... | ... | |
1377 | 1377 |
if (s->rndis) { |
1378 | 1378 |
msg = (struct rndis_packet_msg_type *) s->in_buf; |
1379 | 1379 |
if (!s->rndis_state == RNDIS_DATA_INITIALIZED) |
1380 |
return; |
|
1380 |
return -1;
|
|
1381 | 1381 |
if (size + sizeof(struct rndis_packet_msg_type) > sizeof(s->in_buf)) |
1382 |
return; |
|
1382 |
return -1;
|
|
1383 | 1383 |
|
1384 | 1384 |
memset(msg, 0, sizeof(struct rndis_packet_msg_type)); |
1385 | 1385 |
msg->MessageType = cpu_to_le32(RNDIS_PACKET_MSG); |
... | ... | |
1398 | 1398 |
s->in_len = size + sizeof(struct rndis_packet_msg_type); |
1399 | 1399 |
} else { |
1400 | 1400 |
if (size > sizeof(s->in_buf)) |
1401 |
return; |
|
1401 |
return -1;
|
|
1402 | 1402 |
memcpy(s->in_buf, buf, size); |
1403 | 1403 |
s->in_len = size; |
1404 | 1404 |
} |
1405 | 1405 |
s->in_ptr = 0; |
1406 |
return size; |
|
1406 | 1407 |
} |
1407 | 1408 |
|
1408 | 1409 |
static int usbnet_can_receive(VLANClientState *vc) |
Also available in: Unified diff