From 759e62f27bd8bb49c97eef10ba31ff980fc4fe7d Mon Sep 17 00:00:00 2001 From: Gabor Szalai Date: Fri, 16 Jul 2021 08:47:41 +0200 Subject: [PATCH] The SO_REUSEADDR added back. (issue #1) It was removed accidentally during update/refactor Signed-off-by: Gabor Szalai --- doc/change.log | 4 ++++ src/SCTPasp_PT.cc | 10 ++++++++-- src/SCTPasp_PT.hh | 1 - src/SCTPasp_PortType.ttcn | 1 - src/SCTPasp_Types.ttcn | 1 - 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/doc/change.log b/doc/change.log index f7fda44..5491954 100644 --- a/doc/change.log +++ b/doc/change.log @@ -7,3 +7,7 @@ === R12A IPv6 support added + +=== R12A + +The SO_REUSEADDR added back. It was removed accidentally during update/refactor diff --git a/src/SCTPasp_PT.cc b/src/SCTPasp_PT.cc index 4a8f9cf..e1b2abc 100644 --- a/src/SCTPasp_PT.cc +++ b/src/SCTPasp_PT.cc @@ -18,8 +18,6 @@ // // File: SCTPasp_PT.cc // Description: SCTPasp test port source -// Rev: -// Prodnr: CNL 113 469 // @@ -1554,10 +1552,18 @@ int SCTPasp__PT_PROVIDER::fill_addr_struct(const char* name, int port, struct so int SCTPasp__PT_PROVIDER::create_socket(int addr_family) { int local_fd; + int enable = 1; log("Creating SCTP socket."); if ((local_fd = socket(addr_family, SOCK_STREAM, IPPROTO_SCTP)) == -1) error("Socket error: cannot create socket! %d %s %d %d",errno, strerror(errno),addr_family,AF_INET); + log("Setting SO_REUSEADDR options."); + if (setsockopt(local_fd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable)) < 0) + { + TTCN_warning("Setsockopt SO_REUSEADDR error! %d %s",errno, strerror(errno)); + errno = 0; + } + log("Setting SCTP socket options (initmsg)."); if (setsockopt(local_fd, IPPROTO_SCTP, SCTP_INITMSG, &initmsg, sizeof(struct sctp_initmsg)) < 0) diff --git a/src/SCTPasp_PT.hh b/src/SCTPasp_PT.hh index 114b0a7..5b88929 100644 --- a/src/SCTPasp_PT.hh +++ b/src/SCTPasp_PT.hh @@ -18,7 +18,6 @@ // // File: SCTPasp_PT.hh // Description: SCTPasp test port header -// Prodnr: CNL 113 469 // diff --git a/src/SCTPasp_PortType.ttcn b/src/SCTPasp_PortType.ttcn index 3338e06..8e3493f 100644 --- a/src/SCTPasp_PortType.ttcn +++ b/src/SCTPasp_PortType.ttcn @@ -18,7 +18,6 @@ // // File: SCTPasp_PortType.ttcn // Description: SCTPasp testport definition file -// Prodnr: CNL 113 469 // module SCTPasp_PortType diff --git a/src/SCTPasp_Types.ttcn b/src/SCTPasp_Types.ttcn index 005edf6..d604158 100644 --- a/src/SCTPasp_Types.ttcn +++ b/src/SCTPasp_Types.ttcn @@ -18,7 +18,6 @@ // // File: SCTPasp_Types.ttcn // Description: SCTP ASP definition file -// Prodnr: CNL 113 469 // -- GitLab