Giter Site home page Giter Site logo

lksctp-tools's Introduction

(C) Copyright 2007 Hewlett-Packard Development Company, L.P.
(C) Copyright IBM Corp. 2001, 2003
Copyright 2001 Motorola, Cisco, Intel, Nokia, La Monte Yarroll.
Copyright 2002 Nokia, La Monte Yarroll, Intel. 

This is the lksctp-tools package for Linux Kernel SCTP Reference 
Implementation.

This package is intended to supplement the Linux Kernel SCTP
Reference Implementation now available in the Linux kernel source
tree in versions  2.5.36 and following.  For more information on LKSCTP
see the below section titled "LKSCTP - Linux Kernel SCTP." 

lksctp-tools
____________

The lksctp-tools package is intended for two audiences.  
	1) SCTP application developers
	2) LKSCTP project developers

For SCTP application developers, this package provides the user-level
C language header files and a library for accessing SCTP specific
application programming interfaces not provided by the standard sockets.

For LKSCTP project developers, this package provides the API
regression and functional tests.  Developers should also check
lksctp_tests package that provides low level kernel tests.  These
are available from git.kernel.org.

For either role, this project provides sample code, utilities, and
tests that one may find useful.  


LKSCTP - Linux Kernel SCTP 
__________________________

The Linux Kernel SCTP Reference Implementation is free software; you
can redistribute it and/or modify it under the terms of the GNU
General Public License as published by the Free Software Foundation;
either version 2, or (at your option) any later version. For more
information on licensing terms, please see the file COPYING in this
directory.

SCTP (Stream Control Transmission Protocol) is a message oriented,
reliable transport protocol, with congestion control, support for
transparent multi-homing, and multiple ordered streams of messages.
RFC2960 defines the core protocol. The IETF SIGTRAN Working Group
developed SCTP.  The primary architects are Randy Stewart and Qiaobing
Xie.

The Kernel Reference is first and foremost an exposition of
RFC2960 and related documents. You will find that the comments and
variable names tie closely back to the RFC and Internet Drafts.

This work was started by a small team of developers at Motorola.
Throughout this document, "we" refers to that team.  We intend for the
meaning of "we" to expand to include the whole development community,
all 27 million programmers on the planet.

The Kernel Reference has loose origins in the SCTP User Space Reference
by Randy Stewart and Qiaobing Xie.

MANIFEST
--------
.
|-- bin
|-- doc
|-- man
|-- src
    |-- apps
    |-- func_tests
    |-- include
    |   `-- netinet
    |-- lib
    |-- testlib
    `-- withsctp

You may want to check the following files:

COPYING.lib	Licensing terms of libsctp
COPYING		Licensing terms of other pieces of the package
ROADMAP		A tour around the files in the distribution of SCTP-tools.
INSTALL       	How to install and run this beast.
ChangeLog	What has changed since the last release?

DESIGN GOALS
------------

- A primary design goal is to reflect RFC 2960 as closely as
practical.  We have changed many names from the user space reference to
follow the draft as closely as possible.  We have also included
extensive quotes from the draft adjacent to the code which implements
them.

- The other primary design goal is to integrate Linux kernel data
structures and idioms as much as possible.  The test framework (in
directory test/) provides many of the functions which would otherwise
come from the kernel.  The test frame does use libc features, but the
state machine code should be libc-free.

- A lesser design goal is to completely describe the actions for each
state transition in an sctp_command_t (see sctp_command.h).  This
means that the state functions (sctp_state_fn_t in sctp_sm.h) are NOT
allowed to modify their endpoint, association, or chunk arguments.
This is enforced by const modifiers--please respect the compiler
warnings.  All actions must be described in the last argument to the
state function.

- A byte order convention for dealing with the SCTP chunk headers: 
all SCTP chunks, regardless if the chunk is to be sent outbound
to the network or was received inbound from the network, the header portion
of the chunk is ALWAYS created and retained in the NETWORK BYTE ORDER.

- An error code handling convention is to return negative values internally.  
The sk->err field holds a positive valued errno values, so will need our 
internal values negated.   

- We are moving toward an XP development model.  So far we have
adopted pair-programming, coding-to-test (functional and unit), design
through refactoring, and story-based planning.

In order to make XP work, it is very important that we have a complete
set of tests for the code.  We can not safely refactor major parts of
the code without a way to find the things we break.  If you decide to
extend the SCTP Kernel Implementation we ask that you do the following:

	1) Pick an XP story.  Tell [email protected]
	2) Write a functional test for that XP story.  The functional
	   test defines "DONE" for the story.
	3) Submit the functional test as a Pull Request on GitHub.
	4) Write unit tests for any new "objects" you define.
	5) Implement your feature.
	6) Submit the feature and the unit tests as a separate
	GitHub Pull Request.
	
Look in src/func_tests and in lksctp-tests package for examples of of tests.
Please do not submit code that fails its own tests or any of the unit tests.
If it fails a functional test, please document that with the submission.

Another XP requirement is to code only what is you need to make the
current test work.  Where this means omitting required features, we
have put in prominent BUG comments describing the omitted
functionality.

FEATURES
--------
This implementation uses a fairly compact cookie which is isolated in
its own substructure of SCTP_association.  We have been moving toward
aggregating data elements which need to travel together to minimize
copying of individual elements in favour of more efficient structure
copies.

You will find what we believe to be the smallest possible Internet
simulator in the middle of the function test_kernel.c:simulate_internet().
The simulator makes a few simplifying assumptions...

MAILING LISTS and WEB SITES
---------------------------
https://github.com/sctp/lksctp-tools/

	This is the lksctp project webpage.  The wiki section contains
	more info about it, including which RFCs it supports.

[email protected]
	
	This is the discussion list for developers.  Join this list if	
	you are interested in following the day-to-day activities of
	the SCTP Kernel Reference Implementation development community. 
	See subscription directions at:  
		http://vger.kernel.org/vger-lists.html#linux-sctp

http://www.sctp.org

	This is Randy Stewart's SCTP web site.

http://sctp.de

	This is Michael Tuexen's SCTP web site.  Michael has collected
	dozens of documents related to SCTP.

lksctp-tools's People

Contributors

bachradsusi avatar borkmann avatar cacheuseonly avatar dfranusic avatar flameeyes avatar gustavoz avatar jiachenjun avatar jijianwen avatar liuhangbin avatar lxin avatar marceloleitner avatar mbaldessari avatar mbiebl avatar nhorman avatar nicolasdichtel avatar poandrei avatar sammiller0 avatar seblu avatar superjamie avatar tuexen avatar uniontech-lilinjie avatar yegorich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lksctp-tools's Issues

The provided utilities lack documentation

While the project provides manual pages for the C API (sections 3 and 7),
there seems to be no documentation on what the tools such as checksctp,
sctp_{darn,status,test} or withsctp do and how to use them (section 1).

sctp_test usage message is missing options -X and -w

Likely candidates can also be found using something like the following script:

#!/bin/sh

set -e

oldpwd=$(pwd)
testdir=$(mktemp -d)
cd "$testdir"
trap 'cd "$oldpwd" && rm -rf "$testdir"' EXIT

curl -sL https://github.com/sctp/lksctp-tools/raw/master/src/apps/sctp_test.c |
  tee s_t.c |
  sed -ne '/void usage(/,/* usage() */ {s/\\[nt]//g;p}' >usage

options=$(sed -ne 's/^.*getopt([^"]*"\([^"]*\)").*$/\1/p' s_t.c).

while true; do
  option=$(printf %c "$options")
  case $option in
    :) ;;
    .) exit;;
    ?) grep -qE "(^|[^[:alnum:]_-])-$option($|[^[:alnum:]_-])" usage ||
      printf '%s\n' "$option";;
  esac
  options=${options#?}
done

Some function tests returned error

Commit eaf7032 fixed the compilation error. My system is rhel-7.5 which has /usr/include/linux/sctp.h,but when compiling lksctp-tools, it uses src/include/linux/sctp.h as default. After compilation, I got some error when executing test programs under func_tests directory. The reason should be that some structures are different between 2 header files. For example:
setsockopt(SCTP_EVENTS) in test_1_to_1_events returned Invalid arguments.

I think kernel checked the size of relevant struct and returned error for there are more fields in src/include/linux/sctp.h than /usr/include/linux/sctp.h

Options "-L" "-S" "-a"

Are these options "-L" "-S" "-a" supported in "sctp_status" command?
And what are they used for?
However, I can't find the usages of these options in source code.

Getting Invalid Stream Identifier between 2 SCTP endpoints

My lksctp version is libsctp.so.1.0.16.

I have configured 32 inbound & outbound streams at sctp client, and 1 inbound & outbound stream each at sctp server.

As per my understanding the the only valid value of stream identifier shall be 0 in this case.

But sctp client sends a record with streamId 1 and hence the server responds with Invalid Stream Identifier(as any stream id other than 0 is not valid in this case).

Is there some bug in libsctp.so.1.0.16 or is my understanding wrong for stream Ids.

Below are the tcpdump screenshots:

image

image

image

image

I have also attached tcpdump for your reference.

export.zip

1.0.18 build out of source is broken.

To reproduce:

  1. checkout the 1.0.18 source
  2. run ./bootstrap in the source
  3. mkdir build && <SOURCE_DIR>/configure --prefix= --srcdir=<SOURCE_DIR>

Result is

lksctp-tools/src/lib/sendmsg.c:27:10: fatal error: netinet/sctp.h: No such file or directory
 #include <netinet/sctp.h>

Note that this works on 1.0.17

Support for SCTP AUTH

Hi,

I am trying to configure SCTP AUTH extension. After enabling 'sysctl net.sctp.auth_enable=1' AUTH chunk list in INIT msg is empty. Since I am working in Java I am not able to call setsockopt(SCTP_AUTH_CHUNK). Is there any other way to configure it?

Thanks

SCTP_PEER_ADDR_CHANGE

I tested sctp connection between two host in one-to-many mode.

In client side (IP "10.10.10.10") I use connect (instead of connectx) function to server IP "10.20.30.40". In server side I use bind (instead of bindx) to IP "10.20.30.40". My code work well about 20 minutes the server got two SCTP_PEER_ADDR_CHANGE event:
^^^ intf_change: 10.10.10.10 state=1, error=0
^^^ intf_change: 10.10.10.10 state=0, error=1
After these event, the server could not receive packets anymore. What will I do to keep the connection permanent.

Bellow is the code:

  • Client side:
    server_addr.sin_family = AF_INET;
    server_addr.sin_port = htons(10001);
    inet_pton(AF_INET, "10.20.30.40", &server_addr.sin_addr);
    sock_fd = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
    connect(sock_fd, (struct sockaddr *) &server_addr, sizeof(server_addr));
    // Some set event, send message and receive code

  • Server side:
    static void
    handle_event(void *buf)
    {
    struct sctp_assoc_change *sac;
    struct sctp_send_failed *ssf;
    struct sctp_paddr_change *spc;
    struct sctp_remote_error *sre;
    union sctp_notification *snp;
    char addrbuf[INET6_ADDRSTRLEN];
    const char *ap;
    struct sockaddr_in *sin;
    struct sockaddr_in6 *sin6;

    snp = buf;

    switch (snp->sn_header.sn_type) {
    case SCTP_ASSOC_CHANGE:
    sac = &snp->sn_assoc_change;
    printf("^^^ assoc_change: state=%hu, error=%hu, instr=%hu "
    "outstr=%hu\n", sac->sac_state, sac->sac_error,
    sac->sac_inbound_streams, sac->sac_outbound_streams);
    break;
    case SCTP_SEND_FAILED:
    ssf = &snp->sn_send_failed;
    printf("^^^ sendfailed: len=%hu err=%d\n", ssf->ssf_length,
    ssf->ssf_error);
    break;
    case SCTP_PEER_ADDR_CHANGE:
    spc = &snp->sn_paddr_change;
    if (spc->spc_aaddr.ss_family == AF_INET) {
    sin = (struct sockaddr_in *)&spc->spc_aaddr;
    ap = inet_ntop(AF_INET, &sin->sin_addr, addrbuf,
    INET6_ADDRSTRLEN);
    } else {
    sin6 = (struct sockaddr_in6 *)&spc->spc_aaddr;
    ap = inet_ntop(AF_INET6, &sin6->sin6_addr, addrbuf,
    INET6_ADDRSTRLEN);
    }
    printf("^^^ intf_change: %s state=%d, error=%d\n", ap,
    spc->spc_state, spc->spc_error);
    break;
    case SCTP_REMOTE_ERROR:
    sre = &snp->sn_remote_error;
    printf("^^^ remote_error: err=%hu len=%hu\n",
    ntohs(sre->sre_error), ntohs(sre->sre_length));
    break;
    case SCTP_SHUTDOWN_EVENT:
    printf("^^^ shutdown event\n");
    break;
    default:
    printf("unknown type: %hu\n", snp->sn_header.sn_type);
    break;
    }
    }

main() {
...
if ((lfd = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP)) == -1) {
perror("socket");
exit(1);
}

sin->sin_family = AF_INET;
sin->sin_port = htons(1117);
sin->sin_addr.s_addr = inet_addr("10.20.30.40");
if (bind(lfd, (struct sockaddr *)sin, sizeof (*sin)) == -1) {
    perror("bind");
    exit(1);
}

if (listen(lfd, 1) == -1) {
    perror("listen");
    exit(1);
}

...
}

lksctp-tools is not LTO ready

When LTO optimisation is used build fails.

make[3]: Entering directory '/home/tkloczko/rpmbuild/BUILD/lksctp-tools-1.0.18/src/apps'
/bin/sh ../../libtool  --tag=CC   --mode=link gcc  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto  -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto -fuse-linker-plugin -o sctp_darn sctp_darn.o ../../src/testlib/libsctputil.la ../../src/lib/libsctp.la 
libtool: link: gcc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto -Wl,-z -Wl,relro -Wl,--as-needed -Wl,-z -Wl,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto -fuse-linker-plugin -o .libs/sctp_darn sctp_darn.o  ../../src/testlib/.libs/libsctputil.a ../../src/lib/.libs/libsctp.so
/usr/bin/ld: /tmp/sctp_darn.7oYX2Z.ltrans0.ltrans.o: in function `command_send':
/home/tkloczko/rpmbuild/BUILD/lksctp-tools-1.0.18/src/apps/sctp_darn.c:1878: undefined reference to `sctp_connectx'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:555: sctp_darn] Error 1
m

Provide consistent information on where the project home / contact is (SourceForge or GitHub?)

Compared to GitHub, the SourceForge project seems inactive:

https://sourceforge.net/p/lksctp/activity/ (last activity 2 years ago)

https://sourceforge.net/p/lksctp/mailman/lksctp-developers/?page=0 (last message 2013)

but many places still list the SourceForge URLs and e-mail address, e.g.:

README:

http://www.sourceforge.net/projects/lksctp

	This is the lksctp project webpage. 

C file headers (e.g. sctp_test.c):

 * Please send any bug reports or fixes you make to the
 * email address(es):
 *    lksctp developers <[email protected]>
 *
 * Or submit a bug report through the following website:
 *    http://www.sf.net/projects/lksctp

RPM spec file:

URL: http://lksctp.sourceforge.net

sctp.h header is not installed properly

Version: 1.0.18

After running make install, the sctp.h header is not properly installed. I get
/usr/include/netinet/sctp.h.in

Looks like the .in file is not properly processed.

sctp_recvmsg does not populate sctp_sndrcvinfo

I am using sctp_recvmsg as below.
sctp_sndrcvinfo sctp_info = {0};
sockaddr_in remote_address;
int flags = 0;
socklen_t sock_len = sizeof(remote_address);
char mBuffer[MAX_BUFFER_LENGTH];
int len = sctp_recvmsg(mServerFd, mBuffer, MAX_BUFFER_LENGTH,
(sockaddr*)&remote_address, &sock_len, &sctp_info, &flags);

My all communications goes fine except sctp_info is never populated. I can see messages on different streams when captured with tcpdump but still the sctp_info shows 0 for all streams.

SCTP problem on kernel 4.18.0-193 or later

We have two samples of java code, one acts a SCTP server, and the other acts as SCTP client, it is developed in order to test the behavior on RHEL6 and on RHEL8. and the code is not really using netty, so it is purely on java (OpenJDK) and LKSCTP.

On RHEL6.RHEL7 and RHEL8.0 (4.18.0-80.el8.x86_64), the utilities works normal, however, the similar setup on RHEL8.2 is not working.

Sample results as below.

OpenJDK14 on RHEL6

SERVER

$ uname -a
Linux rhel6-test001 2.6.32-754.17.1.el6.x86_64 #1 SMP Thu Jun 20 11:47:12 EDT 2019 x86_64 x86_64 x86_64 GNU/Linux

$ rpm -qa|grep lksctp
lksctp-tools-devel-1.0.10-7.el6.x86_64
lksctp-tools-doc-1.0.10-7.el6.x86_64
lksctp-tools-1.0.10-7.el6.x86_64

$ java -version
openjdk version "14.0.2" 2020-07-14
OpenJDK Runtime Environment (build 14.0.2+12-46)
OpenJDK 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing)

$ java TestSctpSvr 10.165.241.119 3868
SCTP_INIT_MAXSTREAMS,in = 65535, out = 10
SCTP_INIT_MAXSTREAMS,in = 10, out = 20
Client connection received from [/10.165.241.90:1111], association = sun.nio.ch.sctp.AssociationImpl@2d98a335[associationID:865, maxIn:10, maxOut:20]
after connect, SCTP_INIT_MAXSTREAMS from assoc,in = 10, out = 20
Received a messagesun.nio.ch.sctp.MessageInfoImpl@7ef20235[Address: /10.165.241.90:1111, Association: sun.nio.ch.sctp.AssociationImpl@2d98a335[associationID:865, maxIn:10, maxOut:20], Assoc ID: 865, Bytes: 1000, Stream Number: 0, Complete: true, isUnordered: false]

CLIENT

$ uname -a
Linux rhel6-test002 2.6.32-754.17.1.el6.x86_64 #1 SMP Thu Jun 20 11:47:12 EDT 2019 x86_64 x86_64 x86_64 GNU/Linux

$ rpm -qa|grep lksctp
lksctp-tools-devel-1.0.10-7.el6.x86_64
lksctp-tools-1.0.10-7.el6.x86_64
lksctp-tools-doc-1.0.10-7.el6.x86_64

$ java -version
openjdk version "14.0.2" 2020-07-14
OpenJDK Runtime Environment (build 14.0.2+12-46)
OpenJDK 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing)

$ java TestSctpCli 10.165.241.90 1111 10.165.241.119 3868
SO_RCVBUF = 65536
SO_SNDBUF = 65536
SCTP_DISABLE_FRAGMENTS = false
SCTP_INIT_MAXSTREAMS,in = 65535, out = 10
SCTP_INIT_MAXSTREAMS,in = 100, out = 200
after connect, SCTP_INIT_MAXSTREAMS from assoc,in = 20, out = 10
sending packet 0 of size 1000, retval = 1000
sending packet 1 of size 1000, retval = 1000
sending packet 2 of size 1000, retval = 1000
sending packet 3 of size 1000, retval = 1000
sending packet 4 of size 1000, retval = 1000
sending packet 5 of size 1000, retval = 1000
sending packet 6 of size 1000, retval = 1000
sending packet 7 of size 1000, retval = 1000
sending packet 8 of size 1000, retval = 1000

sending packet 9 of size 1000, retval = 1000
sending packet 10 of size 1000, retval = 1000
sending packet 11 of size 1000, retval = 1000
sending packet 12 of size 1000, retval = 1000
sending packet 13 of size 1000, retval = 1000
sending packet 14 of size 1000, retval = 1000

OpenJDK14 on RHEL8.2 (NOT WORKING)

SERVER

$ uname -a
Linux rhel8-test001 4.18.0-193.13.2.el8_2.x86_64 #1 SMP Mon Jul 13 23:17:28 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

$ rpm -qa |grep lksctp-tools
lksctp-tools-devel-1.0.18-3.el8.x86_64
lksctp-tools-1.0.18-3.el8.x86_64
lksctp-tools-doc-1.0.18-3.el8.x86_64

$ java -version
openjdk version "14.0.2" 2020-07-14
OpenJDK Runtime Environment (build 14.0.2+12-46)
OpenJDK 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing)
$ java TestSctpSvr 10.164.208.186 3868
SCTP_INIT_MAXSTREAMS,in = 65535, out = 10
SCTP_INIT_MAXSTREAMS,in = 10, out = 20
Client connection received from [/10.164.208.185:1111], association = null
Exception in thread "main" java.lang.NullPointerException
at TestSctpSvr.main(TestSctpSvr.java:41)

CLIENT

$ uname -a
Linux rhel8-test002 4.18.0-193.14.3.el8_2.x86_64 #1 SMP Mon Jul 20 15:02:29 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

$ rpm -qa |grep lksctp-tools
lksctp-tools-devel-1.0.18-3.el8.x86_64
lksctp-tools-doc-1.0.18-3.el8.x86_64
lksctp-tools-1.0.18-3.el8.x86_64

$ java -version
openjdk version "14.0.2" 2020-07-14
OpenJDK Runtime Environment (build 14.0.2+12-46)
OpenJDK 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing)
[dscadm@da1t-gen-dsc-app001:RHEL8_APP01:~ ]$

$ java TestSctpCli 10.164.208.185 1111 10.164.208.186 3868
SO_RCVBUF = 65536
SO_SNDBUF = 65536
SCTP_DISABLE_FRAGMENTS = false
SCTP_INIT_MAXSTREAMS,in = 65535, out = 10
SCTP_INIT_MAXSTREAMS,in = 100, out = 200
Exception in thread "main" java.lang.NullPointerException
at TestSctpCli.main(TestSctpCli.java:42)

Updating lksctp-tools Version on SourceForge

Hello,

Apologies if this is not the correct method of communication, any email I tried came back as undelivered.

I am trying to use the SCTP_SENDALL flag in an application I am writing. In my quest to debug problems, I found your github page. I'd like to use the latest release version of your code, lksctp-tools-1.0.19, but it appears your SourceForge page is only updated to 1.0.17.

Thanks,
Caleb

test_1_to_1_events failed in lksctp 1.0.18

cd /usr/lib64/lksctp-tools/ptest
./test_1_to_1_events
test_1_to_1_events.c 1 PASS : COMM_UP notification on client socket - SUCCESS
test_1_to_1_events.c 2 PASS : COMM_UP notification on server socket - SUCCESS
test_1_to_1_events.c 3 BROK : Got a datamsg, expecting notification
DUMP_CORE sctputil.c: 187
Segmentation fault

SCTP_SENDALL

Hello,

Is the SCTP_SENDALL flag implemented in the latest version, 1.0.19?

Thanks,
Caleb

sctp_recvmsg uses msg_flags as input argument

I was having strange issues with sctp_recvmsg repeating the same data and causing occasional infinite loops. Apparently, it was caused by msg_flags not being initialized to zero. I was under the impression that msg_flags was output only argument, but when I looked at the source code I realized that it is being passed to recvmg as flags input argument. In my particular case I suspect that MSG_PEEK flag was somehow sent to recvmsg. Man pages should be updated to indicate this since it can cause undefined behavior and it's quite difficult to figure out what's going on.

test_interleave.c:139:23: error: ‘SCTP_INTERLEAVING_SUPPORTED’ undeclared

Getting an error trying to make this on archlinux.

./bootstrap
./confiure
make

make all-recursive
...
CC test_interleave.o
test_interleave.c: In function ‘main’:
test_interleave.c:139:23: error: ‘SCTP_INTERLEAVING_SUPPORTED’ undeclared (first use in this function); did you mean ‘SCTP_RECONFIG_SUPPORTED’?
test_setsockopt(sk1, SCTP_INTERLEAVING_SUPPORTED,
^~~~~~~~~~~~~~~~~~~~~~~~~~~
SCTP_RECONFIG_SUPPORTED
test_interleave.c:139:23: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [Makefile:1184: test_interleave.o] Error 1
make[3]: Leaving directory '/root/lksctp-tools/src/func_tests'
make[2]: *** [Makefile:380: all-recursive] Error 1
make[2]: Leaving directory '/root/lksctp-tools/src'
make[1]: *** [Makefile:492: all-recursive] Error 1
make[1]: Leaving directory '/root/lksctp-tools'
make: *** [Makefile:398: all] Error 2

This project should use release tags following semantic versioning

This library's most recent semantic versioning number is v1.0.19 since April 28th of 2021.

Since then, several commits have been added. Many of them are fixes, most notably the recent commit f6d64dc which addresses an overflow error.

Semantic versioning in the form of MAJOR.MINOR.PATCH is a very well established concept which helps distribution packagers a lot since they can identify fixed bugs or problems by an increase of the PATCH field.

So I propose that this project dedicates more attention to keeping the release tags up to date. I think it should at the very least be increased to v1.0.20 because of the overflow-fix.

If you like I could volunteer with mainership of that

sctp_test do not support stream num >= 10.

when setting the stream number >=10 the data send failed.
output attached below.

I have already submit the correction patch.
47fd2fb

sctp_test -H localhost -P 1111 -h localhost -p 1234 -M 10 -s
remote:addr=127.0.0.1, port=1234, family=2
local:addr=127.0.0.1, port=1111, family=2
seed = 1473471140

Starting tests...
socket(SOCK_SEQPACKET, IPPROTO_SCTP) -> sk=3
bind(sk=3, [a:127.0.0.1,p:1111]) -- attempt 1/10
Client: Sending packets.(1/10)
sendmsg(sk=3, assoc=0) 1 bytes.
SNDRCV(stream=1 flags=0x1 ppid=1339736500
sendmsg(sk=3, assoc=0) 1 bytes.
SNDRCV(stream=2 flags=0x1 ppid=729094762
sendmsg(sk=3, assoc=0) 1 bytes.
SNDRCV(stream=3 flags=0x1 ppid=2136564246
sendmsg(sk=3, assoc=0) 1 bytes.
SNDRCV(stream=4 flags=0x1 ppid=567955794
sendmsg(sk=3, assoc=0) 1 bytes.
SNDRCV(stream=5 flags=0x1 ppid=1836674414
sendmsg(sk=3, assoc=0) 1 bytes.
SNDRCV(stream=6 flags=0x1 ppid=1521744644
sendmsg(sk=3, assoc=0) 1 bytes.
SNDRCV(stream=7 flags=0x1 ppid=454423727
sendmsg(sk=3, assoc=0) 1 bytes.
SNDRCV(stream=8 flags=0x1 ppid=1657565844
sendmsg(sk=3, assoc=0) 1 bytes.
SNDRCV(stream=9 flags=0x1 ppid=1754994355
sendmsg(sk=3, assoc=0) 1 bytes.
SNDRCV(stream=10 flags=0x1 ppid=1453090822

            *** sendmsg: Invalid argument ***

Does not install header file

When installing the package, the header-file sctp.h ist not installed. Instead sctp.h.in is installed.

How to reprodce:

  • fresh clone of repo
  • ./bootstrap
  • ./configure
  • make
  • make DESTDIR=$PWD install
  • ls usr/include/netinet/
    sctp.h.in

Expected

sctp.h is installed:

  • ls usr/include/netinet/
    sctp.h

test_tcp_style_v6 failed with setsockopt (11): Invalid argument

$ ./test_tcp_style_v6
test_tcp_style.c 1 PASS : accept on non-listening socket
test_tcp_style.c 2 PASS : connect to non-listening socket
test_tcp_style.c 3 PASS : connect to listening socket
test_tcp_style.c 4 PASS : connect after max backlog
test_tcp_style.c 5 PASS : accept from listening socket
test_tcp_style.c 6 PASS : connect on an established socket
test_tcp_style.c 7 PASS : accept on an established socket
test_tcp_style.c 8 PASS : client sockets -> accepted sockets
test_tcp_style.c 9 PASS : accepted sockets -> client sockets
test_tcp_style.c 10 PASS : send on a listening socket
test_tcp_style.c 11 PASS : recv on a listening socket
test_tcp_style.c 12 BROK : setsockopt(11): Invalid argument
DUMP_CORE ./sctputil.h: 257
[ 1277.011612] test_tcp_style_[1528]: segfault at 0 ip 0000560f4f6f8e4b sp 00007ffd578aded0 error 6 in test_tcp_style_v6[560f4f6f6000+4000]
[ 1277.013442] Code: ff bf 0a 00 00 00 e8 24 d2 ff ff b9 01 01 00 00 bf 01 00 00 00 31 c0 48 8d 15 5b 1b 00 00 48 8d 35 f3 11 00 00 e8 25 d31
Segmentation fault

sctp_test.c:1140: strange expression ?

sctp_test.c:1140]: (warning) Found calculation inside sizeof().

Source code is

memset(poll_sks, 0, sizeof(sks * sizeof(_poll_sks)));

maybe better code

memset(poll_sks, 0, sks * sizeof(_poll_sks));

Compile Time Errors

peeloff.c: In function 'sctp_peeloff_flags':
peeloff.c:29:2: error: unknown type name 'sctp_peeloff_flags_arg_t'
sctp_peeloff_flags_arg_t peeloff;
^
peeloff.c:33:9: error: request for member 'p_arg' in something not a structure or union
peeloff.p_arg.associd = associd;
^
peeloff.c:34:9: error: request for member 'p_arg' in something not a structure or union
peeloff.p_arg.sd = 0;
^
peeloff.c:35:9: error: request for member 'flags' in something not a structure or union
peeloff.flags = flags;
^
peeloff.c:39:25: error: 'sctp_peeloff_flags_arg_t' undeclared (first use in this function)
peeloff_size = sizeof(sctp_peeloff_flags_arg_t);
^
peeloff.c:39:25: note: each undeclared identifier is reported only once for each function it appears in
peeloff.c:40:34: error: 'SCTP_SOCKOPT_PEELOFF_FLAGS' undeclared (first use in this function)
err = getsockopt(fd, SOL_SCTP, SCTP_SOCKOPT_PEELOFF_FLAGS, &peeloff,
^
peeloff.c:44:64: error: request for member 'p_arg' in something not a structure or union
err = getsockopt(fd, SOL_SCTP, SCTP_SOCKOPT_PEELOFF, &peeloff.p_arg,
^
peeloff.c:51:16: error: request for member 'p_arg' in something not a structure or union
return peeloff.p_arg.sd;
^
make[4]: *** [peeloff.lo] Error 1
make[4]: Leaving directory /home/lksctp-tools/src/lib' make[3]: *** [../../src/lib/libsctp.la] Error 2 make[3]: Leaving directory /home/lksctp-tools/src/apps'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory /home/lksctp-tools/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory /home/lksctp-tools'
make: *** [all] Error 2

Dropped duplicate kernel defines made lksctp-tools uncompilable on RHEL7

Commit 3c8bd0d, "sctp.h: make use kernel UAPI header" drops all duplicated kernel defines, replacing it with kernel header include. While this is understandable decision and right choice overall, this causes compilation errors in lksctp-tools under RHEL7, because it's 3.10 kernel doesn't have required defines in sctp.h header.

Server Received INIT But give no reponse

on my server when client send the package in sctp_init_error.pcap.zip, server give no response. in normal mode server shoud give init_ack response. but it is not ,why?

sctp_init_error.pcap.zip

lksctp version:
lksctp-tools-1.0.17-2.el7.x86_64

sctp_darn -H 10.61.56.136 -P 8014 -l
netstat -an|grep sctp
sctp 10.61.56.136:8014 LISTEN

the network is ok too !!

how can i open the debug log of lksctp-tools and found the problem of it

./test_sockopt :DUMP_CORE ../../src/testlib/sctputil.h: 137 【[email protected]

see:

[root@centos8 func_tests]# ls
Makefile                       test_1_to_1_recvfrom              test_1_to_1_sockopt         test_connectx.c                       test_recvmsg.o
Makefile.am                    test_1_to_1_recvfrom.c            test_1_to_1_sockopt.c       test_connectx.o                       test_sctp_sendrecvmsg
Makefile.in                    test_1_to_1_recvfrom.o            test_1_to_1_sockopt.o       test_fragments                        test_sctp_sendrecvmsg.c
test_1_to_1_accept_close       test_1_to_1_recvmsg               test_1_to_1_threads         test_fragments.c                      test_sctp_sendrecvmsg.o
test_1_to_1_accept_close.c     test_1_to_1_recvmsg.c             test_1_to_1_threads.c       test_fragments.o                      test_sctp_sendrecvmsg_v6
test_1_to_1_accept_close.o     test_1_to_1_recvmsg.o             test_1_to_1_threads.o       test_fragments_v6                     test_sctp_sendrecvmsg_v6-test_sctp_sendrecvmsg.o
test_1_to_1_addrs              test_1_to_1_rtoinfo               test_assoc_abort            test_fragments_v6-test_fragments.o    test_sctp_sendvrecvv.c
test_1_to_1_addrs.c            test_1_to_1_rtoinfo.c             test_assoc_abort.c          test_getname                          test_sockopt
test_1_to_1_addrs.o            test_1_to_1_rtoinfo.o             test_assoc_abort.o          test_getname.c                        test_sockopt.c
test_1_to_1_connect            test_1_to_1_send                  test_assoc_shutdown         test_getname.o                        test_sockopt.o
test_1_to_1_connect.c          test_1_to_1_send.c                test_assoc_shutdown.c       test_getname_v6                       test_sockopt_v6
test_1_to_1_connect.o          test_1_to_1_sendmsg               test_assoc_shutdown.o       test_getname_v6-test_getname.o        test_sockopt_v6-test_sockopt.o
test_1_to_1_connectx           test_1_to_1_sendmsg.c             test_autoclose              test_inaddr_any                       test_tcp_style
test_1_to_1_connectx.c         test_1_to_1_sendmsg.o             test_autoclose.c            test_inaddr_any.c                     test_tcp_style.c
test_1_to_1_connectx.o         test_1_to_1_send.o                test_autoclose.o            test_inaddr_any.o                     test_tcp_style.o
test_1_to_1_events             test_1_to_1_sendto                test_basic                  test_inaddr_any_v6                    test_tcp_style_v6
test_1_to_1_events.c           test_1_to_1_sendto.c              test_basic.c                test_inaddr_any_v6-test_inaddr_any.o  test_tcp_style_v6-test_tcp_style.o
test_1_to_1_events.o           test_1_to_1_sendto.o              test_basic.o                test_peeloff                          test_timetolive
test_1_to_1_initmsg_connect    test_1_to_1_shutdown              test_basic_v6               test_peeloff.c                        test_timetolive.c
test_1_to_1_initmsg_connect.c  test_1_to_1_shutdown.c            test_basic_v6-test_basic.o  test_peeloff.o                        test_timetolive.o
test_1_to_1_initmsg_connect.o  test_1_to_1_shutdown.o            test_connect                test_peeloff_v6                       test_timetolive_v6
test_1_to_1_nonblock           test_1_to_1_socket_bind_listen    test_connect.c              test_peeloff_v6-test_peeloff.o        test_timetolive_v6-test_timetolive.o
test_1_to_1_nonblock.c         test_1_to_1_socket_bind_listen.c  test_connect.o              test_recvmsg
test_1_to_1_nonblock.o         test_1_to_1_socket_bind_listen.o  test_connectx               test_recvmsg.c
[root@centos8 func_tests]# ./test_sockopt
test_sockopt.c  1 BROK : socket: Socket type not supported
DUMP_CORE ../../src/testlib/sctputil.h: 137
Segmentation fault (core dumped)

I don't know why the test failed. Can you tell me?

SCTP ERROR: socket: Protocol not supported on aarch64 for Linux.

My working computer info as follows:
$ uname -a
Linux centos-arm 4.18.0-80.7.2.el7.aarch64 #1 SMP Thu Sep 12 16:13:20 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux
$ cat /etc/redhat-release
CentOS Linux release 7.6.1810 (AltArch)
I have installed sctp lib,its version: lksctp-tools-1.0.17.tar.gz.
my execute file dependent libraries info: $ ldd sctp_svr
linux-vdso.so.1 => (0x0000ffff876a0000)
libsctp.so.1 => /home/mals/cu/local/lib/libsctp.so.1 (0x0000ffff87660000)
libc.so.6 => /lib64/libc.so.6 (0x0000ffff874d0000)
/lib/ld-linux-aarch64.so.1 (0x0000ffff876b0000)
but when I run my bin file: ./sctp_svr 192.168.0.128 9998
socket: Protocol not supported

The relative code as follows:
listen_sock=socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP); //create a sctp socket
if(listen_sock == -1){
perror("socket");
return -1;
}

So, I want to know whether the sctp third lib does not support arm64 arch for Linux or not?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.