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

Ability to restrict service querying to specific network interface. #29

Closed
michaelosthege opened this issue Sep 26, 2018 · 4 comments
Closed

Comments

@michaelosthege
Copy link

michaelosthege commented Sep 26, 2018

Just like the mDNS advertising can be restricted to specific IPAddresses, it would consistent to do the same for queries.

This is a feature request for the ability to restrict both service advertising and service discovery to a set of network interfaces.

Motivation

The situation in my case is a computer that is connected to two networks. I ran into a lot of trouble, because the current implementation attempts to use all network interfaces simultaneously:

  • no exception is raised when the UdpClient can not be created on a particular interface
  • there is no way to restrict activity to a particular interface
  • a firewall configuration can prevent the program from opening a port on some interfaces

Proposed solution

Support for restricting activity to a specific network interface could be implemented via a NetworkInterfaces[] parameter to the constructor of the MulticastService.

@richardschneider
Copy link
Owner

Sorry for the late reply! I am very confused by your issue.

Just like the mDNS advertising can be restricted to specific IPAddresses, it would consistent to do the same for queries.

Not sure about this. How is it restricted to a specific IPAddress?

When the user asks for an mDNS query on a specific network interface, an exception should be raised in such cases.

A query is sent on all network interfaces. There is no way to use a specific interface.

@michaelosthege
Copy link
Author

Friday evening issue..

I was referring to the addresses parameter from ServiceProfile.cs#L46

It seems I was in error about how it works, since as you pointed out, the MulticastService does indeed listen on all network interfaces.

I'll edit my original issue description to better reflect the intent.

@richardschneider
Copy link
Owner

I do not see a need to restrict Service Discovery to a specific interfaces. mDNS is all about zero configuration.

As for advertising, the ServiceProfile can specify which addresses it is listening on.

@michaelosthege
Copy link
Author

Replying to your last comment on #30 ...

@michaelosthege thanks for the update.

As you may guess, I'm a solo developer and don't deal with "corporate firewalls." However, I would expect a firewall to simply not forward the datagram on a restricted interface/port; which should not cause an issue with creating a UdpClient.

Can you open a new issue that shows the actual exception (and stack trace) you are getting?

As always, I'm happy to get a PR.

I'm working on PR #32 right now. When I was trying to debug earlier, I did some things wrong.

The problem now is, that I don't get any exception at all. As I described more detailed in the thread on the PR, there is zero activity on the local network interface without specifying it explicitly.

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

No branches or pull requests

2 participants