[netperf-talk] RFC patch to allow netserver to accept IPv4 and IPv6 simultaneously

Rick Jones rick.jones2 at hp.com
Mon Oct 12 13:22:06 PDT 2009


Folks -

An HP co-worker has proposed the following patch to src/netserver.c:

diff --git a/src/netserver.c b/src/netserver.c
index de81165..8acb156 100644
--- a/src/netserver.c
+++ b/src/netserver.c
@@ -897,7 +897,11 @@ main(int argc, char *argv[])
    /* listen socket instead of relying on inetd. */

    /* first set a copy of initial values */
+#if defined (AF_INET6)
+  strncpy(local_host_name,"::0",sizeof(local_host_name));
+#else
    strncpy(local_host_name,"0.0.0.0",sizeof(local_host_name));
+#endif
    local_address_family = AF_UNSPEC;
    strncpy(listen_port,TEST_PORT,sizeof(listen_port));


But before I committed it and discovered the answer that way I thought I would 
ask if anyone knows where this will not work on a host with IPv6 support.  It 
does "work" under Linux, where "work" is defined that the netserver will accept 
control connections to both IPv4 and IPv6 addresses when it binds to "::0" (or 
just "::" if you prefer).  I would like to make sure it won't "break" elsewhere.

Anyone have a platform with IPv6 support where this would not work?

happy benchmarking,

rick jones


More information about the netperf-talk mailing list