From db7f39ba19e10ec27d05673ab1f1a6a518327af8 Mon Sep 17 00:00:00 2001
From: Robert Schmidt <robert.schmidt@openairinterface.org>
Date: Tue, 24 May 2022 14:47:30 +0200
Subject: [PATCH] Use correct structure in sctp_eNB_accept_associations()

---
 openair3/SCTP/sctp_eNB_task.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c
index 06e606e36b6..df6dde0f997 100644
--- a/openair3/SCTP/sctp_eNB_task.c
+++ b/openair3/SCTP/sctp_eNB_task.c
@@ -859,7 +859,7 @@ sctp_eNB_accept_associations(
     struct sctp_cnx_list_elm_s *sctp_cnx)
 {
     int             client_sd;
-    struct sockaddr saddr;
+    struct sockaddr_in6 saddr;
     socklen_t       saddr_size;
 
     DevAssert(sctp_cnx != NULL);
@@ -868,14 +868,14 @@ sctp_eNB_accept_associations(
 
     /* There is a new client connecting. Accept it...
      */
-    if ((client_sd = accept(sctp_cnx->sd, &saddr, &saddr_size)) < 0) {
+    if ((client_sd = accept(sctp_cnx->sd, (struct sockaddr*)&saddr, &saddr_size)) < 0) {
         SCTP_ERROR("[%d] accept failed: %s:%d\n", sctp_cnx->sd, strerror(errno), errno);
     } else {
         struct sctp_cnx_list_elm_s *new_cnx;
         uint16_t port;
 
         /* This is an ipv6 socket */
-        port = ((struct sockaddr_in6*)&saddr)->sin6_port;
+        port = saddr.sin6_port;
 
         /* Contrary to BSD, client socket does not inherit O_NONBLOCK option */
         if (fcntl(client_sd, F_SETFL, O_NONBLOCK) < 0) {
-- 
GitLab