* [Qemu-devel] [PULL 1/2] Revert "Change net/socket.c to use socket_*() functions"
2016-08-30 15:56 [Qemu-devel] [PULL 0/2] Last minute fixes for 2.7.0-rc5 Paolo Bonzini
@ 2016-08-30 15:56 ` Paolo Bonzini
2016-08-30 15:56 ` [Qemu-devel] [PULL 2/2] optionrom: cope with multiple -O options Paolo Bonzini
2016-08-30 16:03 ` [Qemu-devel] [PULL 0/2] Last minute fixes for 2.7.0-rc5 no-reply
2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2016-08-30 15:56 UTC (permalink / raw)
To: qemu-devel
Since commit 7e8449594c929, the socket connect code is blocking, because
calling socket_connect() without callback is blocking. This reverts the
commit.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
net/socket.c | 55 ++++++++++++++++++++++++++++---------------------------
1 file changed, 28 insertions(+), 27 deletions(-)
diff --git a/net/socket.c b/net/socket.c
index 17e635d..3f98eef 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -489,30 +489,41 @@ static int net_socket_listen_init(NetClientState *peer,
{
NetClientState *nc;
NetSocketState *s;
- SocketAddress *saddr;
- int ret;
- Error *local_error = NULL;
+ struct sockaddr_in saddr;
+ int fd, ret;
- saddr = socket_parse(host_str, &local_error);
- if (saddr == NULL) {
- error_report_err(local_error);
+ if (parse_host_port(&saddr, host_str) < 0)
+ return -1;
+
+ fd = qemu_socket(PF_INET, SOCK_STREAM, 0);
+ if (fd < 0) {
+ perror("socket");
return -1;
}
+ qemu_set_nonblock(fd);
- ret = socket_listen(saddr, &local_error);
+ socket_set_fast_reuse(fd);
+
+ ret = bind(fd, (struct sockaddr *)&saddr, sizeof(saddr));
if (ret < 0) {
- error_report_err(local_error);
+ perror("bind");
+ closesocket(fd);
+ return -1;
+ }
+ ret = listen(fd, 0);
+ if (ret < 0) {
+ perror("listen");
+ closesocket(fd);
return -1;
}
nc = qemu_new_net_client(&net_socket_info, peer, model, name);
s = DO_UPCAST(NetSocketState, nc, nc);
s->fd = -1;
- s->listen_fd = ret;
+ s->listen_fd = fd;
s->nc.link_down = true;
qemu_set_fd_handler(s->listen_fd, net_socket_accept, NULL, s);
- qapi_free_SocketAddress(saddr);
return 0;
}
@@ -523,15 +534,10 @@ static int net_socket_connect_init(NetClientState *peer,
{
NetSocketState *s;
int fd, connected, ret;
- char *addr_str;
- SocketAddress *saddr;
- Error *local_error = NULL;
+ struct sockaddr_in saddr;
- saddr = socket_parse(host_str, &local_error);
- if (saddr == NULL) {
- error_report_err(local_error);
+ if (parse_host_port(&saddr, host_str) < 0)
return -1;
- }
fd = qemu_socket(PF_INET, SOCK_STREAM, 0);
if (fd < 0) {
@@ -539,9 +545,10 @@ static int net_socket_connect_init(NetClientState *peer,
return -1;
}
qemu_set_nonblock(fd);
+
connected = 0;
for(;;) {
- ret = socket_connect(saddr, &local_error, NULL, NULL);
+ ret = connect(fd, (struct sockaddr *)&saddr, sizeof(saddr));
if (ret < 0) {
if (errno == EINTR || errno == EWOULDBLOCK) {
/* continue */
@@ -550,7 +557,7 @@ static int net_socket_connect_init(NetClientState *peer,
errno == EINVAL) {
break;
} else {
- error_report_err(local_error);
+ perror("connect");
closesocket(fd);
return -1;
}
@@ -562,15 +569,9 @@ static int net_socket_connect_init(NetClientState *peer,
s = net_socket_fd_init(peer, model, name, fd, connected);
if (!s)
return -1;
-
- addr_str = socket_address_to_string(saddr, &local_error);
- if (addr_str == NULL)
- return -1;
-
snprintf(s->nc.info_str, sizeof(s->nc.info_str),
- "socket: connect to %s", addr_str);
- qapi_free_SocketAddress(saddr);
- g_free(addr_str);
+ "socket: connect to %s:%d",
+ inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
return 0;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PULL 2/2] optionrom: cope with multiple -O options
2016-08-30 15:56 [Qemu-devel] [PULL 0/2] Last minute fixes for 2.7.0-rc5 Paolo Bonzini
2016-08-30 15:56 ` [Qemu-devel] [PULL 1/2] Revert "Change net/socket.c to use socket_*() functions" Paolo Bonzini
@ 2016-08-30 15:56 ` Paolo Bonzini
2016-08-30 16:03 ` [Qemu-devel] [PULL 0/2] Last minute fixes for 2.7.0-rc5 no-reply
2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2016-08-30 15:56 UTC (permalink / raw)
To: qemu-devel
Reproducer:
CFLAGS="-g3 -O0" ./configure --target-list=aarch64-softmmu,arm-softmmu --enable-vhost-net --enable-virtfs
Here CFLAGS ends up with "-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 ... -g3 -O0"
and pc-bios/optionrom/Makefile forgets to add the -O2 it needs.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
pc-bios/optionrom/Makefile | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index 9bdc497..afa48f1 100644
--- a/pc-bios/optionrom/Makefile
+++ b/pc-bios/optionrom/Makefile
@@ -10,10 +10,7 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/optionrom)
.PHONY : all clean build-all
# Compiling with no optimization creates ROMs that are too large
-ifeq ($(filter -O%, $(CFLAGS)),)
-override CFLAGS += -O2
-endif
-ifeq ($(filter -O%, $(CFLAGS)),-O0)
+ifeq ($(lastword $(filter -O%, -O0 $(CFLAGS))),-O0)
override CFLAGS += -O2
endif
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread