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

Bug: DNS-SD registration doesn't handle the case where an old registration for netremote is already present #293

Open
abeltrano opened this issue Jun 20, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@abeltrano
Copy link
Contributor

Describe the bug
When a prior invocation of netremote-server exited unexpectedly, the DNS-SD registration may not have been unregistered. In such cases, the next execution of netremote-server will complain that DNS-SD registration failed per below:

Netremote server starting (log level=info)
...
Netremote server started listening on 0.0.0.0:5047
Starting discovery service
Starting systemd-resolved DNS-SD service registration
Failed to register DNS-SD service with systemd-resolved: [org.freedesktop.resolve1.DnssdServiceExists] DNS-SD service 'netremote' exists already
Failed to register new DNS-SD service on dbus

The code ignores this assuming it is fine. In most cases it will be, however, if the new netremote-server execution was bound to a different IP address, then the DNS-SD registration would need to be replaced.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Start netremote-server with no arguments.
  2. Forcibly kill the netremote server process (eg. kill -9 $(pidof netremote-server)).
  3. Start netremote-server with no arguments.

Expected behavior
Any old DNS-SD registration is removed, and replaced with an updated one. No error messages regarding DNS-SD are observed in the log.

Actual behavior
Error messages about failing to register DNS-SD appear, quoting existing registration. DNS-SD registration is not updated.

Screenshots
image

Proposed Fix
ResolvedDnssd::RegisterService should first check if any registration(s) for the supplied serviceName argument exist. If they do, they should be unregistered by calling the ResolvedDnssd::UnregisterService function with the object path of the existing DNS-SD registration.

@abeltrano abeltrano added the bug Something isn't working label Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant