genode/repos/ports/src/app/netperf/omni.patch
2014-05-27 11:14:43 +02:00

94 lines
2.9 KiB
Diff

+++ src/app/netperf/src/netserver.c
@@ -567,7 +567,7 @@
int do_inet;
int no_name = 0;
#ifdef AF_INET6
- int do_inet6;
+ int do_inet6 = 0;
#endif
if (debug) {
+++ src/app/netperf/src/nettest_omni.c (working copy)
@@ -3348,7 +3348,7 @@
get_transport_cong_control(SOCKET socket, int protocol, char cong_control[], int len)
{
#ifdef TCP_CONGESTION
- int my_len = len;
+ socklen_t my_len = len;
if (protocol != IPPROTO_TCP) {
strncpy(cong_control,"TCP Only",len);
}
@@ -3477,7 +3477,7 @@
struct sockaddr_storage remote_addr;
struct sockaddr_storage my_addr;
- int remote_addr_len = sizeof(remote_addr);
+ netperf_socklen_t remote_addr_len = sizeof(remote_addr);
netperf_socklen_t my_addr_len = sizeof(my_addr);
SOCKET data_socket;
@@ -4892,11 +4892,11 @@
struct sockaddr_storage myaddr_in, peeraddr_in;
int peeraddr_set = 0;
- SOCKET s_listen, data_socket;
+ SOCKET s_listen, data_socket = -1;
netperf_socklen_t addrlen;
- struct ring_elt *send_ring;
- struct ring_elt *recv_ring;
+ struct ring_elt *send_ring = 0;
+ struct ring_elt *recv_ring = 0;
int timed_out = 0;
int pad_time = 0;
@@ -5312,6 +5312,28 @@
need_to_accept = 0;
connected = 1;
+#ifdef GENODE_BUILD
+ /*
+ * We don't support setitimer which uses signals. Instead set timeouts on
+ * the send and recv socket functions to be able to terminate if the host
+ * went away.
+ */
+ struct timeval timeout;
+ /* XXX LWIP expect ms instead of seconds */
+ timeout.tv_sec = 10 * 1000;
+ timeout.tv_usec = 0;
+
+ int sock_error = setsockopt(data_socket, SOL_SOCKET, SO_SNDTIMEO, &timeout,
+ sizeof(timeout));
+ if (sock_error)
+ fprintf(where, "could not send timeout for send - test may not terminate\n");
+
+ sock_error = setsockopt(data_socket, SOL_SOCKET, SO_RCVTIMEO, &timeout,
+ sizeof(timeout));
+ if (sock_error)
+ fprintf(where, "could not send timeout for recv - test may not terminate\n");
+#endif
+
#ifdef KLUDGE_SOCKET_OPTIONS
/* this is for those systems which *INCORRECTLY* fail to pass
attributes across an accept() call. Including this goes
+++ src/app/netperf/src/nettest_bsd.h
@@ -617,7 +617,7 @@
extern int get_sockaddr_family_addr_port(struct sockaddr_storage *sockaddr,
int family,
void *addr,
- int *port);
+ uint32_t *port);
extern void send_tcp_mss(char remote_host[]);
extern void send_tcp_stream(char remote_host[]);
extern void send_tcp_maerts(char remote_host[]);
+++ src/app/netperf/src/nettest_bsd.c
@@ -1066,7 +1066,7 @@
/* pull the port and address out of the sockaddr in host format */
int
-get_sockaddr_family_addr_port(struct sockaddr_storage *sockaddr, int family, void *addr, int *port)
+get_sockaddr_family_addr_port(struct sockaddr_storage *sockaddr, int family, void *addr, uint32_t *port)
{
struct sockaddr_in *sin = (struct sockaddr_in *)sockaddr;