[netperf-dev] netperf2 commit notice r207 - trunk/src
raj at netperf.org
raj at netperf.org
Fri Feb 1 16:52:50 PST 2008
Author: raj
Date: 2008-02-01 16:52:49 -0800 (Fri, 01 Feb 2008)
New Revision: 207
Modified:
trunk/src/netlib.c
trunk/src/netsh.h
trunk/src/nettest_bsd.c
trunk/src/nettest_bsd.h
Log:
more dccp steps and getaddrinfo kludges
Modified: trunk/src/netlib.c
===================================================================
--- trunk/src/netlib.c 2008-02-02 00:05:35 UTC (rev 206)
+++ trunk/src/netlib.c 2008-02-02 00:52:49 UTC (rev 207)
@@ -473,6 +473,11 @@
return("IPPROTO_SCTP");
break;
#endif
+#if defined(IPPROTO_DCCP)
+ case IPPROTO_DCCP:
+ return "IPPROTO_DCCP";
+ break;
+#endif
default:
snprintf(unknown,sizeof(unknown),"IPPROTO_UNKNOWN(%d)",protocol);
return(unknown);
Modified: trunk/src/netsh.h
===================================================================
--- trunk/src/netsh.h 2008-02-02 00:05:35 UTC (rev 206)
+++ trunk/src/netsh.h 2008-02-02 00:52:49 UTC (rev 207)
@@ -33,6 +33,26 @@
#define MAXLONG 4294967295UL
#endif /* MAXLONG */
+#ifdef WANT_DCCP
+
+#ifndef SOCK_DCCP
+#warning This platform has no SOCK_DCCP define, using 6
+#define SOCK_DCCP 6
+#endif
+
+#ifndef IPPROTO_DCCP
+#warning This platform has no IPPROTO_DCCP define, using 33
+#define IPPROTO_DCCP 33 /* defined by the IANA */
+#endif
+
+#ifndef SOL_DCCP
+#warning This platform has no SOL_DCCP define, using 269
+#warning No, I've no idea why they don't just use IPPROTO_DCCP...
+#define SOL_DCCP 269
+#endif
+
+#endif
+
#ifndef NETSH
extern char *program; /* program invocation name */
extern char *command_line; /* how we were invoked */
Modified: trunk/src/nettest_bsd.c
===================================================================
--- trunk/src/nettest_bsd.c 2008-02-02 00:05:35 UTC (rev 206)
+++ trunk/src/nettest_bsd.c 2008-02-02 00:52:49 UTC (rev 207)
@@ -641,6 +641,9 @@
#define CHANGED_SOCK_TYPE 0x1
#define CHANGED_PROTOCOL 0x2
#define CHANGED_SCTP 0x4
+#define CHANGED_DCCP 0x8
+#define CHANGED_DCCP_SOCK 0x10
+
int change_info = 0;
static int change_warning_displayed = 0;
@@ -694,8 +697,11 @@
SOCK_STREAM and IPPROTO_SCTP it barfs with a -7
EAI_SOCKTYPE. so, we check if the error was EAI_SOCKTYPE and if
we were asking for IPPROTO_SCTP and if so, kludge, again... raj
- 2008-10-13 */
-#ifdef WANT_SCTP
+ 200?-10-13 and of course, requiring the kludge for SCTP, it is
+ no surprise that linux needs a kludge for DCCP...actually not
+ only does it need the ai_protocol kludge, it needs an
+ ai_socktype kludge too... sigh raj 2008-02-01 */
+#if defined(WANT_SCTP) || defined (WANT_DCCP)
if (EAI_SOCKTYPE == error
#ifdef EAI_BADHINTS
|| EAI_BADHINTS == error
@@ -706,10 +712,34 @@
that we did this so the code for the Solaris kludge can do
the fix-up for us. also flip error over to EAI_AGAIN and
make sure we don't "count" this time around the loop. */
- hints.ai_protocol = 0;
+#if defined(WANT_DCCP)
+ /* only tweak on this one the second time around, after we've
+ kludged the ai_protocol field */
+ if ((hints.ai_socktype == SOCK_DCCP) &&
+ (hints.ai_protocol == 0)) {
+ change_info |= CHANGED_DCCP_SOCK;
+ hints.ai_socktype = 0;
+ /* we need to give it some sort of IPPROTO or it gets unhappy,
+ so for now, pick one from deep within the colon and use
+ IPPROTO_TCP */
+ hints.ai_protocol = IPPROTO_TCP;
+ }
+
+ if (hints.ai_protocol == IPPROTO_DCCP) {
+ change_info |= CHANGED_DCCP;
+ hints.ai_protocol = 0;
+ }
+
+#endif
+#if defined(WANT_SCTP)
+ if (hints.ai_protocol == IPPROTO_SCTP) {
+ change_info |= CHANGED_SCTP;
+ hints.ai_protocol = 0;
+ }
+#endif
+
error = EAI_AGAIN;
count -= 1;
- change_info |= CHANGED_SCTP;
}
#endif
} while ((error == EAI_AGAIN) && (count <= 5));
@@ -806,7 +836,17 @@
fflush(where);
}
+ if ((change_info & CHANGED_DCCP) &&
+ !(change_warning_displayed & CHANGED_DCCP)) {
+ change_warning_displayed |= CHANGED_DCCP;
+ fprintf(where,
+ "WARNING! getaddrinfo on this platform does not accept IPPROTO_DCCP!\n");
+ fprintf(where,
+ "Please contact your vendor for a fix to this bug in getaddrinfo().\n");
+ fflush(where);
+ }
+
if (debug) {
dump_addrinfo(where, res, hostname, port, family);
}
Modified: trunk/src/nettest_bsd.h
===================================================================
--- trunk/src/nettest_bsd.h 2008-02-02 00:05:35 UTC (rev 206)
+++ trunk/src/nettest_bsd.h 2008-02-02 00:52:49 UTC (rev 207)
@@ -585,23 +585,3 @@
extern void recv_tcp_nbrr();
#endif
-
-#ifdef WANT_DCCP
-
-#ifndef SOCK_DCCP
-#warning This platform has no SOCK_DCCP define, using 6
-#define SOCK_DCCP 6
-#endif
-
-#ifndef IPPROTO_DCCP
-#warning This platform has no IPPROTO_DCCP define, using 33
-#define IPPROTO_DCCP 33 /* defined by the IANA */
-#endif
-
-#ifndef SOL_DCCP
-#warning This platform has no SOL_DCCP define, using 269
-#warning No, I've no idea why they don't just use IPPROTO_DCCP...
-#define SOL_DCCP 269
-#endif
-
-#endif
More information about the netperf-dev
mailing list