Skip to content

fix: add guard to avoid packet sent on shutdown on already dead streams - #2147

Closed
bundasmanu wants to merge 2 commits into
sipwise:masterfrom
bundasmanu:bundasmanu/fix-dtls-bio-closed-socket
Closed

fix: add guard to avoid packet sent on shutdown on already dead streams#2147
bundasmanu wants to merge 2 commits into
sipwise:masterfrom
bundasmanu:bundasmanu/fix-dtls-bio-closed-socket

Conversation

@bundasmanu

Copy link
Copy Markdown
Contributor

This PR is related to the issue: 2146.

The fix results from gdb analysis, and uses a similar approach that was used previously on similar problems like: (linuxmaniac@ceb7996).

I already have tested it, and crashes are not happening anymore.

Comment thread daemon/dtls.c Outdated
struct stream_fd *sfd = d->sfd;
if (!sfd)
return ret;
if (!sfd->socket.family || sfd->socket.fd < 0)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest to change the test for open socket to != -1

Technically I think the test on fd can be removed altogether, as (in theory) we guarantee the socket to be open if family is set

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, if i understood, you mean to do a simple check like this? if (!sfd->socket.family)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be enough, yes

@bundasmanu bundasmanu Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will test, and after i will you give feedback. Thank you.

EDIT: Worked, thank you.

sipwise-jenkins pushed a commit that referenced this pull request Jul 27, 2026
…ead streams

closes #2147
closes #2146

Change-Id: Id94e5ed52dbfe0a8e86b5f90c425edd3832116ea
(cherry picked from commit f99cffb)
sipwise-jenkins pushed a commit that referenced this pull request Jul 27, 2026
…ead streams

closes #2147
closes #2146

Change-Id: Id94e5ed52dbfe0a8e86b5f90c425edd3832116ea
(cherry picked from commit f99cffb)
sipwise-jenkins pushed a commit that referenced this pull request Jul 27, 2026
…ead streams

closes #2147
closes #2146

Change-Id: Id94e5ed52dbfe0a8e86b5f90c425edd3832116ea
(cherry picked from commit f99cffb)
sipwise-jenkins pushed a commit that referenced this pull request Jul 27, 2026
…ead streams

closes #2147
closes #2146

Change-Id: Id94e5ed52dbfe0a8e86b5f90c425edd3832116ea
(cherry picked from commit f99cffb)
sipwise-jenkins pushed a commit that referenced this pull request Jul 27, 2026
…ead streams

closes #2147
closes #2146

Change-Id: Id94e5ed52dbfe0a8e86b5f90c425edd3832116ea
(cherry picked from commit f99cffb)
(cherry picked from commit 77be35b)
sipwise-jenkins pushed a commit that referenced this pull request Jul 27, 2026
…ead streams

closes #2147
closes #2146

Change-Id: Id94e5ed52dbfe0a8e86b5f90c425edd3832116ea
(cherry picked from commit f99cffb)
(cherry picked from commit af1013b)
sipwise-jenkins pushed a commit that referenced this pull request Jul 27, 2026
…ead streams

closes #2147
closes #2146

Change-Id: Id94e5ed52dbfe0a8e86b5f90c425edd3832116ea
(cherry picked from commit f99cffb)
(cherry picked from commit f1fa6f3)
sipwise-jenkins pushed a commit that referenced this pull request Jul 27, 2026
…ead streams

closes #2147
closes #2146

Change-Id: Id94e5ed52dbfe0a8e86b5f90c425edd3832116ea
(cherry picked from commit f99cffb)
(cherry picked from commit a77c60d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants