#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
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
CFLAGS="$CFLAGS -Wall"
fi
@ -332,6 +359,7 @@ DISPLAY_SETTING(GNUTLS)
DISPLAY_SETTING(SMTP)
DISPLAY_SETTING(LIBIDN)
DISPLAY_SETTING(TOS)
DISPLAY_SETTING(SCTP)
DISPLAY_SETTING(PRIORITY)
compil_date=`date +%Y-%m-%d`

@ -14,6 +14,7 @@ echoping \- tests a remote host with TCP or UDP
.RI [-c]
.RI [-d]
.RI [-u]
.RI [-T]
.RI [-s size]
.RI [-n number]
.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).
.IP -u
Use UDP instead of TCP
.IP -T
Use SCTP instead of TCP
.IP -d
Use the "discard" service instead of echo
.IP -c

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

Loading…
Cancel
Save