pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/34084 )


Change subject: stream_srv: Log SCTP REMOTE_ERROR events
......................................................................

stream_srv: Log SCTP REMOTE_ERROR events

The event was enabled but was not being logged.

Change-Id: I49f5a648fd474e320101424fb6873a37442339bf
---
M include/osmocom/netif/sctp.h
M src/sctp.c
M src/stream_srv.c
3 files changed, 54 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/84/34084/1

diff --git a/include/osmocom/netif/sctp.h b/include/osmocom/netif/sctp.h
index f0c52cf..bb8acda 100644
--- a/include/osmocom/netif/sctp.h
+++ b/include/osmocom/netif/sctp.h
@@ -27,3 +27,24 @@
 extern const struct value_string osmo_sctp_sn_error_strs[];
 static inline const char *osmo_sctp_sn_error_str(enum sctp_sn_error val)
 { return get_value_string(osmo_sctp_sn_error_strs, val); }
+
+enum osmo_sctp_op_error {
+       OSMO_SCTP_OP_ERR_INVALID_STREAM_ID =  1,
+       OSMO_SCTP_OP_ERR_MISS_MAND_PARAM =  2,
+       OSMO_SCTP_OP_ERR_STALE_COOKIE =  3,
+       OSMO_SCTP_OP_ERR_NO_RESOURCES =  4,
+       OSMO_SCTP_OP_ERR_UNRESOLV_ADDR =  5,
+       OSMO_SCTP_OP_ERR_UNKN_CHUNK_TYPE =  6,
+       OSMO_SCTP_OP_ERR_INVALID_MAND_PARAM =  7,
+       OSMO_SCTP_OP_ERR_UNKN_PARAM =  8,
+       OSMO_SCTP_OP_ERR_NO_USER_DATA =  9,
+       OSMO_SCTP_OP_ERR_COOKIE_RX_WHILE_SHUTDOWN = 10,
+       OSMO_SCTP_OP_ERR_RESTART_ASSC_NEW_ADDR = 11,
+       OSMO_SCTP_OP_ERR_UNER_INITED_ABORT = 12,
+       OSMO_SCTP_OP_ERR_PROTO_VERSION = 13,
+};
+
+
+extern const struct value_string osmo_sctp_op_error_strs[];
+static inline const char *osmo_sctp_op_error_str(enum osmo_sctp_op_error val)
+{ return get_value_string(osmo_sctp_op_error_strs, val); }
diff --git a/src/sctp.c b/src/sctp.c
index c1b57db..7f4f54b 100644
--- a/src/sctp.c
+++ b/src/sctp.c
@@ -51,3 +51,21 @@
        { SCTP_PEER_FAULTY,             "PEER_FAULTY" },
        { 0, NULL }
 };
+
+/* rfc4960 section 3.3.10 "Operation Error", in host byte order */
+const struct value_string osmo_sctp_op_error_strs[] = {
+       { OSMO_SCTP_OP_ERR_INVALID_STREAM_ID,   "Invalid Stream Identifier" },
+       { OSMO_SCTP_OP_ERR_MISS_MAND_PARAM,     "Missing Mandatory Parameter" },
+       { OSMO_SCTP_OP_ERR_STALE_COOKIE,        "Stale Cookie Error" },
+       { OSMO_SCTP_OP_ERR_NO_RESOURCES,        "Out of Resource" },
+       { OSMO_SCTP_OP_ERR_UNRESOLV_ADDR,       "Unresolvable Address" },
+       { OSMO_SCTP_OP_ERR_UNKN_CHUNK_TYPE,     "Unrecognized Chunk Type" },
+       { OSMO_SCTP_OP_ERR_INVALID_MAND_PARAM,  "Invalid Mandatory Parameter" },
+       { OSMO_SCTP_OP_ERR_UNKN_PARAM,          "Unrecognized Parameters" },
+       { OSMO_SCTP_OP_ERR_NO_USER_DATA,        "No User Data" },
+       { OSMO_SCTP_OP_ERR_COOKIE_RX_WHILE_SHUTDOWN,    "Cookie Received While 
Shutting Down" },
+       { OSMO_SCTP_OP_ERR_RESTART_ASSC_NEW_ADDR,       "Restart of an 
Association with New Addresses" },
+       { OSMO_SCTP_OP_ERR_UNER_INITED_ABORT,   "User Initiated Abort" },
+       { OSMO_SCTP_OP_ERR_PROTO_VERSION,       "Protocol Violation" },
+       { 0, NULL }
+};
diff --git a/src/stream_srv.c b/src/stream_srv.c
index 970ea65..9544b9b 100644
--- a/src/stream_srv.c
+++ b/src/stream_srv.c
@@ -891,6 +891,10 @@
                        /* RFC6458 3.1.4: Any attempt to send more data will 
cause sendmsg()
                         * to return with an ESHUTDOWN error. */
                        break;
+               case SCTP_REMOTE_ERROR:
+                       LOGP(DLINP, LOGL_INFO, "===> REMOTE ERROR: %s\n",
+                            
osmo_sctp_op_error_str(ntohs(notif->sn_remote_error.sre_error)));
+                       break;
                }
                return -EAGAIN;
        }

--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/34084
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I49f5a648fd474e320101424fb6873a37442339bf
Gerrit-Change-Number: 34084
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-MessageType: newchange

Reply via email to