Compare commits

...

No commits in common. "c8" and "c9s" have entirely different histories.
c8 ... c9s

25 changed files with 2192 additions and 292 deletions

9
.gitignore vendored
View File

@ -1 +1,8 @@
SOURCES/lksctp-tools-1.0.18.tar.gz
lksctp-tools-1.0.11.tar.gz
/lksctp-tools-1.0.12.tar.gz
/lksctp-tools-1.0.13.tar.gz
/lksctp-tools-1.0.14.tar.gz
/lksctp-tools-1.0.15.tar.gz
/lksctp-tools-1.0.16.tar.gz
/lksctp-tools-1.0.18.tar.gz
/lksctp-tools-1.0.19.tar.gz

View File

@ -1 +0,0 @@
9194041a5c08cfcf34f76a4cfa40c68065e5de0a SOURCES/lksctp-tools-1.0.18.tar.gz

View File

@ -1,31 +0,0 @@
From e5952a0cdfa8b1b56a5823574835f1f771f14ae0 Mon Sep 17 00:00:00 2001
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Date: Fri, 24 Aug 2018 09:53:00 -0300
Subject: [PATCH 3/3] build: 0b0dce7a36fb actually belongs to v4.19
Typo or not, this commit actually belongs to v4.19 and made me wonder why
on v4.18 it didn't find this feature.
Fixes: 817f0bfa248f ("build: add two defines for Peer Address Parameters extensions on sctp_paddrparams")
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Reviewed-by: Xin Long <lucien.xin@gmail.com>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index f55775a..5de5c76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,7 +101,7 @@ LKSCTP_CHECK_TYPE([struct sctp_prinfo], [HAVE_SCTP_SENDV])
# added on v4.16, 30f6ebf65bc4
LKSCTP_CHECK_DECL([SCTP_AUTH_NO_AUTH], [HAVE_SCTP_AUTH_NO_AUTH])
-# New members to sctp_paddrparams, added on v4.18, 0b0dce7a36fb
+# New members to sctp_paddrparams, added on v4.19, 0b0dce7a36fb
LKSCTP_CHECK_MEMBER([struct sctp_paddrparams.spp_ipv6_flowlabel],
[HAVE_SCTP_SPP_IPV6_FLOWLABEL])
LKSCTP_CHECK_MEMBER([struct sctp_paddrparams.spp_dscp],
--
1.8.3.1

View File

@ -1,35 +0,0 @@
From 378560050a8f93786c590cc99a55461666205b61 Mon Sep 17 00:00:00 2001
From: Xin Long <lucien.xin@gmail.com>
Date: Fri, 24 Aug 2018 01:13:32 +0800
Subject: [PATCH] build: fix netinet/sctp.h not to be installed
After libcnetinet_HEADERS was set to sctp.h.in, netinet/sctp.h can
no longer be installed into ${includedir}.
Since "AC_CONFIG_HEADERS([src/include/netinet/sctp.h])" is already
added into configure.ac, there's no need to generate sctp.h by
automake.
So we simply set libcnetinet_HEADERS back to sctp.h.
Fixes: 9607dd85e70a ("netinet/sctp.h: dynamically build based on system setup")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
src/include/netinet/Makefile.am | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/include/netinet/Makefile.am b/src/include/netinet/Makefile.am
index ca0aac2..965db8c 100644
--- a/src/include/netinet/Makefile.am
+++ b/src/include/netinet/Makefile.am
@@ -11,5 +11,4 @@ libcnetinetdir = $(includedir)/netinet
# API.
include_HEADERS =
-libcnetinet_HEADERS = sctp.h.in
-BUILT_SOURCES = sctp.h
+libcnetinet_HEADERS = sctp.h
--
1.8.3.1

View File

@ -1,35 +0,0 @@
From 596efd6631b83069d41782fb0ee2d6cf76a50dfa Mon Sep 17 00:00:00 2001
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Date: Fri, 24 Aug 2018 09:52:59 -0300
Subject: [PATCH 2/3] build: fix probing for HAVE_SCTP_SENDV
Somehow it was using a type that is non-existent. The right one is
sctp_prinfo, introduced on ed63afb8a318 ("sctp: add support for PR-SCTP
Information for sendmsg"), present on v4.17.
Fixes: 1b798f1ca3b5 ("build: add define HAVE_SCTP_AUTH_NO_AUTH")
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Reviewed-by: Xin Long <lucien.xin@gmail.com>
---
configure.ac | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index dad658c..f55775a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -94,9 +94,8 @@ LKSCTP_CHECK_MEMBER([struct sctp_pdapi_event.pdapi_stream],
LKSCTP_CHECK_MEMBER([struct sctp_pdapi_event.pdapi_seq],
[HAVE_SCTP_PDAPI_EVENT_PDAPI_SEQ])
-# PR-SCTP field used to probe for sendv/recvv support, added on v4.17
-LKSCTP_CHECK_MEMBER([struct sendv_prinfo.sctp_prinfo],
- [HAVE_SCTP_SENDV])
+# PR-SCTP struct used to probe for sendv/recvv support, added on v4.17
+LKSCTP_CHECK_TYPE([struct sctp_prinfo], [HAVE_SCTP_SENDV])
# This event indicates that the peer does not support SCTP authentication,
# added on v4.16, 30f6ebf65bc4
--
1.8.3.1

View File

@ -1,52 +0,0 @@
From db6d15bf12a0123e4320e5fd7cb688331dea1bdc Mon Sep 17 00:00:00 2001
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Date: Fri, 24 Aug 2018 09:52:58 -0300
Subject: [PATCH 1/3] build: remove v4.12 secondary defines in favor of
HAVE_SCTP_STREAM_RECONFIG
These were backups, commented out since beginning.
HAVE_SCTP_STREAM_RECONFIG is enough to identify that these are there, so
lets use only one.
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Reviewed-by: Xin Long <lucien.xin@gmail.com>
---
configure.ac | 8 --------
src/include/netinet/sctp.h.in | 2 --
2 files changed, 10 deletions(-)
diff --git a/configure.ac b/configure.ac
index 2ae36ec..dad658c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,14 +82,6 @@ AC_CHECK_FUNCS([bzero gethostbyname gettimeofday memmove memset select socket \
LKSCTP_CHECK_MEMBER([struct sctp_event_subscribe.sctp_stream_reset_event],
[HAVE_SCTP_STREAM_RESET_EVENT])
-# Support for assoc reset event, added on v4.12, c95129d127c6
-#LKSCTP_CHECK_MEMBER([struct sctp_event_subscribe.sctp_assoc_reset_event], \
-# [HAVE_SCTP_ASSOC_RESET_EVENT])
-
-# Support for stream change event, added on v4.12, b444153fb5a6
-#LKSCTP_CHECK_MEMBER([struct sctp_event_subscribe.sctp_stream_change_event], \
-# [HAVE_SCTP_STREAM_CHANGE_EVENT])
-
# RFC 6525 (Stream Reconf), finished on v4.12, c0d8bab6ae51
LKSCTP_CHECK_DECL([SCTP_RECONFIG_SUPPORTED], [HAVE_SCTP_STREAM_RECONFIG])
diff --git a/src/include/netinet/sctp.h.in b/src/include/netinet/sctp.h.in
index c049077..2009f1c 100644
--- a/src/include/netinet/sctp.h.in
+++ b/src/include/netinet/sctp.h.in
@@ -61,8 +61,6 @@ extern "C" {
#define HAVE_SCTP_CANSET_PRIMARY
#undef HAVE_SCTP_STREAM_RESET_EVENT
-#undef HAVE_SCTP_ASSOC_RESET_EVENT
-#undef HAVE_SCTP_STREAM_CHANGE_EVENT
#undef HAVE_SCTP_STREAM_RECONFIG
#undef HAVE_SCTP_PEELOFF_FLAGS
#undef HAVE_SCTP_PDAPI_EVENT_PDAPI_STREAM
--
1.8.3.1

View File

@ -1,71 +0,0 @@
From 7de2bd7e769f10521e3d0c2cb42c6f6b9b505dd0 Mon Sep 17 00:00:00 2001
From: Xin Long <lucien.xin@gmail.com>
Date: Thu, 16 Aug 2018 14:12:30 +0800
Subject: [PATCH] configure.ac: add CURRENT REVISION and AGE for libsctp and
libwithsctp
Add CURRENT REVISION and AGE for libsctp and libwithsctp in
configure.ac to update these 2 library version information.
Compatible with before, they will start from 1:18:0. But each
will get updated according to their definitions in the future.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
configure.ac | 7 +++++++
src/lib/Makefile.am | 7 +++++--
src/withsctp/Makefile.am | 3 ++-
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 275ef4e..2ae36ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,6 +14,13 @@ dnl reduce clutter in the root; if we put it below AM_INIT_AUTOMAKE,
dnl configure will fail ...)
AC_INIT([lksctp-tools], [1.0.18], [], [], [http://www.lksctp.org/])
+AC_SUBST(LIBSCTP_CURRENT, 1)
+AC_SUBST(LIBSCTP_REVISION, 18)
+AC_SUBST(LIBSCTP_AGE, 0)
+AC_SUBST(LIBWITHSCTP_CURRENT, 1)
+AC_SUBST(LIBWITHSCTP_REVISION, 18)
+AC_SUBST(LIBWITHSCTP_AGE, 0)
+
AC_CONFIG_AUX_DIR(bin)
AC_CONFIG_SRCDIR([src/apps/sctp_darn.c])
AC_CONFIG_HEADERS([config.h])
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 6100c56..1d62175 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -8,5 +8,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/include
lib_LTLIBRARIES = libsctp.la
-libsctp_la_SOURCES = bindx.c connectx.c peeloff.c opt_info.c addrs.c sendmsg.c recvmsg.c Versions.map
-libsctp_la_LDFLAGS = -version-info 1:17:0 -Wl,--version-script=$(srcdir)/Versions.map
+libsctp_la_SOURCES = bindx.c connectx.c peeloff.c opt_info.c \
+ addrs.c sendmsg.c recvmsg.c Versions.map
+libsctp_la_LDFLAGS = -version-info \
+ @LIBSCTP_CURRENT@:@LIBSCTP_REVISION@:@LIBSCTP_AGE@ \
+ -Wl,--version-script=$(srcdir)/Versions.map
diff --git a/src/withsctp/Makefile.am b/src/withsctp/Makefile.am
index 70b1cca..1f6ca37 100644
--- a/src/withsctp/Makefile.am
+++ b/src/withsctp/Makefile.am
@@ -14,7 +14,8 @@ AM_CPPFLAGS=-I$(top_srcdir)/src/include
pkglib_LTLIBRARIES = libwithsctp.la
libwithsctp_la_SOURCES = sctp_load_libs.c sctp_socket.c sctp_bind.c \
sctp_sockopt.c sctp_socket.h
-libwithsctp_la_LDFLAGS = -version-info 1:17:0 -ldl
+libwithsctp_la_LDFLAGS = -version-info \
+ @LIBWITHSCTP_CURRENT@:@LIBWITHSCTP_REVISION@:@LIBWITHSCTP_AGE@ -ldl
pkgdoc_DATA = sctp_load_libs.c sctp_socket.c sctp_bind.c \
sctp_sockopt.c sctp_socket.h checksctp.c
--
1.8.3.1

View File

@ -1,43 +0,0 @@
From 7c0ef4d441b3833e721df58f56e2cb8c81b34df4 Mon Sep 17 00:00:00 2001
From: Xin Long <lucien.xin@gmail.com>
Date: Thu, 16 Aug 2018 14:12:01 +0800
Subject: [PATCH] withsctp: use @PACKAGE_VERSION@ in withsctp.h
use @PACKAGE_VERSION@ to replace the hardcode version.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
Makefile.rules | 3 ++-
src/withsctp/withsctp.in | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Makefile.rules b/Makefile.rules
index 83f5f0c..d3693fa 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -15,4 +15,5 @@
edit = @sed \
-e "s|\@bindir\@|$(bindir)|" \
-e "s|\@libdir\@|$(libdir)|" \
- -e "s|\@PACKAGE\@|$(PACKAGE)|"
+ -e "s|\@PACKAGE\@|$(PACKAGE)|" \
+ -e "s|\@PACKAGE_VERSION\@|$(PACKAGE_VERSION)|"
diff --git a/src/withsctp/withsctp.in b/src/withsctp/withsctp.in
index 7f182ba..fda5ebc 100644
--- a/src/withsctp/withsctp.in
+++ b/src/withsctp/withsctp.in
@@ -2,7 +2,8 @@
# -*- sh -*-
LIBDIR=`rpm --eval "%{_libdir}"`/@PACKAGE@
BINDIR=@bindir@
-export LD_PRELOAD=${LIBDIR}/libwithsctp.so.1.0.17
+LIBVER=@PACKAGE_VERSION@
+export LD_PRELOAD=${LIBDIR}/libwithsctp.so.${LIBVER}
if ! ${BINDIR}/checksctp 2> /dev/null
then
${BINDIR}/checksctp;
--
1.8.3.1

16
gating.yaml Normal file
View File

@ -0,0 +1,16 @@
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_testing
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_stable
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}

View File

@ -0,0 +1,63 @@
From f6d64dc3fdcba8f7ced61ea26270ebc0c38b5312 Mon Sep 17 00:00:00 2001
From: Xin Long <lucien.xin@gmail.com>
Date: Sun, 28 Jan 2024 12:18:08 -0500
Subject: [PATCH] lib: define cmsg array with correct size in sendv and recvv
Philipp recently found a buffer overflow crash in his application when
using sctp_sendv().
In sctp_sendv(), the cmsg array is defined as one whole cmsg:
char _cmsg[CMSG_SPACE(sizeof(struct sctp_sendv_spa))]
while these options in struct sctp_sendv_spa are packed into msg_control
with multiple cmsgs, instead one whole cmsg.
So fix it by defining cmsg array with correct size:
char _cmsg[CMSG_SPACE(sizeof(struct sctp_sndinfo)) +
CMSG_SPACE(sizeof(struct sctp_prinfo)) +
CMSG_SPACE(sizeof(struct sctp_authinfo))];
Note that the similar fix is also needed in sctp_recvv().
Reported-by: Philipp Stanner <stanner@posteo.de>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
src/lib/recvmsg.c | 4 ++--
src/lib/sendmsg.c | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/lib/recvmsg.c b/src/lib/recvmsg.c
index 88fe061..d4bf558 100644
--- a/src/lib/recvmsg.c
+++ b/src/lib/recvmsg.c
@@ -105,8 +105,8 @@ int sctp_recvv(int s, const struct iovec *iov, int iovlen,
struct sockaddr *from, socklen_t *fromlen, void *info,
socklen_t *infolen, unsigned int *infotype, int *flags)
{
- char incmsg[CMSG_SPACE(sizeof(struct sctp_rcvinfo) +
- sizeof(struct sctp_nxtinfo))];
+ char incmsg[CMSG_SPACE(sizeof(struct sctp_rcvinfo)) +
+ CMSG_SPACE(sizeof(struct sctp_nxtinfo))];
int error, len, _infolen;
struct cmsghdr *cmsg;
struct msghdr inmsg;
diff --git a/src/lib/sendmsg.c b/src/lib/sendmsg.c
index bee4921..385db7e 100644
--- a/src/lib/sendmsg.c
+++ b/src/lib/sendmsg.c
@@ -123,7 +123,9 @@ int sctp_sendv(int s, const struct iovec *iov, int iovcnt,
struct sockaddr *addrs, int addrcnt, void *info,
socklen_t infolen, unsigned int infotype, int flags)
{
- char _cmsg[CMSG_SPACE(sizeof(struct sctp_sendv_spa))];
+ char _cmsg[CMSG_SPACE(sizeof(struct sctp_sndinfo)) +
+ CMSG_SPACE(sizeof(struct sctp_prinfo)) +
+ CMSG_SPACE(sizeof(struct sctp_authinfo))];
struct cmsghdr *cmsg = (struct cmsghdr *)_cmsg;
struct msghdr outmsg = {};
struct sockaddr *addr;
--
2.39.1

View File

@ -6,5 +6,5 @@
-LIBDIR=@libdir@/@PACKAGE@
+LIBDIR=`rpm --eval "%{_libdir}"`/@PACKAGE@
BINDIR=@bindir@
export LD_PRELOAD=${LIBDIR}/libwithsctp.so.1.0.17
if ! ${BINDIR}/checksctp 2> /dev/null
LIBVER=@LIBWITHSCTP_CURRENT@.@LIBWITHSCTP_AGE@.@LIBWITHSCTP_REVISION@
export LD_PRELOAD=${LIBDIR}/libwithsctp.so.${LIBVER}

View File

@ -1,6 +1,6 @@
Name: lksctp-tools
Summary: User-space access to Linux Kernel SCTP
Version: 1.0.18
Version: 1.0.19
Release: 3%{?dist}
# src/apps/bindx_test.C is GPLv2, I've asked upstream for clarification
License: GPLv2 and GPLv2+ and LGPLv2 and MIT
@ -8,14 +8,20 @@ Group: System Environment/Libraries
URL: http://lksctp.sourceforge.net
Source0: https://github.com/sctp/lksctp-tools/archive/%{name}-%{version}.tar.gz
Patch0: lksctp-tools-1.0.16-libdir.patch
Patch1: lksctp-tools-1.0.18-withsctp-use-PACKAGE_VERSION-in-withsctp.h.patch
Patch2: lksctp-tools-1.0.18-configure.ac-add-CURRENT-REVISION-and-AGE-for-libsct.patch
Patch3: lksctp-tools-1.0.18-build-fix-netinet-sctp.h-not-to-be-installed.patch
Patch4: lksctp-tools-1.0.18-build-remove-v4.12-secondary-defines-in-favor-of-HAV.patch
Patch5: lksctp-tools-1.0.18-build-fix-probing-for-HAVE_SCTP_SENDV.patch
Patch6: lksctp-tools-1.0.18-build-0b0dce7a36fb-actually-belongs-to-v4.19.patch
BuildRequires: libtool, automake, autoconf
Patch0: lksctp-tools-1.0.19-libdir.patch
Patch1: myftp-replace-use-of-deprecated-gethostbyname-with-g.patch
Patch2: sctp_xconnect-replace-use-of-deprecated-gethostbynam.patch
Patch3: sctp_test-replace-use-of-deprecated-gethostbyname-wi.patch
Patch4: sctp_darn-replace-use-of-deprecated-gethostbyname-wi.patch
Patch5: sctp_test-check-strdup-return-in-append_addr.patch
Patch6: man-add-the-missing-description-for-3-flags-in-sctp_.patch
Patch7: man-update-for-DESCRIPTION-and-SYSCTL-in-sctp.7.patch
Patch8: man-add-some-missing-items-in-STATISTICS-in-sctp.7.patch
Patch9: man-improve-the-description-in-SOCKET-OPTIONS-in-sct.patch
Patch10: man-add-the-missing-options-in-SOCKET-OPTIONS-in-sct.patch
Patch11: man-add-CONTROL-MSGS-and-NOTIFICATIONS-in-sctp.7.patch
Patch12: lib-define-cmsg-array-with-correct-size-in-sendv-and.patch
BuildRequires: libtool, automake, autoconf, make
%description
This is the lksctp-tools package for Linux Kernel SCTP (Stream Control
@ -56,6 +62,12 @@ Drafts).
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%build
[ ! -x ./configure ] && sh bootstrap
@ -64,18 +76,14 @@ Drafts).
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
make %{?_smp_mflags}
%make_build
%install
rm -f doc/rfc2960.txt doc/states.txt
make install DESTDIR="$RPM_BUILD_ROOT" INSTALL="install -p"
%make_install
find $RPM_BUILD_ROOT -type f -name "*.la" -delete
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%doc AUTHORS ChangeLog COPYING* README
%{_bindir}/*
@ -96,16 +104,57 @@ find $RPM_BUILD_ROOT -type f -name "*.la" -delete
%doc doc/*.txt
%changelog
* Fri Aug 24 2018 Xin Long <lxin@redhat.com> - 1.0.18-3
* Mon Feb 12 2024 Xin Long <lxin@redhat.com> - 1.0.19-3
- man doc update and one fix for lib and another for sctp_test.
Related: RHEL-25098
* Tue Apr 12 2022 Xin Long <lxin@redhat.com> - 1.0.19-2
- Bring back one RHEL specific patch to fix the installation issue.
Related: rhbz#2031786
* Wed Nov 17 2021 Xin Long <lxin@redhat.com> - 1.0.19-1
- Rebase to 1.0.19 and append the fixes for gethostbyname.
Related: rhbz#1982820
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.0.18-11
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1.0.18-10
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.18-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Sep 09 2020 Jeff Law <law@redhat.com> - 1.0.18-8
- Use symver attribute for symbol versioning. Re-enable LTO
* Wed Aug 19 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 1.0.18-7
- Drop useless ldconfig scriptlets
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.18-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Jul 01 2020 Jeff Law <law@redhat.com> - 1.0.18-5
- Disable LTO
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.18-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Fri Oct 18 2019 Vit Mojzis <vmojzis@redhat.com> - 1.0.18-3
- Added a patch to fix netinet/sctp.h not to be installed.
- Added some fixes for kernel feature detection.
* Fri Aug 17 2018 Xin Long <lxin@redhat.com> - 1.0.18-2
- Added some follow-ups for 1.0.18.
* Mon Aug 13 2018 Marcelo Ricardo Leitner <mleitner@redhat.com> - 1.0.18-1
- Updated to 1.0.18. [1568622]
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.16-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.16-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.16-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.16-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

View File

@ -0,0 +1,150 @@
From 2a3a4bc0ba94656c007ebaae52e50b42b95ded32 Mon Sep 17 00:00:00 2001
From: Xin Long <lucien.xin@gmail.com>
Date: Mon, 27 Feb 2023 18:10:32 -0500
Subject: [PATCH 6/6] man: add CONTROL MSGS and NOTIFICATIONS in sctp.7
Control msgs and notifications are two very important parts
for users to understand and user in programming, and they
are wonth a place in the SCTP manual doc.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
man/sctp.7 | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 122 insertions(+)
diff --git a/man/sctp.7 b/man/sctp.7
index 01bff6f..323d42e 100644
--- a/man/sctp.7
+++ b/man/sctp.7
@@ -244,6 +244,128 @@ The number of SCTP packets discarded in receiving.
.TP
.B SctpInDataChunkDiscards
The number of SCTP data chunks discarded in receiving.
+.SH CONTROL MSGS
+The ancillary data is carried in msg_control field of struct msghdr, which is
+used in
+.B sendmsg(2)
+and
+.B recvmsg(2)
+call. The SCTP stack uses the ancillary data to communicate the attributes,
+such as SCTP_RCVINFO, of the message stored in msg_iov to the socket endpoint.
+Each ancillary data item is preceded by a struct cmsghdr, see
+.B cmsg(3).
+The different cmsg types for SCTP are listed below, and all these related macros
+and structures are defined in /usr/include/netinet/sctp.h.
+.TP
+.B SCTP_INIT
+This cmsg provides information for initializing new SCTP associations for sendmsg()
+with struct sctp_initmsg, which is the same as SCTP_INITMSG socket option's data
+structure.
+.TP
+.B SCTP_SNDRCV
+This cmsg specifies SCTP options for sendmsg() and describes SCTP header information
+about a received message through recvmsg() with struct sctp_sndrcvinfo. It mixes the
+send and receive path, and SCTP_SNDINFO and SCTP_RCVINFO split this information, so
+these structures should be used, when possible, since SCTP_SNDRCV is deprecated.
+.B sctp_sendmsg(3)
+and
+.B sctp_send(3)
+provide a simple way to use this cmsg.
+
+Note that an application must use the SCTP_RECVRCVINFO socket option to enable the
+delivery of this information.
+.TP
+.B SCTP_EXTRCV
+This cmsg specifies SCTP options for SCTP header information about a received message
+via recvmsg() with struct sctp_extrcvinfo, and this structure is an extended version
+of SCTP_SNDRCV. Note that data in the next message is not valid unless the current
+message is completely read, i.e., unless the MSG_EOR is set. SCTP_NXTINFO should be
+used when possible, since SCTP_EXTRCV is considered deprecated.
+.B sctp_recvmsg(3)
+provides a simple way to use this cmsg.
+
+Note that an application must use the SCTP_RECVNXTINFO socket option to enable the
+delivery of this information.
+.TP
+.B SCTP_RCVINFO, SCTP_NXTINFO
+These cmsgs describe SCTP receive information about a received message through
+recvmsg() with struct sctp_rcvinfo, and SCTP receive information of the next
+message that will be delivered through recvmsg() if this information is already
+available when delivering the current message with struct sctp_nxtinfo.
+.B sctp_recvv(3)
+provides a simple way to use these cmsgs.
+
+Note that an application must use the SCTP_RECVRCVINFO and SCTP_RECVNXTINFO socket
+options accordingly to enable the delivery of this information.
+.TP
+.B SCTP_SNDINFO, SCTP_PRINFO, SCTP_AUTHINFO, SCTP_DSTADDRV4, SCTP_DSTADDRV6
+These cmsgs specifie a couple of SCTP options for sendmsg() for SEND, PRSCTP, AUTH
+and DSTADDR information with struct sctp_sndinfo, sctp_prinfo, sctp_authinfo and
+in(6)_addr accordingly.
+.BR sctp_sendv(3)
+provides a simple way to use these cmsgs.
+.SH EVENTS and NOTIFICATIONS
+An SCTP application may need to understand and process events and errors
+that happen on the SCTP stack. These events include network status changes,
+association startups, remote operational errors, and undeliverable messages.
+When a notification arrives, recvmsg() returns the notification in the
+application-supplied data buffer via msg_iov, and sets MSG_NOTIFICATION in
+msg_flags. See socket option SCTP_EVENT for the event enabling. The different
+events are listed below, and all these related macros and structures are
+defined in /usr/include/netinet/sctp.h.
+.TP
+.B SCTP_ASSOC_CHANGE
+Communication notifications inform the application that an SCTP
+association has either begun or ended. The notification format
+is struct sctp_assoc_change.
+.TP
+.B SCTP_PEER_ADDR_CHANGE
+When a destination address of a multi-homed peer encounters a state
+change, a peer address change event is sent. The notification format
+is struct sctp_paddr_change.
+.TP
+.B SCTP_REMOTE_ERROR
+A remote peer may send an Operation Error message to its peer. This
+message indicates a variety of error conditions on an association.
+The notification format is struct sctp_remote_error.
+.TP
+.B SCTP_SEND_FAILED
+If SCTP cannot deliver a message, it can return back the message as a
+notification if the SCTP_SEND_FAILED event is enabled. The notification
+format is struct sctp_send_failed. Please note that this notification
+is deprecated. Use SCTP_SEND_FAILED_EVENT instead.
+.TP
+.B SCTP_SHUTDOWN_EVENT
+When a peer sends a SHUTDOWN, SCTP delivers this notification to inform
+the application that it should cease sending data. The notification
+format is struct sctp_shutdown_event.
+.TP
+.B SCTP_ADAPTATION_INDICATION
+When a peer sends an Adaptation Layer Indication parameter, SCTP delivers
+this notification to inform the application about the peer's adaptation
+layer indication. The notification format is struct sctp_adaptation_event.
+.TP
+.B SCTP_PARTIAL_DELIVERY_EVENT
+When a receiver is engaged in a partial delivery of a message, this
+notification will be used to indicate various events. The notification
+format is struct sctp_pdapi_event.
+.TP
+.B SCTP_AUTHENTICATION_EVENT
+This is used to report different events relating to the use of the
+extension to authenticate SCTP messages. The notification format is
+struct sctp_authkey_event.
+.TP
+.B SCTP_SENDER_DRY_EVENT
+When the SCTP stack has no more user data to send or retransmit, this
+notification is given to the user. Also, at the time when a user app
+subscribes to this event, if there is no data to be sent or retransmit,
+the stack will immediately send up this notification. The notification
+format is struct sctp_sender_dry_event.
+.TP
+.B SCTP_SEND_FAILED_EVENT
+If SCTP cannot deliver a message, it can return back the message as a
+notification if the SCTP_SEND_FAILED_EVENT event is enabled. The
+notification format is struct sctp_send_failed_event.
.SH "SOCKET OPTIONS"
To set or get a SCTP socket option, call
.BR getsockopt (2)
--
2.39.1

View File

@ -0,0 +1,85 @@
From f128c927f7d4f5eb0fc80b857ff74660fb61d0d6 Mon Sep 17 00:00:00 2001
From: Xin Long <lucien.xin@gmail.com>
Date: Mon, 27 Feb 2023 17:18:10 -0500
Subject: [PATCH 3/6] man: add some missing items in STATISTICS in sctp.7
Many items have been added in /proc/net/sctp/assocs and
/proc/net/sctp/snmp, and this patch adds the missing
description for them.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
man/sctp.7 | 50 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 49 insertions(+), 1 deletion(-)
diff --git a/man/sctp.7 b/man/sctp.7
index c19c2b7..730e1a8 100644
--- a/man/sctp.7
+++ b/man/sctp.7
@@ -121,7 +121,10 @@ files.
Displays the following information about the active associations.
assoc ptr, sock ptr, socket style, sock state, association state, hash bucket,
association id, bytes in transmit queue, bytes in receive queue, user id,
-inode, local port, remote port, local addresses and remote addresses.
+inode, local port, remote port, local addresses, remote addresses,
+heartbeat interval, in streams, out streams, max retransmissions, init retries,
+shutdown retries, retransmitted chunks, sock transmit queue committed bytes,
+sock transmit queue bytes, and sock send and receive buffer bytes.
.TP
.B eps
Displays the following information about the active endpoints.
@@ -196,6 +199,51 @@ The number of SCTP packets sent. Retransmitted DATA chunks are included.
.TP
.B SctpInSCTPPacks
The number of SCTP packets received. Duplicates are included.
+.TP
+.B SctpT1InitExpireds
+The number of timer T1 INIT expired.
+.TP
+.B SctpT1CookieExpireds
+The number of timer T1 COOKIE-ECHO expired.
+.TP
+.B SctpT2ShutdownExpireds
+The number of timer T2 SHUTDOWN expired.
+.TP
+.B SctpT3RtxExpireds
+The number of timer T3 RTX expired.
+.TP
+.B SctpT4RtoExpireds
+The number of timer T4 RTO expired.
+.TP
+.B SctpT5ShutdownGuardExpireds
+The number of timer T5 SHUTDOWN GUARD expired.
+.TP
+.B SctpDelaySackExpireds
+The number of timer DELAY_SACK expired.
+.TP
+.B SctpAutocloseExpireds
+The number of timer AUTOCLOSE expired.
+.TP
+.B SctpT3Retransmits
+The number of T3 timer retransmission.
+.TP
+.B SctpPmtudRetransmits
+The number of PMTUD retransmission.
+.TP
+.B SctpFastRetransmits
+The number of FAST retransmission.
+.TP
+.B SctpInPktSoftirq
+The number of SCTP packets received in Softirq.
+.TP
+.B SctpInPktBacklog
+The number of SCTP packets received in Backlog.
+.TP
+.B SctpInPktDiscards
+The number of SCTP packets discarded in receiving.
+.TP
+.B SctpInDataChunkDiscards
+The number of SCTP data chunks discarded in receiving.
.SH "SOCKET OPTIONS"
To set or get a SCTP socket option, call
.BR getsockopt (2)
--
2.39.1

View File

@ -0,0 +1,52 @@
From d680721b59b5533f776705ad10f1265302f70103 Mon Sep 17 00:00:00 2001
From: Xin Long <lucien.xin@gmail.com>
Date: Mon, 27 Feb 2023 12:57:49 -0500
Subject: [PATCH 1/6] man: add the missing description for 3 flags in
sctp_sendmsg.3
This patch is to add the missing description for 3 flags:
SCTP_SENDALL, SCTP_SACK_IMMEDIATELY and SCTP_PR_SCTP_{TTL|RTX|PRIO}.
which have been supported in kernel for a long time.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
man/sctp_sendmsg.3 | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/man/sctp_sendmsg.3 b/man/sctp_sendmsg.3
index 51828fb..3e57131 100644
--- a/man/sctp_sendmsg.3
+++ b/man/sctp_sendmsg.3
@@ -57,11 +57,28 @@ information of this error cause is provided in
.B SCTP_EOF
Setting this flag invokes the SCTP graceful shutdown procedure on the specific
association(one-to-many style only).
+.TP
+.B SCTP_SENDALL
+This flag, if set, will cause a one-to-many style socket to send the message
+to all associations that are currently established on this socket. For the
+one-to-one style socket, this flag has no effect.
+.TP
+.B SCTP_SACK_IMMEDIATELY
+This flag allows the application to set the I bit of the last DATA chunk when
+sending each user message to make sure the corresponding SACK can be sent by
+peer without delay.
+.TP
+.B SCTP_PR_SCTP_{TTL|RTX|PRIO}
+One of these 3 pr_policies can be used through this flag with its pr_value
+set in timetolive parameter for this message. Note that
+.B sctp_sendv(3)
+with infotype SCTP_SENDV_PRINFO also works for PR-SCTP.
.PP
.I timetolive
specifies the time duration in milliseconds. The sending side will expire the
message if the message has not been sent to the peer within this time period.
-A value of 0 indicates that no timeout should occur on this message.
+A value of 0 indicates that no timeout should occur on this message. It also
+works as the pr_value if flags parameter is set to pr_policy.
.I ppid
is an opaque unsigned value that is passed to the remote end along with the
message.
--
2.39.1

View File

@ -0,0 +1,535 @@
From df0cd18b5d81a7f8c661e6e565e5e35e00fbb9d8 Mon Sep 17 00:00:00 2001
From: Xin Long <lucien.xin@gmail.com>
Date: Mon, 27 Feb 2023 17:57:20 -0500
Subject: [PATCH 5/6] man: add the missing options in SOCKET OPTIONS in sctp.7
There are a lot of options missing in in SOCKET OPTIONS in sctp.7,
and this patch adds them all.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
man/sctp.7 | 508 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 508 insertions(+)
diff --git a/man/sctp.7 b/man/sctp.7
index 7756dda..01bff6f 100644
--- a/man/sctp.7
+++ b/man/sctp.7
@@ -431,6 +431,514 @@ SACKs sent and received, SCTP packets sent and received.
The parameter type is struct sctp_assoc_stats, for reading only.
sas_assoc_id is a specified assoc_id.
+.TP
+.B SCTP_DELAYED_ACK, SCTP_DELAYED_ACK_TIME, SCTP_DELAYED_SACK
+These options will affect the way delayed SACKs are performed. They allow
+the application to get or set the delayed SACK time, in milliseconds, and
+also allow changing the delayed SACK frequency. Changing the frequency
+to 1 disables the delayed SACK algorithm. Note that if sack_delay or
+sack_freq is 0 when setting this option, the current values will remain
+unchanged.
+
+The parameter type is struct sctp_sack_info. For reading, sack_assoc_id is
+a specified assoc_id or SCTP_FUTURE_ASSOC. For writing, sack_assoc_id is a
+specified assoc_id or SCTP_{FUTURE|CURRENT|ALL}_ASSOC.
+
+Default: sackdelay=sysctl_net.sctp.sack_timeout,sackfreq=2.
+.TP
+.B SCTP_CONTEXT
+This option allows the setting, on an association basis, of a default
+context that will be received on reading messages from the peer.
+This is especially helpful for an application when using one-to-many
+style sockets to keep some reference to an internal state machine that
+is processing messages on the association. Note that the setting of
+this value only affects received messages from the peer and does not
+affect the value that is saved with outbound messages.
+
+The parameter type is struct sctp_assoc_value. For reading, assoc_id
+is a specified assoc_id or SCTP_FUTURE_ASSOC. For writing, assoc_id
+is a specified assoc_id or SCTP_{FUTURE|CURRENT|ALL}_ASSOC.
+
+Default: 0.
+.TP
+.B SCTP_FRAGMENT_INTERLEAVE
+Fragmented interleave controls how the presentation of messages
+occurs for the message receiver. There are three levels of fragment
+interleave defined: level 0: SCTP_FRAGMENT_INTERLEAVE = 0; level 1:
+SCTP_FRAGMENT_INTERLEAVE = 1; level 2: SCTP_FRAGMENT_INTERLEAVE = 1
+& SCTP_INTERLEAVING_SUPPORTED = 1.
+
+The parameter type is int boolean, for reading and writing.
+
+Default: 0.
+.TP
+.B SCTP_PARTIAL_DELIVERY_POINT
+This option will set or get the SCTP partial delivery point. This
+point is the size of a message where the partial delivery API will be
+invoked to help free up rwnd space for the peer. Setting this to a
+lower value will cause partial deliveries to happen more often. This
+option expects an integer that sets or gets the partial delivery
+point in bytes. Note also that the call will fail if the user
+attempts to set this value larger than the socket receive buffer
+size. Note that any single message having a length smaller than or equal
+to the SCTP partial delivery point will be delivered in a single read
+call as long as the user-provided buffer is large enough to hold the
+message.
+
+The parameter type is uint32_t, for reading and writing.
+
+Default: 0.
+.TP
+.B SCTP_MAX_BURST
+This option will allow a user to change the maximum burst of packets
+that can be emitted by this association.
+
+The parameter type is struct sctp_assoc_value. For reading, assoc_id
+is a specified assoc_id or SCTP_FUTURE_ASSOC. For writing, assoc_id
+is a specified assoc_id or SCTP_{FUTURE|CURRENT|ALL}_ASSOC.
+
+Default: sysctl_net.sctp.max_burst.
+.TP
+.B SCTP_AUTH_CHUNK
+This option adds a chunk type that the user is requesting to be received
+only in an authenticated way, and it only affects the future associations.
+
+The parameter type is struct sauth_chunk, for writing only.
+
+Default: no chunks.
+Require: SCTP_AUTH_SUPPORTED.
+RFC: RFC4895.
+.TP
+.B SCTP_HMAC_IDENT
+This option gets or sets the list of Hashed Message Authentication
+Code (HMAC) algorithms that the local endpoint requires the peer
+to use.
+
+The parameter type is struct sctp_hmacalgo, for reading and writing.
+shmac_idents can include SCTP_AUTH_HMAC_ID_{SHA1|SHA256}.
+
+Default: SCTP_AUTH_HMAC_ID_SHA1.
+Require: SCTP_AUTH_SUPPORTED.
+.TP
+.B SCTP_AUTH_KEY
+This option will set a shared secret key that is used to build an
+association shared key.
+
+The parameter type is struct sctp_authkey, for writing only. sca_assoc_id
+is a specified assoc_id or SCTP_{FUTURE|CURRENT|ALL}_ASSOC.
+
+Default: null_key.
+Require: SCTP_AUTH_SUPPORTED.
+.TP
+.B SCTP_AUTH_ACTIVE_KEY
+This option will get or set the active shared key to be used to build
+the association shared key.
+
+The parameter type is struct sctp_authkeyid, for writing only.
+scact_assoc_id is a specified assoc_id or
+SCTP_{FUTURE|CURRENT|ALL}_ASSOC.
+
+Default: 0.
+Require: SCTP_AUTH_SUPPORTED.
+.TP
+.B SCTP_AUTH_DEACTIVATE_KEY
+This set option indicates that the application will no longer send
+user messages using the indicated key identifier.
+
+The parameter type is struct sctp_authkeyid, for writing only.
+scact_assoc_id is a specified assoc_id or
+SCTP_{FUTURE|CURRENT|ALL}_ASSOC.
+
+Require: SCTP_AUTH_SUPPORTED.
+.TP
+.B SCTP_AUTH_DELETE_KEY
+This set option will delete an SCTP association's shared secret key
+that has been deactivated.
+
+The parameter type is struct sctp_authkeyid, for writing only.
+scact_assoc_id is a specified assoc_id or
+SCTP_{FUTURE|CURRENT|ALL}_ASSOC.
+
+Require: SCTP_AUTH_SUPPORTED.
+.TP
+.B SCTP_PEER_AUTH_CHUNKS
+This option gets a list of chunk types for a specified association
+that the peer requires to be received authenticated only.
+
+The parameter type is struct sctp_authchunks, for reading only.
+gauth_assoc_id is a specified assoc_id.
+
+Require: SCTP_AUTH_SUPPORTED.
+.TP
+.B SCTP_LOCAL_AUTH_CHUNKS
+This option gets a list of chunk types for a specified association that
+the local endpoint requires to be received authenticated only.
+
+The parameter type is struct sctp_authchunks, for reading only.
+gauth_assoc_id is a specified assoc_id or SCTP_FUTURE_ASSOC.
+
+Require: SCTP_AUTH_SUPPORTED.
+.TP
+.B SCTP_GET_ASSOC_NUMBER
+This option gets the current number of associations that are attached
+to a one-to-many style socket. Note that this number is only a snapshot.
+This means that the number of associations may have changed when the
+caller gets back the option result.
+
+The parameter type is uint32_t, for reading only.
+.TP
+.B SCTP_GET_ASSOC_ID_LIST
+This option gets the current list of SCTP association identifiers of
+the SCTP associations handled by a one-to-many style socket. It uses
+struct sctp_assoc_ids and must provide a large enough buffer to hold
+all association identifiers. If the buffer is too small, an error must
+be returned. The user can use the SCTP_GET_ASSOC_NUMBER socket option
+to get an idea of how large the buffer has to be.
+
+The parameter type is struct sctp_assoc_ids, for reading only.
+.TP
+.B SCTP_EXPOSE_POTENTIALLY_FAILED_STATE, SCTP_EXPOSE_PF_STATE
+Applications can control the exposure of the PF path state in the
+SCTP_PEER_ADDR_CHANGE event, and if pf_expose is not 'enabled', no
+notification will be sent for a transport state change to SCTP_PF.
+It also affects the SCTP_GET_PEER_ADDR_INFO socket option, and if
+pf_expose is 'disabled', users can not access the transport info via
+SCTP_GET_PEER_ADDR_INFO option.
+
+The parameter type is struct sctp_assoc_value, for reading and writing.
+assoc_id is a specified assoc_id or SCTP_FUTURE_ASSOC.
+
+Default: sysctl_net.sctp.pf_expose.
+.TP
+.B SCTP_PEER_ADDR_THLDS
+Applications can control the SCTP-PF behavior by getting or setting
+the number of consecutive timeouts before a peer address is
+considered PF or unreachable..
+
+The parameter type is struct sctp_paddrthlds, for reading and writing.
+spt_address is a specified transport address or 0, spt_assoc_id
+is a specified assoc_id or SCTP_FUTURE_ASSOC.
+
+Default: pathmaxrxt=sysctl_net.sctp.path_max_retrans,
+ps_retrans=sysctl_net.sctp.ps_retrans.
+.TP
+.B SCTP_PEER_ADDR_THLDS_V2
+Similar to SCTP_PEER_ADDR_THLDS, but it can also be used by applications
+to set and get the number of timeouts before the primary path is changed
+automatically by the Primary Path Switchover function.
+
+The parameter type is struct sctp_paddrthlds_v2, for reading and writing.
+spt_address is a specified transport address or 0, spt_assoc_id is a
+specified assoc_id or SCTP_FUTURE_ASSOC.
+
+Default: pathmaxrxt=sysctl_net.sctp.path_max_retrans,
+ps_retrans=sysctl_net.sctp.ps_retrans, pf_retrans=sysctl_net.sctp.pf_retrans.
+.TP
+.B SCTP_RECVRCVINFO
+Setting this option specifies that SCTP_RCVINFO (SCTP receive information
+about a received message) is returned as ancillary data by recvmsg(). See
+.B CONTROL MSGS
+for more details.
+
+The parameter type is int, for reading and writing.
+
+Default: 0.
+.TP
+.B SCTP_RECVNXTINFO
+Setting this option specifies that SCTP_NXTINFO (SCTP receive information
+of the next message) is returned as ancillary data by recvmsg(). See
+.B CONTROL MSGS
+for details.
+
+The parameter type is int, for reading and writing.
+
+Default: 0.
+.TP
+.B SCTP_DEFAULT_SNDINFO
+This option obsoletes SCTP_DEFAULT_SEND_PARAM.
+
+The parameter type is struct sctp_sndinfo. For reading, snd_assoc_id is
+a specified assoc_id or SCTP_FUTURE_ASSOC. For writing, snd_assoc_id is
+a specified assoc_id or SCTP_{FUTURE|CURRENT|ALL}_ASSOC.
+
+Default: default_stream=0, default_flags=0, default_ppid=0, default_context=0.
+.TP
+.B SCTP_REUSE_PORT
+This option is similar to the socket level option SO_REUSEADDR, besides
+only supports one-to-one style SCTP sockets and must not be used after
+calling bind() or sctp_bindx().
+
+The parameter type is int, for reading and writing.
+
+Default: 0.
+.TP
+.B SCTP_SOCKOPT_BINDX_ADD
+This option allows the user to bind a specific subset of addresses or,
+if the SCTP extension ASCONF is supported (see SCTP_ASCONF_SUPPORTED),
+add specific addresses. The API sctp_bindx() is based on this.
+
+The parameter type is struct sockaddr[], for writing only.
+.TP
+.B SCTP_SOCKOPT_BINDX_REM
+Similar to SCTP_SOCKOPT_BINDX_ADD, but delete specific addresses. The API
+sctp_bindx() is based on this.
+
+The parameter type is struct sockaddr[], for writing only.
+.TP
+.B SCTP_SOCKOPT_PEELOFF
+This option branches off an UDP type association into a separate socket
+returned back to users. The API sctp_peeloff() is based on this option.
+
+The parameter type is sctp_peeloff_arg_t, for reading only. associd is a
+specified assoc_id.
+.TP
+.B SCTP_SOCKOPT_PEELOFF_FLAGS
+Peel off an UDP type association from a socket similar to SCTP_SOCKOPT_PEELOFF
+option, but it allows the flags like O_CLOEXEC and O_NONBLOCK to be used when
+creating the new socket. The API sctp_peeloff_flags() is based on this option.
+
+The parameter type is sctp_peeloff_flags_arg_t, for reading only. associd
+is a specified assoc_id.
+.TP
+.B SCTP_SOCKOPT_CONNECTX_OLD
+This option allows a user to specify multiple addresses at which a peer can
+be reached, and the kernel stack will use the list of addresses to set up
+the association. The API sctp_connectx() is based on this option.
+
+The parameter type is struct sockaddr[], for writing only.
+.TP
+.B SCTP_SOCKOPT_CONNECTX
+Similar to SCTP_SOCKOPT_CONNECTX_OLD, but it returns the new assoc's id.
+The API sctp_connectx2() is based on this option.
+
+The parameter type is struct sockaddr[], for writing only. The new assoc's
+id is passed to users by the return value.
+.TP
+.B SCTP_SOCKOPT_CONNECTX3
+Similar to SCTP_SOCKOPT_CONNECTX, but it uses different type parameter. The
+API sctp_connectx3() is based on this option.
+
+The parameter type is struct sctp_getaddrs_old, for reading only. assoc_id
+is set to the new assoc's id by kernel and passed to users.
+.TP
+.B SCTP_GET_PEER_ADDRS
+This option is used to gets all peer addresses in an association. The API
+sctp_getpaddrs() is based on this option.
+
+The parameter type is struct sctp_getaddrs, for reading only. assoc_id
+is a specified assoc_id.
+.TP
+.B SCTP_GET_LOCAL_ADDRS
+This option is used to get all local addresses in an association. The API
+sctp_getladdrs() is based on this option.
+
+The parameter type is struct sctp_getaddrs, for reading only. assoc_id
+is a specified assoc_id or SCTP_FUTURE_ASSOC.
+.TP
+.B SCTP_ADAPTATION_LAYER
+This option requests that the local endpoint set the specified
+Adaptation Layer Indication parameter for all future INIT and
+INIT-ACK exchanges.
+
+The parameter type is struct sctp_setadaptation, for reading and writing.
+
+Default: 0.
+.TP
+.B SCTP_EVENT
+This option obsoletes SCTP_EVENTS socket option, and it can set or get
+one specific type of event for a specified association.
+
+The parameter type is struct sctp_event. For reading, se_assoc_id is
+a specified assoc_id or SCTP_FUTURE_ASSOC. For writing, se_assoc_id
+is a specified assoc_id or SCTP_{FUTURE|CURRENT|ALL}_ASSOC. se_type
+can be one of enum sctp_sn_type.
+
+Default: 0.
+.TP
+.B SCTP_PR_SUPPORTED
+This socket option allows the enabling or disabling of the negotiation of
+PR-SCTP support for future associations.
+
+The parameter type is struct sctp_assoc_value. For reading, assoc_id
+is a specified assoc_id or SCTP_FUTURE_ASSOC. For writing, assoc_id
+is SCTP_FUTURE_ASSOC.
+
+Default: sysctl_net.sctp.prsctp_enable.
+RFC: RFC7496.
+.TP
+.B SCTP_DEFAULT_PRINFO
+This option sets and gets the default parameters for PR-SCTP.
+
+The parameter type is struct sctp_default_prinfo. For reading, pr_assoc_id
+is a specified assoc_id or SCTP_FUTURE_ASSOC. For writing, pr_assoc_id is
+a specified assoc_id or SCTP_{FUTURE|CURRENT|ALL}_ASSOC. pr_policy can be
+SCTP_PR_SCTP_{NONE|TTL|RTX|PRIO}.
+
+Default: SCTP_PR_SCTP_NONE.
+Require: SCTP_DEFAULT_PRINFO.
+.TP
+.B SCTP_PR_ASSOC_STATUS
+This option is used to get Association-Specific PR-SCTP Status.
+
+The parameter type is struct sctp_prstatus, for reading only.
+sprstat_assoc_id is a specified assoc_id, sprstat_policy
+can be SCTP_PR_SCTP_{TTL|RTX|PRIO|ALL}.
+.TP
+.B SCTP_PR_STREAM_STATUS
+This option is used to get Stream-Specific PR-SCTP Status.
+
+The parameter type is struct sctp_prstatus, for reading only.
+sprstat_assoc_id is a specified assoc_id, sprstat_policy
+can be SCTP_PR_SCTP_{TTL|RTX|PRIO|ALL}.
+.TP
+.B SCTP_RECONFIG_SUPPORTED
+Enable the Stream Reconfiguration(RECONF) for the future associations.
+For different type of requests enabling, see SCTP_ENABLE_STREAM_RESET
+option.
+
+The parameter type is struct sctp_assoc_value. For reading, assoc_id
+is a specified assoc_id or SCTP_FUTURE_ASSOC. For writing, assoc_id
+is SCTP_FUTURE_ASSOC.
+
+Default: sysctl_net.sctp.reconf_enable.
+RFC: RFC6525.
+.TP
+.B SCTP_ENABLE_STREAM_RESET
+This option allows a user to control whether the kernel processes or denies
+incoming requests in RECONF chunks.
+
+The parameter type is struct sctp_assoc_value. For reading, assoc_id is
+a specified assoc_id or SCTP_FUTURE_ASSOC. For writing, assoc_id is
+a specified assoc_id or SCTP_{FUTURE|CURRENT|ALL}_ASSOC. assoc_value
+can be SCTP_ENABLE_{RESET_STREAM_REQ|RESET_ASSOC_REQ|CHANGE_ASSOC_REQ}.
+
+Default: 0.
+Require: SCTP_RECONFIG_SUPPORTED.
+.TP
+.B SCTP_RESET_STREAMS
+This option allows the user to request the reset of incoming and/or
+outgoing streams.
+
+The parameter type is struct sctp_reset_streams, for writing only.
+srs_assoc_id is a specified assoc_id.
+
+Require: SCTP_ENABLE_STREAM_RESET.
+.TP
+.B SCTP_RESET_ASSOC
+This option allows a user to request the reset of the SSN/TSN.
+
+The parameter type is sctp_assoc_t, for writing only. It is a specified
+assoc_id.
+
+Require: SCTP_ENABLE_STREAM_RESET.
+.TP
+.B SCTP_ADD_STREAMS
+This option allows a user to request the addition of a number of incoming
+and/or outgoing streams.
+
+The parameter type is struct sctp_add_streams, for writing only.
+sas_assoc_id is a specified assoc_id.
+
+Require: SCTP_ENABLE_STREAM_RESET.
+.TP
+.B SCTP_STREAM_SCHEDULER
+This option is used to select a stream scheduler for data sending.
+
+The parameter type is struct sctp_assoc_value. For reading, assoc_id is
+a specified assoc_id or SCTP_FUTURE_ASSOC. For writing, assoc_id is a
+specified assoc_id or SCTP_{FUTURE|CURRENT|ALL}_ASSOC. assoc_value can
+be SCTP_SS_{FCFS|PRIO|RR|FC|WFQ}.
+
+Default: SCTP_SS_FCFS.
+RFC: RFC8260.
+.TP
+.B SCTP_STREAM_SCHEDULER_VALUE
+Some stream schedulers require additional information to be set for
+individual streams.
+
+The parameter type is struct sctp_assoc_value. For reading, assoc_id is
+a specified assoc_id. For writing, assoc_id is a specified assoc_id or
+SCTP_CURRENT_ASSOC.
+
+Require: SCTP_STREAM_SCHEDULER.
+.TP
+.B SCTP_INTERLEAVING_SUPPORTED
+This socket option allows the enabling or disabling of the negotiation of
+user message interleaving support for future associations.
+
+The parameter type is struct sctp_assoc_value. For reading, assoc_id
+is a specified assoc_id or SCTP_FUTURE_ASSOC. For writing, assoc_id
+is SCTP_FUTURE_ASSOC.
+
+Default: sysctl_net.sctp.intl_enable.
+Require: SCTP_FRAGMENT_INTERLEAVE.
+RFC: RFC8260.
+.TP
+.B SCTP_ASCONF_SUPPORTED
+Enable the Dynamic Address Reconfiguration(ASCONF) for the future
+associations.
+
+The parameter type is struct sctp_assoc_value. For reading, assoc_id
+is a specified assoc_id or SCTP_FUTURE_ASSOC. For writing, assoc_id
+is SCTP_FUTURE_ASSOC.
+
+Default: sysctl_net.sctp.addip_enable.
+RFC: RFC5061.
+.TP
+.B SCTP_AUTO_ASCONF
+This option will enable or disable the use of the automatic generation of
+ASCONF chunks to add and delete addresses to an existing association.
+Note that this option has two caveats, namely a) it only affects sockets
+that are bound to all addresses available to the SCTP stack, and b) the
+system administrator may have an overriding control that turns the ASCONF
+feature off no matter what setting the socket option may have.
+
+The parameter type is int boolean, for reading and writing.
+
+Default: sysctl_net.sctp.default_auto_asconf.
+.TP
+.B SCTP_AUTH_SUPPORTED
+Enable AUTH for the future associations.
+
+The parameter type is struct sctp_assoc_value. For reading, assoc_id
+is a specified assoc_id or SCTP_FUTURE_ASSOC. For writing, ssoc_id
+is SCTP_FUTURE_ASSOC.
+
+Default: sysctl_net.sctp.auth_enable.
+RFC: RFC4895.
+.TP
+.B SCTP_ECN_SUPPORTED
+Enable ECN for the future associations.
+
+The parameter type is struct sctp_assoc_value. For reading, assoc_id
+is a specified assoc_id or SCTP_FUTURE_ASSOC. For writing, assoc_id
+is SCTP_FUTURE_ASSOC.
+
+Default: sysctl_net.sctp.ecn_enable.
+.TP
+.B SCTP_REMOTE_UDP_ENCAPS_PORT
+This option is used to set the encapsulation port(a remote listening or
+dest port) for SCTP over UDP, which allows SCTP traffic to pass through
+legacy NATs that do not provide native SCTP support.
+
+The parameter type is struct sctp_udpencaps, for reading and writing.
+sue_address is a specified transport address or 0, sue_assoc_id
+is a specified assoc_id or SCTP_FUTURE_ASSOC.
+
+Default: sysctl_net.sctp.encap_port.
+RFC: RFC6951.
+.TP
+.B SCTP_PLPMTUD_PROBE_INTERVAL
+This option is used to configure the PROBE_INTERVAL for the Packetization
+Layer Path MTU Discovery(PLPMTUD). It can be set to a value >= 5000 or
+0(disabled).
+
+The parameter type is struct sctp_probeinterval, for reading and writing.
+spi_address is a specified transport address or 0, spi_assoc_id is
+a specified assoc_id or SCTP_FUTURE_ASSOC.
+
+Default: 0(disabled).
+RFC: RFC8899.
.SH AUTHORS
Sridhar Samudrala <sri@us.ibm.com>
.SH "SEE ALSO"
--
2.39.1

View File

@ -0,0 +1,273 @@
From 1bf06687ff8b0db8b3ac38b0206eea8a7b6f4632 Mon Sep 17 00:00:00 2001
From: Xin Long <lucien.xin@gmail.com>
Date: Mon, 27 Feb 2023 17:37:19 -0500
Subject: [PATCH 4/6] man: improve the description in SOCKET OPTIONS in sctp.7
SCTP_{FUTURE|CURRENT|ALL}_ASSOC have been introduced for some options to
make set/get more effectively, we should mention it in the description
of these options. Also, it's better to give users more information like:
the structure it uses as parameter, the default value, the dependence on
other options if any, write or read permissions etc.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
man/sctp.7 | 186 +++++++++++++++++++++++++++++++++++------------------
1 file changed, 123 insertions(+), 63 deletions(-)
diff --git a/man/sctp.7 b/man/sctp.7
index 730e1a8..7756dda 100644
--- a/man/sctp.7
+++ b/man/sctp.7
@@ -251,95 +251,148 @@ to read or
.BR setsockopt (2)
to write the option with the option level argument set to
.BR SOL_SCTP.
+Note that all these macros and structures described for parameters are defined
+in /usr/include/netinet/sctp.h, and for one-to-one style sockets a specified
+assoc_id works the same as SCTP_FUTURE_ASSOC.
.TP
.BR SCTP_RTOINFO.
This option is used to get or set the protocol parameters used to
-initialize and bound retransmission timeout(RTO). The structure sctp_rtoinfo
-defined in /usr/include/netinet/sctp.h is used to access and modify these
-parameters.
+initialize and bound retransmission timeout(RTO).
+
+The parameter type is struct sctp_rtoinfo, for reading and writing.
+srto_assoc_id is a specified assoc_id or SCTP_FUTURE_ASSOC.
+
+Default: srto_max=sysctl_net.sctp.rto_max, srto_min=sysctl_net.sctp.rto_min,
+srto_initial=sysctl_net.sctp.rto_initial.
.TP
.B SCTP_ASSOCINFO
This option is used to both examine and set various association and endpoint
-parameters. The structure sctp_assocparams defined in
-/usr/include/netinet/sctp.h is used to access and modify these parameters.
+parameters.
+
+The parameter type is struct sctp_assocparams, for reading and writing.
+sasoc_assoc_id is a specified assoc_id or SCTP_FUTURE_ASSOC. Note that
+some fields of this structure are for reading only:
+
+ struct sctp_assocparams {
+ sctp_assoc_t sasoc_assoc_id;
+ __u16 sasoc_asocmaxrxt; (RW)
+ __u16 sasoc_number_peer_destinations; (R)
+ __u32 sasoc_peer_rwnd; (R)
+ __u32 sasoc_local_rwnd; (R)
+ __u32 sasoc_cookie_life; (RW)
+ };
+
+Default: sasoc_asocmaxrxt=sysctl_net.sctp.association_max_retrans,
+sasoc_cookie_life=sysctl_net.sctp.valid_cookie_life.
.TP
.B SCTP_INITMSG
This option is used to get or set the protocol parameters for the default
-association initialization. The structure sctp_initmsg defined in
-/usr/include/netinet/sctp.h is used to access and modify these parameters.
+association initialization.
+
+The parameter type is struct sctp_initmsg, for reading and writing.
-Setting initialization parameters is effective only on an unconnected
-socket (for one-to-many style sockets only future associations are
-effected by the change). With one-to-one style sockets, this option
-is inherited by sockets derived from a listener socket.
+Default: sinit_num_ostreams=10, sinit_max_instreams=10,
+sinit_max_attempts=sysctl_net.sctp.max_init_retransmits,
+sinit_max_init_timeo=sysctl_net.sctp.rto_max.
.TP
.B SCTP_NODELAY
Turn on/off any Nagle-like algorithm. This means that packets are generally
-sent as soon as possible and no unnecessary delays are introduced, at the cost
-of more packets in the network. Expects an integer boolean flag.
+sent as soon as possible and no unnecessary delays are introduced, at the
+cost of more packets in the network.
+
+The parameter type is int boolean, for reading and writing.
+
+Default: 0.
.TP
.B SCTP_AUTOCLOSE
-This socket option is applicable to the one-to-many style socket
-only. When set it will cause associations that are idle for more than
-the specified number of seconds to automatically close. An
-association being idle is defined an association that has NOT sent or
-received user data. The special value of 0 indicates that no
-automatic close of any associations should be performed. The option
-expects an integer defining the number of seconds of idle time before
-an association is closed.
+This socket option is applicable to the one-to-many style socket only.
+When set it will cause associations that are idle for more than the
+specified number of seconds to automatically close. An association
+being idle is defined an association that has NOT sent or received
+user data within a period.
+
+The parameter type is int(seconds), for reading and writing. 0 indicates
+that no automatic close of any associations should be performed.
+
+Default: sysctl_net.sctp.max_autoclose.
.TP
.B SCTP_SET_PEER_PRIMARY_ADDR
Requests that the peer mark the enclosed address as the association
primary. The enclosed address must be one of the association's
-locally bound addresses. The structure sctp_setpeerprim defined in
-/usr/include/netinet/sctp.h is used to make a set peer primary request.
+locally bound addresses.
+
+The parameter type is struct sctp_setpeerprim, for writing only.
+sspp_assoc_id is a specified assoc_id.
+
+Default: the 1st local address added.
+Require: SCTP_ASCONF_SUPPORTED.
.TP
.B SCTP_PRIMARY_ADDR
Requests that the local SCTP stack use the enclosed peer address as
the association primary. The enclosed address must be one of the
-association peer's addresses. The structure sctp_prim defined in
-/usr/include/netinet/sctp.h is used to make a get/set primary request.
+association peer's addresses.
+
+The parameter type is struct sctp_prim, for writing only. ssp_assoc_id
+is a specified assoc_id.
+
+Default: the 1st peer address added.
+Require: SCTP_ASCONF_SUPPORTED.
.TP
.B SCTP_DISABLE_FRAGMENTS
-This option is a on/off flag and is passed an integer where a non-zero is on
-and a zero is off. If enabled no SCTP message fragmentation will be performed.
-Instead if a message being sent exceeds the current PMTU size, the message will
-NOT be sent and an error will be indicated to the user.
+If enabled no SCTP message fragmentation will be performed. Instead if a
+message being sent exceeds the current PMTU size, the message will NOT
+be sent and an error will be indicated to the user.
+
+The parameter type is int boolean, for reading and writing.
+
+Default: 0.
.TP
.B SCTP_PEER_ADDR_PARAMS
Using this option, applications can enable or disable heartbeats for any peer
address of an association, modify an address's heartbeat interval, force a
heartbeat to be sent immediately, and adjust the address's maximum number of
-retransmissions sent before an address is considered unreachable. The structure
-sctp_paddrparams defined in /usr/include/netinet/sctp.h is used to
-access and modify an address's parameters.
+retransmissions sent before an address is considered unreachable.
+
+The parameter type is struct sctp_paddrparams, for reading and writing.
+spp_address is a specified transport address or 0, spp_assoc_id is
+a specified assoc_id or SCTP_FUTURE_ASSOC.
+
+Default: hbinterval=sysctl_net.sctp.hb_interval,
+pathmaxrxt=sysctl_net.sctp.path_max_retrans,
+pathmtu=dev/route's, sackdelay=sysctl_net.sctp.sack_timeout,
+param_flags=HB_ENABLE|PMTUD_ENABLE|SACKDELAY_ENABLE, flowlabel=0, dscp=0.
.TP
.B SCTP_DEFAULT_SEND_PARAM
Applications that wish to use the sendto() system call may wish to specify
a default set of parameters that would normally be supplied through the
-inclusion of ancillary data. This socket option allows such an application to
-set the default sctp_sndrcvinfo structure. The application that wishes to use
-this socket option simply passes in to this call the sctp_sndrcvinfo structure
-defined in /usr/include/netinet/sctp.h. The input parameters accepted by this
-call include sinfo_stream, sinfo_flags, sinfo_ppid, sinfo_context,
-sinfo_timetolive. The user must set the sinfo_assoc_id field to identify the
-association to affect if the caller is using the one-to-many style.
+inclusion of ancillary data. This option has been obsoleted by
+SCTP_DEFAULT_SNDINFO.
+
+The parameter type is struct sctp_sndrcvinfo. For reading, sinfo_assoc_id is
+a specified assoc_id or SCTP_FUTURE_ASSOC. For writing, sinfo_assoc_id is a
+specified assoc_id or SCTP_{FUTURE|CURRENT|ALL}_ASSOC.
+
+Default: default_stream=0, default_flags=0, default_ppid=0, default_context=0,
+default_timetolive=0.
.TP
.B SCTP_EVENTS
This socket option is used to specify various notifications and ancillary data
-the user wishes to receive. The structure sctp_event_subscribe defined in
-/usr/include/netinet/sctp.h is used to access or modify the events of interest
-to the user.
+the user wishes to receive. This option has been obsoleted by SCTP_EVENT.
+
+The parameter type is struct sctp_event_subscribe, for reading and writing.
+
+Default: 0.
.TP
.B SCTP_I_WANT_MAPPED_V4_ADDR
-This socket option is a boolean flag which turns on or off mapped V4
-addresses. If this option is turned on and the socket is type PF_INET6,
-then IPv4 addresses will be mapped to V6 representation. If this option is
-turned off, then no mapping will be done of V4 addresses and a user will
-receive both PF_INET6 and PF_INET type addresses on the socket.
+This socket option is used to turn on or off mapped V4 addresses. If this
+option is turned on and the socket is type PF_INET6, then IPv4 addresses
+will be mapped to V6 representation. If this option is turned off, then
+no mapping will be done of V4 addresses and a user will receive both
+PF_INET6 and PF_INET type addresses on the socket.
-By default this option is turned on and expects an integer to be passed where
-non-zero turns on the option and zero turns off the option.
+The parameter type is int boolean, for reading and writing.
+
+Default: 1.
.TP
.B SCTP_MAXSEG
This socket option specifies the maximum size to put in any outgoing
@@ -347,30 +400,37 @@ SCTP DATA chunk. If a message is larger than this size it will be
fragmented by SCTP into the specified size. Note that the underlying
SCTP implementation may fragment into smaller sized chunks when the
PMTU of the underlying association is smaller than the value set by
-the user. The option expects an integer.
+the user. 0 indicates the user is NOT limiting fragmentation and only
+the PMTU will effect SCTP's choice of DATA chunk size.
+
+The parameter type is struct sctp_assoc_value, for reading and writing.
+assoc_id is a specified assoc_id or SCTP_FUTURE_ASSOC.
-The default value for this option is 0 which indicates the user is
-NOT limiting fragmentation and only the PMTU will effect SCTP's
-choice of DATA chunk size.
+Default: 0(no limit).
.TP
.B SCTP_STATUS
Applications can retrieve current status information about an association,
including association state, peer receiver window size, number of unacked
-data chunks, and number of data chunks pending receipt. This information is
-read-only. The structure sctp_status defined in /usr/include/netinet/sctp.h
-is used to access this information.
+data chunks, and number of data chunks pending receipt.
+
+The parameter type is struct sctp_status, for reading only. sstat_assoc_id
+is a specified assoc_id.
.TP
.B SCTP_GET_PEER_ADDR_INFO
-Applications can retrieve information about a specific peer address
-of an association, including its reachability state, congestion window,
-and retransmission timer values. This information is read-only. The structure
-sctp_paddrinfo defined in /usr/include/netinet/sctp.h is used to access this
-information.
+Applications can retrieve information about a specific peer address of
+an association, including its reachability state, congestion window,
+and retransmission timer values.
+
+The parameter type is struct sctp_paddrinfo, for reading only. spinfo_address
+is a specified transport address, sas_assoc_id is a specified assoc_id
+or SCTP_FUTURE_ASSOC.
.TP
.B SCTP_GET_ASSOC_STATS
Applications can retrieve current statistics about an association, including
-SACKs sent and received, SCTP packets sent and received. The complete list can
-be found in /usr/include/netinet/sctp.h in struct sctp_assoc_stats.
+SACKs sent and received, SCTP packets sent and received.
+
+The parameter type is struct sctp_assoc_stats, for reading only.
+sas_assoc_id is a specified assoc_id.
.SH AUTHORS
Sridhar Samudrala <sri@us.ibm.com>
.SH "SEE ALSO"
--
2.39.1

View File

@ -0,0 +1,53 @@
From 90ef63cd633388b0b0487fee11885f4d2a6bcc8f Mon Sep 17 00:00:00 2001
From: Xin Long <lucien.xin@gmail.com>
Date: Wed, 22 Feb 2023 20:24:59 -0500
Subject: [PATCH 2/6] man: update for DESCRIPTION and SYSCTL in sctp.7
Update some out-of-date infomation in DESCRIPTION and SYSCTL
parts in sctp.7.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
man/sctp.7 | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/man/sctp.7 b/man/sctp.7
index 50b551e..c19c2b7 100644
--- a/man/sctp.7
+++ b/man/sctp.7
@@ -18,9 +18,9 @@ sctp \- SCTP protocol.
.B sctp_socket = socket(PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
.fi
.SH DESCRIPTION
-This is an implementation of the SCTP protocol as defined in RFC2960 and
-RFC3309. It is a message oriented, reliable transport protocol with direct
-support for multihoming that runs on top of
+This is an implementation of the SCTP protocol as defined in RFC4960. It is
+a message oriented, reliable transport protocol with direct support for
+multihoming that runs on top of
.BR ip (7),
and supports both v4 and v6 versions.
.PP
@@ -32,8 +32,8 @@ data is achieved by using checksums and sequence numbers. A selective
retransmission mechanism is applied to correct loss or corruption of data.
.PP
This implementation supports a mapping of SCTP into sockets API as defined
-in the draft-ietf-tsvwg-sctpsocket-10.txt(Sockets API extensions for SCTP).
-Two styles of interfaces are supported.
+in the RFC6458(Sockets API extensions for SCTP). Two styles of interfaces
+are supported.
.PP
A
.B one-to-many
@@ -111,7 +111,7 @@ files or with the
interface. In addition, most IP sysctls also apply to SCTP. See
.BR ip (7).
.TP
-Please check kernel documentation for this, at Documentation/networking/ip-sysctl.txt.
+Please check kernel documentation for this, at Documentation/networking/ip-sysctl.rst.
.SH "STATISTICS"
These variables can be accessed by the
.B /proc/net/sctp/*
--
2.39.1

View File

@ -0,0 +1,143 @@
From 166c26dca2a5004f83c5dbc1cb9870667fa8e301 Mon Sep 17 00:00:00 2001
From: Xin Long <lucien.xin@gmail.com>
Date: Wed, 4 Aug 2021 07:29:13 -0400
Subject: [PATCH 1/4] myftp: replace use of deprecated gethostbyname with
getaddrinfo
This patch is to replace use of deprecated gethostbyname with
getaddrinfo in the file src/apps/myftp.c.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
configure.ac | 2 +-
src/apps/myftp.c | 40 ++++++++++++++++++----------------------
2 files changed, 19 insertions(+), 23 deletions(-)
diff --git a/configure.ac b/configure.ac
index 4e2f7b4..8345dab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,7 +75,7 @@ AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_SETVBUF_REVERSED
AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([bzero gethostbyname gettimeofday memmove memset select socket \
+AC_CHECK_FUNCS([bzero getaddrinfo gethostbyname gettimeofday memmove memset select socket \
strchr strerror strtol strtoul])
# Support for stream reset even, added on v4.11, 35ea82d611da
diff --git a/src/apps/myftp.c b/src/apps/myftp.c
index 64fa3f2..473fa03 100644
--- a/src/apps/myftp.c
+++ b/src/apps/myftp.c
@@ -64,11 +64,11 @@ typedef enum { COMMAND_NONE, COMMAND_RECV, COMMAND_SEND } command_t;
#define MAX_NUM_HOST 5
static char *local_host[MAX_NUM_HOST];
static int num_local_host = 0;
-static int local_port = 4444;
+static char *local_port = "4444";
static int buffer_size = BUFSIZE;
static char *remote_host = NULL;
-static int remote_port = 4444;
+static char *remote_port = "4444";
static command_t command = COMMAND_NONE;
static char *filename = NULL;
static int interactive = 0;
@@ -133,7 +133,7 @@ static int parse_arguments(int argc, char *argv[])
break;
case 2: /* local port */
case 'P':
- local_port = atoi(optarg);
+ local_port = optarg;
break;
case 3: /* remote host */
case 'h':
@@ -141,7 +141,7 @@ static int parse_arguments(int argc, char *argv[])
break;
case 4: /* remote port */
case 'p':
- remote_port = atoi(optarg);
+ remote_port = optarg;
break;
case 5:
case 'f':
@@ -236,6 +236,7 @@ emsg(char *prog,char *s)
static int build_endpoint(char *argv0)
{
+ struct addrinfo hints, *rp;
int retval,i;
/* Create the local endpoint. */
@@ -245,22 +246,19 @@ static int build_endpoint(char *argv0)
}
for ( i = 0;i < num_local_host;i++ ) {
- struct hostent *hst;
- struct sockaddr_in laddr;
-
- memset(&laddr, 0, sizeof(laddr));
/* Get the transport address for the local host name. */
fprintf(stderr,"Hostname %d is %s\n",i+1,local_host[i]);
- if ( (hst = gethostbyname(local_host[i])) == NULL ) {
+
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_family = AF_INET;
+ hints.ai_protocol = IPPROTO_SCTP;
+ if (getaddrinfo(local_host[i], local_port, &hints, &rp) != 0) {
fprintf(stderr, "%s: bad hostname: %s\n", argv0, local_host[i]);
exit(1);
}
- memcpy(&laddr.sin_addr, hst->h_addr_list[0],sizeof(laddr.sin_addr));
- laddr.sin_port = htons(local_port);
- laddr.sin_family = AF_INET;
/* Bind this socket to the test port. */
- if ( bind(retval, (struct sockaddr *)&laddr, sizeof(laddr)) ) {
+ if (bind(retval, rp->ai_addr, rp->ai_addrlen)) {
emsg(argv0,"bind");
exit(-1);
}
@@ -339,21 +337,19 @@ command_send(char *argv0, int sk)
{
struct msghdr outmsg;
struct iovec iov;
- struct hostent *hst;
- struct sockaddr_in remote_addr;
+ struct addrinfo hints, *rp;
int fd;
int msglen;
int ct;
/* Set up the destination. */
- hst = gethostbyname(remote_host);
- if (hst == NULL || hst->h_length < 1) {
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_family = AF_INET;
+ hints.ai_protocol = IPPROTO_SCTP;
+ if (getaddrinfo(remote_host, remote_port, &hints, &rp) != 0) {
fprintf(stderr, "%s: bad hostname: %s\n", argv0, remote_host);
exit(1);
}
- memcpy(&remote_addr.sin_addr, hst->h_addr_list[0], sizeof(remote_addr.sin_addr));
- remote_addr.sin_port = htons(remote_port);
- remote_addr.sin_family = AF_INET;
/* Initialize the message struct we use to pass messages to
* the remote socket.
@@ -364,8 +360,8 @@ command_send(char *argv0, int sk)
outmsg.msg_iovlen = 1;
outmsg.msg_control = NULL;
outmsg.msg_controllen = 0;
- outmsg.msg_name = &remote_addr;
- outmsg.msg_namelen = sizeof(remote_addr);
+ outmsg.msg_name = rp->ai_addr;
+ outmsg.msg_namelen = rp->ai_addrlen;
/* open the file */
if ( filename == NULL ) fd = 0;
--
2.27.0

View File

@ -0,0 +1,401 @@
From e44ac51d213c193c894747fef6d61f521d0a7804 Mon Sep 17 00:00:00 2001
From: Xin Long <lucien.xin@gmail.com>
Date: Wed, 4 Aug 2021 07:29:16 -0400
Subject: [PATCH 4/4] sctp_darn: replace use of deprecated gethostbyname with
getaddrinfo
This patch is to replace use of deprecated gethostbyname with
getaddrinfo in the file src/apps/sctp_darn.c.
Note that different from sctp_test, sctp_darn prefers v4 address
to v6 address when getting addrinfo from hostname. To keep the
compatibility, we don't change it.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
configure.ac | 2 +-
src/apps/sctp_darn.c | 246 +++++++++++++------------------------------
2 files changed, 72 insertions(+), 176 deletions(-)
diff --git a/configure.ac b/configure.ac
index 8345dab..28132bf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,7 +75,7 @@ AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_SETVBUF_REVERSED
AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([bzero getaddrinfo gethostbyname gettimeofday memmove memset select socket \
+AC_CHECK_FUNCS([bzero getaddrinfo gettimeofday memmove memset select socket \
strchr strerror strtol strtoul])
# Support for stream reset even, added on v4.11, 35ea82d611da
diff --git a/src/apps/sctp_darn.c b/src/apps/sctp_darn.c
index bcfb822..133c1c6 100644
--- a/src/apps/sctp_darn.c
+++ b/src/apps/sctp_darn.c
@@ -126,7 +126,6 @@ int if_index = 0;
sockaddr_storage_t remote_addr;
sa_family_t ra_family; /* What family is remote_addr? */
int ra_len = 0; /* How long is remote_addr? */
-void *ra_raw; /* This is the addr part of remote_addr. */
int new_connection = 1;
enum inter_cmd_num {
@@ -491,49 +490,29 @@ int
build_endpoint(char *argv0, int portnum)
{
int retval;
- struct hostent *hst;
+ struct addrinfo hints, *rp;
sockaddr_storage_t local_addr;
- sa_family_t la_family; /* What family is local_addr? */
- int la_len; /* How long is local_addr? */
- void *la_raw; /* This is the addr part of local_addr. */
int error;
struct sctp_event_subscribe subscribe;
/* Get the transport address for the local host name. */
- hst = gethostbyname(local_host);
- if (hst == NULL) {
- hst = gethostbyname2(local_host, AF_INET6);
- }
-
- if (hst == NULL || hst->h_length < 1) {
- fprintf(stderr, "%s: bad hostname: %s\n", argv0, local_host);
- exit(1);
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_family = AF_INET;
+ hints.ai_protocol = IPPROTO_SCTP;
+ if (getaddrinfo(local_host, NULL, &hints, &rp) != 0) {
+ hints.ai_family = AF_INET6;
+ if (getaddrinfo(local_host, NULL, &hints, &rp) != 0) {
+ fprintf(stderr, "%s: bad hostname: %s\n", argv0, local_host);
+ exit(1);
+ }
}
-
- la_family = hst->h_addrtype;
- switch (la_family) {
- case AF_INET:
- la_len = sizeof(local_addr.v4);
- la_raw = &local_addr.v4.sin_addr;
- local_addr.v4.sin_port = htons(portnum);
- local_addr.v4.sin_family = AF_INET;
- break;
- case AF_INET6:
- la_len = sizeof(local_addr.v6);
- la_raw = &local_addr.v6.sin6_addr;
- local_addr.v6.sin6_port = htons(portnum);
- local_addr.v6.sin6_family = AF_INET6;
+ memcpy(&local_addr, rp->ai_addr, rp->ai_addrlen);
+ local_addr.v4.sin_port = htons(portnum); /* equal to v6.sin6_port */
+ if (rp->ai_family == AF_INET6)
local_addr.v6.sin6_scope_id = if_index;
- break;
- default:
- fprintf(stderr, "Invalid address type.\n");
- exit(1);
- break;
- }
- memcpy(la_raw, hst->h_addr_list[0], hst->h_length);
/* Create the local endpoint. */
- retval = socket(la_family, socket_type, IPPROTO_SCTP);
+ retval = socket(rp->ai_family, socket_type, IPPROTO_SCTP);
if (retval < 0) {
fprintf(stderr, "%s: failed to create socket: %s.\n",
argv0, strerror(errno));
@@ -553,7 +532,7 @@ build_endpoint(char *argv0, int portnum)
}
/* Bind this socket to the test port. */
- error = bind(retval, &local_addr.sa, la_len);
+ error = bind(retval, &local_addr.sa, rp->ai_addrlen);
if (error != 0) {
fprintf(stderr, "%s: can not bind to %s:%d: %s.\n",
argv0, local_host, portnum,
@@ -778,7 +757,7 @@ command_send(char *argv0, int *skp)
struct iovec iov;
int done = 0;
char message[REALLY_BIG];
- struct hostent *hst;
+ struct addrinfo hints, *rp;
int c;
struct sockaddr *addrs;
int msglen;
@@ -787,38 +766,21 @@ command_send(char *argv0, int *skp)
/* Set up the destination. */
if (remote_host != NULL) {
- hst = gethostbyname(remote_host);
- if (hst == NULL) {
- hst = gethostbyname2(remote_host, AF_INET6);
- }
-
- if (hst == NULL || hst->h_length < 1) {
- fprintf(stderr, "%s: bad hostname: %s\n",
- argv0, remote_host);
- exit(1);
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_family = AF_INET;
+ hints.ai_protocol = IPPROTO_SCTP;
+ if (getaddrinfo(remote_host, NULL, &hints, &rp) != 0) {
+ hints.ai_family = AF_INET6;
+ if (getaddrinfo(remote_host, NULL, &hints, &rp) != 0) {
+ fprintf(stderr, "%s: bad hostname: %s\n", argv0, remote_host);
+ exit(1);
+ }
}
-
- ra_family = hst->h_addrtype;
- switch (ra_family) {
- case AF_INET:
- ra_len = sizeof(remote_addr.v4);
- ra_raw = &remote_addr.v4.sin_addr;
- remote_addr.v4.sin_port = htons(remote_port);
- remote_addr.v4.sin_family = AF_INET;
- break;
- case AF_INET6:
- ra_len = sizeof(remote_addr.v6);
- ra_raw = &remote_addr.v6.sin6_addr;
- remote_addr.v6.sin6_port = htons(remote_port);
- remote_addr.v6.sin6_family = AF_INET6;
+ memcpy(&remote_addr, rp->ai_addr, rp->ai_addrlen);
+ remote_addr.v4.sin_port = htons(remote_port); /* equal to v6.sin6_port */
+ if (rp->ai_family == AF_INET6)
remote_addr.v6.sin6_scope_id = if_index;
- break;
- default:
- fprintf(stderr, "Invalid address type.\n");
- exit(1);
- break;
- }
- memcpy(ra_raw, hst->h_addr_list[0], hst->h_length);
+ ra_len = rp->ai_addrlen;
}
/* Initialize the global value for interactive mode functions. */
@@ -1041,7 +1003,7 @@ command_poll(char *argv0)
fd_set *xbitsp = NULL;
struct msghdr outmsg;
- struct hostent *hst;
+ struct addrinfo hints, *rp;
int msglen;
int temp_fd, temp_set;
@@ -1050,38 +1012,20 @@ command_poll(char *argv0)
/* If a remote host is specified, initialize the destination. */
if (remote_host) {
/* Set up the destination. */
- hst = gethostbyname(remote_host);
- if (hst == NULL) {
- hst = gethostbyname2(remote_host, AF_INET6);
- }
-
- if (hst == NULL || hst->h_length < 1) {
- fprintf(stderr, "%s: bad hostname: %s\n",
- argv0, remote_host);
- exit(1);
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_family = AF_INET;
+ hints.ai_protocol = IPPROTO_SCTP;
+ if (getaddrinfo(remote_host, NULL, &hints, &rp) != 0) {
+ hints.ai_family = AF_INET6;
+ if (getaddrinfo(remote_host, NULL, &hints, &rp) != 0) {
+ fprintf(stderr, "%s: bad hostname: %s\n", argv0, remote_host);
+ exit(1);
+ }
}
-
- ra_family = hst->h_addrtype;
- switch (ra_family) {
- case AF_INET:
- ra_len = sizeof(remote_addr.v4);
- ra_raw = &remote_addr.v4.sin_addr;
- remote_addr.v4.sin_port = htons(remote_port);
- remote_addr.v4.sin_family = AF_INET;
- break;
- case AF_INET6:
- ra_len = sizeof(remote_addr.v6);
- ra_raw = &remote_addr.v6.sin6_addr;
- remote_addr.v6.sin6_port = htons(remote_port);
- remote_addr.v6.sin6_family = AF_INET6;
+ memcpy(&remote_addr, rp->ai_addr, rp->ai_addrlen);
+ remote_addr.v4.sin_port = htons(remote_port); /* equal to v6.sin6_port */
+ if (rp->ai_family == AF_INET6)
remote_addr.v6.sin6_scope_id = if_index;
- break;
- default:
- fprintf(stderr, "Invalid address type.\n");
- exit(1);
- break;
- }
- memcpy(ra_raw, hst->h_addr_list[0], hst->h_length);
/* Initialize the message struct we use to pass messages to
* the remote socket.
@@ -1091,7 +1035,7 @@ command_poll(char *argv0)
outmsg.msg_control = NULL;
outmsg.msg_controllen = 0;
outmsg.msg_name = &remote_addr;
- outmsg.msg_namelen = ra_len;
+ outmsg.msg_namelen = rp->ai_addrlen;
outmsg.msg_flags = 0;
}
@@ -1406,14 +1350,11 @@ struct sockaddr *
append_addr(const char *parm, struct sockaddr *addrs, int *ret_count)
{
struct sockaddr *new_addrs = NULL;
+ struct addrinfo hints, *res, *rp;
void *aptr;
struct sockaddr *sa_addr;
struct sockaddr_in *b4ap;
struct sockaddr_in6 *b6ap;
- struct hostent *hst4 = NULL;
- struct hostent *hst6 = NULL;
- int i4 = 0;
- int i6 = 0;
int j;
int orig_count = *ret_count;
int count = orig_count;
@@ -1421,28 +1362,17 @@ append_addr(const char *parm, struct sockaddr *addrs, int *ret_count)
if (!parm)
return NULL;
- /* Get the entries for this host. */
- hst4 = gethostbyname(parm);
- hst6 = gethostbyname2(parm, AF_INET6);
- if ((NULL == hst4 || hst4->h_length < 1)
- && (NULL == hst6 || hst6->h_length < 1)) {
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_protocol = IPPROTO_SCTP;
+ if (getaddrinfo(parm, NULL, &hints, &res) != 0) {
fprintf(stderr, "bad hostname: %s\n", parm);
goto finally;
}
-
- /* Figure out the number of addresses. */
- if (NULL != hst4) {
- for (i4 = 0; NULL != hst4->h_addr_list[i4]; ++i4) {
- count++;
- }
- }
- if (NULL != hst6) {
- for (i6 = 0; NULL != hst6->h_addr_list[i6]; ++i6) {
- count++;
- }
- }
+ for (rp = res; rp != NULL; rp = rp->ai_next)
+ count++;
/* Expand memory for the new addresses. Assume all the addresses
* are v6 addresses.
@@ -1473,31 +1403,14 @@ append_addr(const char *parm, struct sockaddr *addrs, int *ret_count)
}
/* Put the new addresses away. */
- if (NULL != hst4) {
- for (j = 0; j < i4; ++j) {
- b4ap = (struct sockaddr_in *)aptr;
- memset(b4ap, 0x00, sizeof(*b4ap));
- b4ap->sin_family = AF_INET;
- b4ap->sin_port = htons(local_port);
- bcopy(hst4->h_addr_list[j], &b4ap->sin_addr,
- hst4->h_length);
-
- aptr += sizeof(struct sockaddr_in);
- } /* for (loop through the new v4 addresses) */
- }
-
- if (NULL != hst6) {
- for (j = 0; j < i6; ++j) {
- b6ap = (struct sockaddr_in6 *)aptr;
- memset(b6ap, 0x00, sizeof(*b6ap));
- b6ap->sin6_family = AF_INET6;
- b6ap->sin6_port = htons(local_port);
+ for (rp = res; rp != NULL; rp = rp->ai_next) {
+ b4ap = (struct sockaddr_in *)aptr;
+ b6ap = (struct sockaddr_in6 *)aptr;
+ bcopy(rp->ai_addr, aptr, rp->ai_addrlen);
+ b4ap->sin_port = htons(local_port); /* equal to b6ap.v6.sin6_port */
+ if (rp->ai_family == AF_INET6)
b6ap->sin6_scope_id = if_index;
- bcopy(hst6->h_addr_list[j], &b6ap->sin6_addr,
- hst6->h_length);
-
- aptr += sizeof(struct sockaddr_in6);
- } /* for (loop through the new v6 addresses) */
+ aptr += rp->ai_addrlen;
}
finally:
@@ -2123,7 +2036,7 @@ shutdown_func(char *argv0, int *skp, int shutdown_type)
struct cmsghdr *cmsg;
int error=0, bytes_sent;
struct sctp_sndrcvinfo *sinfo;
- struct hostent *hst;
+ struct addrinfo hints, *rp;
char *sd_type;
int sk = *skp;
@@ -2142,37 +2055,20 @@ shutdown_func(char *argv0, int *skp, int shutdown_type)
if (socket_type == SOCK_SEQPACKET) {
/* Set up the destination. */
if (remote_host) {
- hst = gethostbyname(remote_host);
- if (hst == NULL) {
- hst = gethostbyname2(remote_host, AF_INET6);
- }
-
- if (hst == NULL || hst->h_length < 1) {
- fprintf(stderr, "%s: bad hostname: %s\n",
- argv0, remote_host);
- exit(1);
- }
-
- ra_family = hst->h_addrtype;
- switch (ra_family) {
- case AF_INET:
- ra_len = sizeof(remote_addr.v4);
- ra_raw = &remote_addr.v4.sin_addr;
- remote_addr.v4.sin_port = htons(remote_port);
- remote_addr.v4.sin_family = AF_INET;
- break;
- case AF_INET6:
- ra_len = sizeof(remote_addr.v6);
- ra_raw = &remote_addr.v6.sin6_addr;
- remote_addr.v6.sin6_port = htons(remote_port);
- remote_addr.v6.sin6_family = AF_INET6;
- break;
- default:
- fprintf(stderr, "Invalid address type.\n");
- exit(1);
- break;
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_family = AF_INET;
+ hints.ai_protocol = IPPROTO_SCTP;
+ if (getaddrinfo(remote_host, NULL, &hints, &rp) != 0) {
+ hints.ai_family = AF_INET6;
+ if (getaddrinfo(remote_host, NULL, &hints, &rp) != 0) {
+ fprintf(stderr, "%s: bad hostname: %s\n",
+ argv0, remote_host);
+ exit(1);
+ }
}
- memcpy(ra_raw, hst->h_addr_list[0], hst->h_length);
+ memcpy(&remote_addr, rp->ai_addr, rp->ai_addrlen);
+ remote_addr.v4.sin_port = htons(remote_port); /* equal to v6.sin6_port */
+ ra_len = rp->ai_addrlen;
}
/* Initialize the message struct we use to pass messages to
--
2.27.0

View File

@ -0,0 +1,31 @@
From 97970af0e414f480afca2914279f51616ff688bb Mon Sep 17 00:00:00 2001
From: Xin Long <lucien.xin@gmail.com>
Date: Wed, 24 Nov 2021 10:55:24 -0500
Subject: [PATCH] sctp_test: check strdup return in append_addr
strdup() may return NULL in append_addr(), and we should do the
check for its return value before operating it.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
src/apps/sctp_test.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/apps/sctp_test.c b/src/apps/sctp_test.c
index e382804..59fd4ad 100644
--- a/src/apps/sctp_test.c
+++ b/src/apps/sctp_test.c
@@ -499,6 +499,9 @@ append_addr(const char *parm, struct sockaddr *addrs, int *ret_count)
char *ifname;
int ifindex = 0;
+ if (!ipaddr)
+ return NULL;
+
/* check the interface. */
ifname = strchr(ipaddr,'%');
if (ifname) {
--
2.39.1

View File

@ -0,0 +1,116 @@
From ecdb9294c5dce938ef7c488404be65d23552fb18 Mon Sep 17 00:00:00 2001
From: Xin Long <lucien.xin@gmail.com>
Date: Wed, 4 Aug 2021 07:29:15 -0400
Subject: [PATCH 3/4] sctp_test: replace use of deprecated gethostbyname with
getaddrinfo
This patch is to replace use of deprecated gethostbyname with
getaddrinfo in the file src/apps/sctp_test.c.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
src/apps/sctp_test.c | 63 +++++++++++---------------------------------
1 file changed, 16 insertions(+), 47 deletions(-)
diff --git a/src/apps/sctp_test.c b/src/apps/sctp_test.c
index cd7654b..e382804 100644
--- a/src/apps/sctp_test.c
+++ b/src/apps/sctp_test.c
@@ -487,14 +487,11 @@ struct sockaddr *
append_addr(const char *parm, struct sockaddr *addrs, int *ret_count)
{
struct sockaddr *new_addrs = NULL;
+ struct addrinfo hints, *res, *rp;
void *aptr;
struct sockaddr *sa_addr;
struct sockaddr_in *b4ap;
struct sockaddr_in6 *b6ap;
- struct hostent *hst4 = NULL;
- struct hostent *hst6 = NULL;
- int i4 = 0;
- int i6 = 0;
int j;
int orig_count = *ret_count;
int count = orig_count;
@@ -514,27 +511,16 @@ append_addr(const char *parm, struct sockaddr *addrs, int *ret_count)
}
}
- /* Get the entries for this host. */
- hst4 = gethostbyname(ipaddr);
- hst6 = gethostbyname2(ipaddr, AF_INET6);
-
- if ((NULL == hst4 || hst4->h_length < 1)
- && (NULL == hst6 || hst6->h_length < 1)) {
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_protocol = IPPROTO_SCTP;
+ if (getaddrinfo(ipaddr, NULL, &hints, &res) != 0) {
fprintf(stderr, "bad hostname: %s\n", ipaddr);
goto finally;
}
- /* Figure out the number of addresses. */
- if (NULL != hst4) {
- for (i4 = 0; NULL != hst4->h_addr_list[i4]; ++i4) {
- count++;
- }
- }
- if (NULL != hst6) {
- for (i6 = 0; NULL != hst6->h_addr_list[i6]; ++i6) {
- count++;
- }
- }
+ for (rp = res; rp != NULL; rp = rp->ai_next)
+ count++;
/* Expand memory for the new addresses. Assume all the addresses
* are v6 addresses.
@@ -565,34 +551,17 @@ append_addr(const char *parm, struct sockaddr *addrs, int *ret_count)
}
/* Put the new addresses away. */
- if (NULL != hst4) {
- for (j = 0; j < i4; ++j) {
- b4ap = (struct sockaddr_in *)aptr;
- memset(b4ap, 0x00, sizeof(*b4ap));
- b4ap->sin_family = AF_INET;
- b4ap->sin_port = htons(local_port);
- bcopy(hst4->h_addr_list[j], &b4ap->sin_addr,
- hst4->h_length);
-
- aptr += sizeof(struct sockaddr_in);
- } /* for (loop through the new v4 addresses) */
- }
-
- if (NULL != hst6) {
- for (j = 0; j < i6; ++j) {
- b6ap = (struct sockaddr_in6 *)aptr;
- memset(b6ap, 0x00, sizeof(*b6ap));
- b6ap->sin6_family = AF_INET6;
- b6ap->sin6_port = htons(local_port);
+ for (rp = res; rp != NULL; rp = rp->ai_next) {
+ b4ap = (struct sockaddr_in *)aptr;
+ b6ap = (struct sockaddr_in6 *)aptr;
+ bcopy(rp->ai_addr, aptr, rp->ai_addrlen);
+ b4ap->sin_port = htons(local_port); /* equal to b6ap.v6.sin6_port */
+ if (rp->ai_family == AF_INET6) {
b6ap->sin6_scope_id = if_index;
- bcopy(hst6->h_addr_list[j], &b6ap->sin6_addr,
- hst6->h_length);
- if (!ifindex) {
+ if (!ifindex)
b6ap->sin6_scope_id = ifindex;
- }
-
- aptr += sizeof(struct sockaddr_in6);
- } /* for (loop through the new v6 addresses) */
+ }
+ aptr += rp->ai_addrlen;
}
finally:
--
2.27.0

View File

@ -0,0 +1,156 @@
From 469cf426bc292b6d23770ce930577c1997654229 Mon Sep 17 00:00:00 2001
From: Xin Long <lucien.xin@gmail.com>
Date: Wed, 4 Aug 2021 07:29:14 -0400
Subject: [PATCH 2/4] sctp_xconnect: replace use of deprecated gethostbyname
with getaddrinfo
This patch is to replace use of deprecated gethostbyname with
getaddrinfo in the file src/apps/sctp_xconnect.c.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
src/apps/sctp_xconnect.c | 72 +++++++++++++++++-----------------------
1 file changed, 31 insertions(+), 41 deletions(-)
diff --git a/src/apps/sctp_xconnect.c b/src/apps/sctp_xconnect.c
index 6759c0e..5cd1049 100644
--- a/src/apps/sctp_xconnect.c
+++ b/src/apps/sctp_xconnect.c
@@ -63,13 +63,13 @@ int TST_CNT = 0;
int mode = NOT_DEFINED;
-int assoc_num,
- remote_port,
- local_port;
+int assoc_num;
int active = 0;
-char *local_host = NULL;
-char *remote_host = NULL;
+char *local_host;
+char *remote_host;
+char *local_port;
+char *remote_port;
sockaddr_storage_t client_loop,
server_loop;
struct hostent *hst;
@@ -102,6 +102,7 @@ void usage(char *argv0)
/* Parse command line options */
void parse_arguments(int argc, char*argv[]) {
+ struct addrinfo hints, *rp;
int c;
while ((c = getopt(argc, argv, ":H:P:ach:ln:p:")) >= 0) {
@@ -110,7 +111,7 @@ void parse_arguments(int argc, char*argv[]) {
local_host = optarg;
break;
case 'P':
- local_port = atoi(optarg);
+ local_port = optarg;
break;
case 'c':
if (mode == NOT_DEFINED)
@@ -138,7 +139,7 @@ void parse_arguments(int argc, char*argv[]) {
assoc_num = atoi(optarg);
break;
case 'p':
- remote_port = atoi(optarg);
+ remote_port = optarg;
break;
default:
usage(argv[0]);
@@ -146,6 +147,9 @@ void parse_arguments(int argc, char*argv[]) {
}
} /* while() */
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_family = AF_INET;
+ hints.ai_protocol = IPPROTO_SCTP;
if (mode == CLIENT) {
if (assoc_num) {
if (assoc_num > MAXCLIENTNUM) {
@@ -160,13 +164,13 @@ void parse_arguments(int argc, char*argv[]) {
assoc_num = 1;
if (remote_host && remote_port) {
- hst = gethostbyname(remote_host);
-
- memcpy(&server_loop.v4.sin_addr, hst->h_addr_list[0],
- sizeof(server_loop.v4.sin_addr));
-
- server_loop.v4.sin_family = AF_INET;
-server_loop.v4.sin_port = htons(remote_port);
+ if (getaddrinfo(remote_host, remote_port, &hints, &rp) != 0) {
+ printf("%s: bad remote hostname or port: %s, %s\n",
+ argv[0], remote_host, remote_port);
+ usage(argv[0]);
+ exit(0);
+ }
+ memcpy(&server_loop, rp->ai_addr, rp->ai_addrlen);
} else {
printf("Remote host and remote port must be defined "
"in client mode\n");
@@ -174,20 +178,12 @@ server_loop.v4.sin_port = htons(remote_port);
exit(0);
}
- if (local_host) {
- hst = gethostbyname(local_host);
-
- memcpy(&client_loop.v4.sin_addr, hst->h_addr_list[0],
- sizeof(client_loop.v4.sin_addr));
- } else
- client_loop.v4.sin_addr.s_addr = INADDR_ANY;
-
- if (local_port)
- client_loop.v4.sin_port = htons(local_port);
- else
- client_loop.v4.sin_port = 0;
-
- client_loop.v4.sin_family = AF_INET;
+ if (getaddrinfo(local_host, local_port, &hints, &rp) != 0) {
+ printf("%s: bad local hostname or port: %s, %s\n",
+ argv[0], local_host, local_port);
+ exit(0);
+ }
+ memcpy(&client_loop, rp->ai_addr, rp->ai_addrlen);
} else if (mode == SERVER) {
if (active) {
printf("This option if for client use only");
@@ -201,23 +197,17 @@ server_loop.v4.sin_port = htons(remote_port);
exit(0);
}
- if (local_host) {
- hst = gethostbyname(local_host);
-
- memcpy(&server_loop.v4.sin_addr, hst->h_addr_list[0],
- sizeof(server_loop.v4.sin_addr));
- } else
- server_loop.v4.sin_addr.s_addr = INADDR_ANY;
-
- if (local_port)
- server_loop.v4.sin_port = htons(local_port);
- else {
+ if (!local_port) {
printf("Specify a local port in server mode.\n");
usage(argv[0]);
exit(0);
}
-
- server_loop.v4.sin_family = AF_INET;
+ if (getaddrinfo(local_host, local_port, &hints, &rp) != 0) {
+ printf("%s: bad local hostname or port: %s, %s\n",
+ argv[0], local_host, local_port);
+ exit(0);
+ }
+ memcpy(&server_loop, rp->ai_addr, rp->ai_addrlen);
} else {
printf("Must assisgn a client or server mode.\n");
usage(argv[0]);
--
2.27.0

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (lksctp-tools-1.0.19.tar.gz) = d392843afa6fcf57e4dd1966f1c7de06ff7258f7da89e4a9bb62586e11bd0b851fb720ddc9532a082bbad088e1cdb18f177c49053b7863360ae29ccfc25d8ebf

37
tests/tests.yml Normal file
View File

@ -0,0 +1,37 @@
# Tests for Lksctp-tools
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-source
- role: standard-test-basic
required_packages:
- libtool
- make
- gcc
tests:
- install-kernel-modules:
run: dnf install -y kernel-modules-extra
- build-test:
dir: ./source
run: modprobe sctp && ./bootstrap && ./configure && make
- unit-v4test:
dir: ./source/src/func_tests
run: make v4test
- unit-v6test:
dir: ./source/src/func_tests
run: make v6test
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
required_packages:
- lksctp-tools
- policycoreutils-python-utils
repositories:
- repo: "https://src.fedoraproject.org/tests/selinux.git"
dest: "selinux"
fmf_filter: "path: /policycoreutils/sctp_test"