Skip to content

fix: use a source IP matching the querier's subnet when responding#460

Merged
keepsimple1 merged 2 commits intomainfrom
ks1/src-ip
Apr 18, 2026
Merged

fix: use a source IP matching the querier's subnet when responding#460
keepsimple1 merged 2 commits intomainfrom
ks1/src-ip

Conversation

@keepsimple1
Copy link
Copy Markdown
Owner

This is to fix issue #459 .

@anti-social
Copy link
Copy Markdown
Contributor

We also should send announcements from every interface address. One more problem that even replying from right address we send all the interface addresses so other side should filter them. I believe the library must do the work either on a service side or a discoverer.

Here is my patch (for me it works but obviously there are some corner cases that should be fixed): anti-social@e721f75

@keepsimple1
Copy link
Copy Markdown
Owner Author

We also should send announcements from every interface address.

That's a good point. At the multicast (L2) layer, the listener should receive the announcement packets regardless the source address, but the IP layer might drop them. It's essentially same problem as the response case of this ticket.

One more problem that even replying from right address we send all the interface addresses so other side should filter them.

I'm a bit worried about this. I cannot find a direct link, but I recall there has been some cases the publisher wants to include some address records that's not in the subnet, sometime even include the loopback address.

Here is my patch

I'll take a closer look. Please feel free to convert it into a PR. (I can close mine later.) But maybe fix the response (and the announcement) case first, and deal with the addresses records question later in a separate PR?

@anti-social
Copy link
Copy Markdown
Contributor

Possibly it is worth making an option for a discoverer to filter out unmatched IPs. In my case I show a list of found services to a user and it is annoying that there are addresses which are not connectable.

Let's merge this PR and I'll try to create another one for announcements and IP filtering.

@keepsimple1 keepsimple1 merged commit d210372 into main Apr 18, 2026
3 checks passed
@keepsimple1 keepsimple1 deleted the ks1/src-ip branch April 18, 2026 18:53
@keepsimple1
Copy link
Copy Markdown
Owner Author

Sounds good. Merged this one. Please go ahead.

@keepsimple1
Copy link
Copy Markdown
Owner Author

Let's merge this PR and I'll try to create another one for announcements and IP filtering.

just checking if you still plan to work on that, or if need anything from me.

@anti-social
Copy link
Copy Markdown
Contributor

just checking if you still plan to work on that, or if need anything from me.

It turned out a little trickier than I expected. Here it is: #462 . Tomorrow I'll try to glimpse at it one more time.

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