#1676608 SCTP support added (experimental)

master
Stephane Bortzmeyer 17 years ago
parent bb93d349d6
commit 984691b672

@ -274,6 +274,33 @@ AC_ARG_ENABLE(priority,
PRIORITY=1 PRIORITY=1
fi) fi)
dnl SCTP, RFC 4960, feature request #1676608
AC_MSG_CHECKING([SCTP])
AC_TRY_COMPILE(
[#include <sys/types.h>
#include <netinet/in.h>
],
[int foobar = IPPROTO_SCTP;],
[AC_DEFINE(HAVE_SCTP,,[SCTP support])
ac_have_sctp="yes"],
ac_have_sctp="no")
AC_MSG_RESULT($ac_have_sctp)
AC_ARG_ENABLE(sctp,
[ --enable-sctp SCTP (Stream Control Transmission Protocol) support],
[if test "$enableval" = "yes"; then
if test $ac_have_sctp = "yes"; then
AC_DEFINE(HAVE_SCTP,,[Stream Control Transmission Protocol support])
SCTP=1
else
AC_MSG_WARN([No SCTP support on this system, request ignored])
fi
fi],
dnl Default: enable it if supported
if test $ac_have_sctp = "yes"; then
AC_DEFINE(HAVE_SCTP,,[Stream Control Transmission Protocol support])
SCTP=1
fi)
if test "$GCC" = yes; then if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall" CFLAGS="$CFLAGS -Wall"
fi fi
@ -332,6 +359,7 @@ DISPLAY_SETTING(GNUTLS)
DISPLAY_SETTING(SMTP) DISPLAY_SETTING(SMTP)
DISPLAY_SETTING(LIBIDN) DISPLAY_SETTING(LIBIDN)
DISPLAY_SETTING(TOS) DISPLAY_SETTING(TOS)
DISPLAY_SETTING(SCTP)
DISPLAY_SETTING(PRIORITY) DISPLAY_SETTING(PRIORITY)
compil_date=`date +%Y-%m-%d` compil_date=`date +%Y-%m-%d`

@ -14,6 +14,7 @@ echoping \- tests a remote host with TCP or UDP
.RI [-c] .RI [-c]
.RI [-d] .RI [-d]
.RI [-u] .RI [-u]
.RI [-T]
.RI [-s size] .RI [-s size]
.RI [-n number] .RI [-n number]
.RI [-w delay] .RI [-w delay]
@ -80,6 +81,8 @@ Number of seconds to wait a reply before giving up. For TCP, this is the
maximum number of seconds for the whole connection (setup and data exchange). maximum number of seconds for the whole connection (setup and data exchange).
.IP -u .IP -u
Use UDP instead of TCP Use UDP instead of TCP
.IP -T
Use SCTP instead of TCP
.IP -d .IP -d
Use the "discard" service instead of echo Use the "discard" service instead of echo
.IP -c .IP -c

@ -146,6 +146,11 @@ main(argc, argv)
int priority_requested = 0; int priority_requested = 0;
int tos; int tos;
int tos_requested = 0; int tos_requested = 0;
int protocol;
boolean sctp_requested = FALSE;
#ifdef HAVE_SCTP
int sctp = 0;
#endif
#ifdef HAVE_TCP_INFO #ifdef HAVE_TCP_INFO
struct tcp_info tcpinfo; struct tcp_info tcpinfo;
socklen_t socket_length = sizeof(tcpinfo); socklen_t socket_length = sizeof(tcpinfo);
@ -184,6 +189,7 @@ main(argc, argv)
{"ssl", 'C', POPT_ARG_NONE, &ssl, 'C'}, {"ssl", 'C', POPT_ARG_NONE, &ssl, 'C'},
{"priority", 'p', POPT_ARG_INT, &priority, 'p'}, {"priority", 'p', POPT_ARG_INT, &priority, 'p'},
{"type-of-service", 'P', POPT_ARG_INT, &tos, 'P'}, {"type-of-service", 'P', POPT_ARG_INT, &tos, 'P'},
{"sctp", 'T', POPT_ARG_NONE, &sctp, 'T'},
{"check-original", 'a', POPT_ARG_NONE, NULL, 'a', {"check-original", 'a', POPT_ARG_NONE, NULL, 'a',
"For HTTP through a proxy/cache"}, "For HTTP through a proxy/cache"},
{"ignore-cache", 'A', POPT_ARG_NONE, NULL, 'A', {"ignore-cache", 'A', POPT_ARG_NONE, NULL, 'A',
@ -312,6 +318,9 @@ main(argc, argv)
remaining--; remaining--;
tos_requested = 1; tos_requested = 1;
break; break;
case 'T':
sctp_requested = TRUE;
break;
case 's': case 's':
remaining--; remaining--;
if (size > MAX_LINE) { if (size > MAX_LINE) {
@ -467,6 +476,13 @@ main(argc, argv)
progname); progname);
exit(1); exit(1);
} }
#endif
#ifndef HAVE_SCTP
if (sctp_requested) {
(void) fprintf(stderr,
"%s: Not compiled with SCTP support.\n", progname);
exit(1);
}
#endif #endif
remaining--; /* No argv[0] this time */ remaining--; /* No argv[0] this time */
leftover = (char **) &argv[argc - remaining]; leftover = (char **) &argv[argc - remaining];
@ -699,7 +715,7 @@ main(argc, argv)
if (smtp) { if (smtp) {
sendline = "QUIT\r\n"; /* Surprises some SMTP servers which log a sendline = "QUIT\r\n"; /* Surprises some SMTP servers which log a
* frightening NOQUEUE. Anyone knows better? * frightening NOQUEUE. Anyone knows better?
* * * * See bug #1512776 */ * * * * * See bug #1512776 */
} else } else
#endif #endif
#ifdef ICP #ifdef ICP
@ -813,10 +829,14 @@ main(argc, argv)
/* /*
* Open a socket. * Open a socket.
*/ */
protocol = res->ai_protocol;
#ifdef HAVE_SCTP
if (sctp)
protocol = IPPROTO_SCTP;
#endif
if (!plugin) { if (!plugin) {
if ((sockfd = if ((sockfd =
socket(res->ai_family, res->ai_socktype, socket(res->ai_family, res->ai_socktype, protocol)) < 0)
res->ai_protocol)) < 0)
err_sys("Can't open socket"); err_sys("Can't open socket");
if (udp) { if (udp) {
struct addrinfo hints2, *res2; struct addrinfo hints2, *res2;

Loading…
Cancel
Save