fixeria has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-pcap/+/42846?usp=email )

 (

2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted 
one.
 )Change subject: tls: do not treat GNUTLS_E_AGAIN/INTERRUPTED as fatal on read
......................................................................

tls: do not treat GNUTLS_E_AGAIN/INTERRUPTED as fatal on read

osmo_tls_client_bfd_cb() treated any non-positive return from
gnutls_record_recv() as a fatal error and tore down the session.  On a
non-blocking socket gnutls_record_recv() can return GNUTLS_E_AGAIN or
GNUTLS_E_INTERRUPTED (both negative but non-fatal), which would drop
an otherwise healthy TLS session.  Handle them as retryable, mirroring
the existing logic in tls_write().

Change-Id: If2f842b202dd08c07dffe3770c51cf0ce886beee
AI-Assisted: yes (Claude)
---
M src/osmo_tls.c
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved




diff --git a/src/osmo_tls.c b/src/osmo_tls.c
index 8524ee3..f06f50e 100644
--- a/src/osmo_tls.c
+++ b/src/osmo_tls.c
@@ -264,7 +264,11 @@

        if (what & OSMO_FD_READ) {
                int rc = tls_read(sess);
-               if (rc <= 0) {
+               /* A non-blocking read may legitimately return GNUTLS_E_AGAIN or
+                * GNUTLS_E_INTERRUPTED; these are not errors, just retry 
later. */
+               if (rc == GNUTLS_E_INTERRUPTED || rc == GNUTLS_E_AGAIN) {
+                       /* nothing to do, wait for the next read event */
+               } else if (rc <= 0) {
                        sess->error(sess);
                        return rc;
                }

--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/42846?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-Change-Id: If2f842b202dd08c07dffe3770c51cf0ce886beee
Gerrit-Change-Number: 42846
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to