-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1 iQEcBAABAgAGBQJXBHKfAAoJEO8Ells5jWIR2b8H/A3zxauQJ4dC5UwWguueG3qw PKmkUbOq78fy4l5QSUDmBBRl2XkQSr/8BXB5LnDzuzNtDYU+yx8MhXurA1hzkgxY Dp3rKjt+6n7HkaFreR0kKgOXHHjInJWXpuoJrKTHRQ9TtWFn9dhemk1CjIykH947 J8Xnt7FHCPxZcOqbN20vvgN/g2oG1CacCaldAsCNwG/5p/VMXSo2djnHAGsza3V5 v8hRo+X07tnqQfdyr3nMwTVRVlOBq5QMmTZxlNqVxSmXwKI3CFrzorArgSj030I7 hvnDJ0gRirxenNfuiqwqmKzyu18sCg+Ahp8U48Z6F+Kvmc/aoGmxTFY0FS7cL3M= =cwBg -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging # gpg: Signature made Wed 06 Apr 2016 03:21:19 BST using RSA key ID 398D6211 # gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" # 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: filter-buffer: fix segfault when starting qemu with status=off property rtl8139: using CP_TX_OWN for ownership transferring during tx net: fix OptsVisitor memory leak net: Allocating Large sized arrays to heap util: Improved qemu_hexmap() to include an ascii dump of the buffer Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
0f9d6bd210
@ -2046,7 +2046,7 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
|
||||
}
|
||||
|
||||
/* transfer ownership to target */
|
||||
txdw0 &= ~CP_RX_OWN;
|
||||
txdw0 &= ~CP_TX_OWN;
|
||||
|
||||
/* reset error indicator bits */
|
||||
txdw0 &= ~CP_TX_STATUS_UNF;
|
||||
|
@ -164,7 +164,7 @@ static void netfilter_set_status(Object *obj, const char *str, Error **errp)
|
||||
return;
|
||||
}
|
||||
nf->on = !nf->on;
|
||||
if (nfc->status_changed) {
|
||||
if (nf->netdev && nfc->status_changed) {
|
||||
nfc->status_changed(nf, errp);
|
||||
}
|
||||
}
|
||||
|
44
net/net.c
44
net/net.c
@ -81,34 +81,6 @@ int default_net = 1;
|
||||
/***********************************************************/
|
||||
/* network device redirectors */
|
||||
|
||||
#if defined(DEBUG_NET)
|
||||
static void hex_dump(FILE *f, const uint8_t *buf, int size)
|
||||
{
|
||||
int len, i, j, c;
|
||||
|
||||
for(i=0;i<size;i+=16) {
|
||||
len = size - i;
|
||||
if (len > 16)
|
||||
len = 16;
|
||||
fprintf(f, "%08x ", i);
|
||||
for(j=0;j<16;j++) {
|
||||
if (j < len)
|
||||
fprintf(f, " %02x", buf[i+j]);
|
||||
else
|
||||
fprintf(f, " ");
|
||||
}
|
||||
fprintf(f, " ");
|
||||
for(j=0;j<len;j++) {
|
||||
c = buf[i+j];
|
||||
if (c < ' ' || c > '~')
|
||||
c = '.';
|
||||
fprintf(f, "%c", c);
|
||||
}
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int get_str_sep(char *buf, int buf_size, const char **pp, int sep)
|
||||
{
|
||||
const char *p, *p1;
|
||||
@ -664,7 +636,7 @@ static ssize_t qemu_send_packet_async_with_flags(NetClientState *sender,
|
||||
|
||||
#ifdef DEBUG_NET
|
||||
printf("qemu_send_packet_async:\n");
|
||||
hex_dump(stdout, buf, size);
|
||||
qemu_hexdump((const char *)buf, stdout, "net", size);
|
||||
#endif
|
||||
|
||||
if (sender->link_down || !sender->peer) {
|
||||
@ -711,23 +683,28 @@ ssize_t qemu_send_packet_raw(NetClientState *nc, const uint8_t *buf, int size)
|
||||
static ssize_t nc_sendv_compat(NetClientState *nc, const struct iovec *iov,
|
||||
int iovcnt, unsigned flags)
|
||||
{
|
||||
uint8_t buf[NET_BUFSIZE];
|
||||
uint8_t *buf = NULL;
|
||||
uint8_t *buffer;
|
||||
size_t offset;
|
||||
ssize_t ret;
|
||||
|
||||
if (iovcnt == 1) {
|
||||
buffer = iov[0].iov_base;
|
||||
offset = iov[0].iov_len;
|
||||
} else {
|
||||
buf = g_new(uint8_t, NET_BUFSIZE);
|
||||
buffer = buf;
|
||||
offset = iov_to_buf(iov, iovcnt, 0, buf, sizeof(buf));
|
||||
offset = iov_to_buf(iov, iovcnt, 0, buf, NET_BUFSIZE);
|
||||
}
|
||||
|
||||
if (flags & QEMU_NET_PACKET_FLAG_RAW && nc->info->receive_raw) {
|
||||
return nc->info->receive_raw(nc, buffer, offset);
|
||||
ret = nc->info->receive_raw(nc, buffer, offset);
|
||||
} else {
|
||||
return nc->info->receive(nc, buffer, offset);
|
||||
ret = nc->info->receive(nc, buffer, offset);
|
||||
}
|
||||
|
||||
g_free(buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ssize_t qemu_deliver_packet_iov(NetClientState *sender,
|
||||
@ -1100,6 +1077,7 @@ int net_client_init(QemuOpts *opts, int is_netdev, Error **errp)
|
||||
}
|
||||
|
||||
error_propagate(errp, err);
|
||||
opts_visitor_cleanup(ov);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -18,21 +18,32 @@
|
||||
|
||||
void qemu_hexdump(const char *buf, FILE *fp, const char *prefix, size_t size)
|
||||
{
|
||||
unsigned int b;
|
||||
unsigned int b, len, i, c;
|
||||
|
||||
for (b = 0; b < size; b++) {
|
||||
if ((b % 16) == 0) {
|
||||
fprintf(fp, "%s: %04x:", prefix, b);
|
||||
for (b = 0; b < size; b += 16) {
|
||||
len = size - b;
|
||||
if (len > 16) {
|
||||
len = 16;
|
||||
}
|
||||
if ((b % 4) == 0) {
|
||||
fprintf(fp, "%s: %04x:", prefix, b);
|
||||
for (i = 0; i < 16; i++) {
|
||||
if ((i % 4) == 0) {
|
||||
fprintf(fp, " ");
|
||||
}
|
||||
fprintf(fp, " %02x", (unsigned char)buf[b]);
|
||||
if ((b % 16) == 15) {
|
||||
fprintf(fp, "\n");
|
||||
if (i < len) {
|
||||
fprintf(fp, " %02x", (unsigned char)buf[b + i]);
|
||||
} else {
|
||||
fprintf(fp, " ");
|
||||
}
|
||||
}
|
||||
if ((b % 16) != 0) {
|
||||
fprintf(fp, " ");
|
||||
for (i = 0; i < len; i++) {
|
||||
c = buf[b + i];
|
||||
if (c < ' ' || c > '~') {
|
||||
c = '.';
|
||||
}
|
||||
fprintf(fp, "%c", c);
|
||||
}
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user