Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve: llmnr: why dns_stream_unref() called in on_llmnr_stream_packet()?? #22266

Closed
yuwata opened this issue Jan 27, 2022 · 0 comments · Fixed by #22274
Closed

resolve: llmnr: why dns_stream_unref() called in on_llmnr_stream_packet()?? #22266

yuwata opened this issue Jan 27, 2022 · 0 comments · Fixed by #22274
Labels
bug 🐛 Programming errors, that need preferential fixing resolve

Comments

@yuwata
Copy link
Member

yuwata commented Jan 27, 2022

LLMNR stream does not have complete callback, that means the stream is unref()ed when dns_stream_complete() is called.

However, unlike the other on_packet callbacks, on_llmnr_stream_packet() unref() the stream.

In on_stream_io(), on_packet is called and then dns_stream_complete() is called. Does this mean the stream is doubly unref()ed?

Also, I cannot understand the comment added by 31f2a5e.

@yuwata yuwata added resolve bug 🐛 Programming errors, that need preferential fixing labels Jan 27, 2022
yuwata added a commit to yuwata/systemd that referenced this issue Jan 28, 2022
Previously, the condition in on_stream_io_impl() never hit, as the
read packet is always taken from the stream in the few lines above.

Instead of the dns_stream_complete() under the condition, the stream
is unref()ed in the on_packet callback for LLMNR stream, unlike the
other on_packet callbacks.

That's quite tricky. Also, potentially, the stream may still have
queued packets to write.

This fix the condition, and drops the unref() in the on_packet callback.

C.f. systemd#22274 (comment).

Closes systemd#22266.
bluca pushed a commit to bluca/systemd that referenced this issue Apr 28, 2022
Previously, the condition in on_stream_io_impl() never hit, as the
read packet is always taken from the stream in the few lines above.

Instead of the dns_stream_complete() under the condition, the stream
is unref()ed in the on_packet callback for LLMNR stream, unlike the
other on_packet callbacks.

That's quite tricky. Also, potentially, the stream may still have
queued packets to write.

This fix the condition, and drops the unref() in the on_packet callback.

C.f. systemd#22274 (comment).

Closes systemd#22266.

(cherry picked from commit a5e2a48)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Programming errors, that need preferential fixing resolve
Development

Successfully merging a pull request may close this issue.

1 participant