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

iiod: Make sure network is alive before poking avahi #1080

Merged
merged 1 commit into from
Nov 13, 2023

Conversation

rgetz
Copy link
Contributor

@rgetz rgetz commented Oct 29, 2023

In the past, we were only checking hostname, as a way to see if the network was ready, but unfortantely - that doesn't work. The kernel really only needs to have a hostname set for uname() to work, which is what glibc and uclibc actaully do in gethostname().

So - now we actualyl check there is a working, configured ethernet card, that supports mdns (ie multicast) that is up before moving on to making sure there is a hostname.

We also don't allow "none" or "(none)" to be the hostname until after things time out (3 min).

This fixes #1072 and turns:
192.168.2.1:5353 : answer _iio._tcp.local. PTR "iiod on (none)._iio._tcp.local." rclass 0x1 ttl 10 length 17 into:
192.168.2.1:5353 : answer _iio._tcp.local. PTR "iiod on pluto._iio._tcp.local." rclass 0x1 ttl 10 length 16

@rgetz
Copy link
Contributor Author

rgetz commented Oct 29, 2023

Since this fixes a problem on Pluto/M2k - I assume it should be applied to the 0.25 branch, and so that when Michael makes new firmware images - it gets picked up...

-Robin

@mhennerich
Copy link
Contributor

Since this fixes a problem on Pluto/M2k - I assume it should be applied to the 0.25 branch, and so that when Michael makes new firmware images - it gets picked up...

Let's apply such fixes also to the https://github.com/analogdevicesinc/libiio/tree/libiio-v0 branch.
I can point buildroot there and it'll get included in the next FW release.

Copy link
Contributor

@pcercuei pcercuei left a comment

Choose a reason for hiding this comment

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

Just some tiny comments, looks OK otherwise.

iiod/dns-sd.c Outdated Show resolved Hide resolved
iiod/dns-sd.c Outdated Show resolved Hide resolved
iiod/dns-sd.c Outdated Show resolved Hide resolved
@rgetz rgetz force-pushed the rgetz-fix_early_network_issue branch 2 times, most recently from 8c4b80c to 0c49703 Compare October 30, 2023 13:06
@pcercuei pcercuei self-requested a review October 30, 2023 13:09
@rgetz rgetz force-pushed the rgetz-fix_early_network_issue branch from 0c49703 to 2021546 Compare November 10, 2023 15:57
@rgetz
Copy link
Contributor Author

rgetz commented Nov 10, 2023

Ok - as soon as this builds on CI, it should be good to go.

@rgetz
Copy link
Contributor Author

rgetz commented Nov 10, 2023

The CI failure is fixed with this: 2d92d14

and has nothing to do with this patch.

@rgetz rgetz force-pushed the rgetz-fix_early_network_issue branch from 2021546 to 920b0c7 Compare November 10, 2023 16:22
@rgetz
Copy link
Contributor Author

rgetz commented Nov 10, 2023

fixed issue pointed out by Codacy

@pcercuei
Copy link
Contributor

Yeah don't worry. I don't require all CIs to succeed to merge a PR, when the errors are obviously unrelated.

iiod/dns-sd.c Outdated Show resolved Hide resolved
In the past, we were only checking hostname, as a way to see if the
network was ready, but unfortunately - that doesn't work. The kernel
really only needs to have a hostname set for uname() to work, which is
what glibc and uclibc implement in gethostname().

So - now we check there is a working, configured ethernet card,
that supports mdns (ie. multicast) that is up before moving on to making
sure there is a hostname.

We also don't allow "none" or "(none)" to be the hostname until after
things time out (3 min).

This fixes analogdevicesinc#1072 and turns:
192.168.2.1:5353 : answer _iio._tcp.local. PTR "iiod on (none)._iio._tcp.local." rclass 0x1 ttl 10 length 17
into:
192.168.2.1:5353 : answer _iio._tcp.local. PTR "iiod on pluto._iio._tcp.local." rclass 0x1 ttl 10 length 16

and when you have multiple on network (with same name):
192.168.1.110:5353 : answer _iio._tcp.local. PTR "iiod on pluto._iio._tcp.local." rclass 0x1 ttl 10 length 16
192.168.1.110:5353 : answer pluto.local. A 192.168.1.110
192.168.1.115:5353 : answer _iio._tcp.local. PTR "iiod on pluto analogdevicesinc#2._iio._tcp.local." rclass 0x1 ttl 10 length 19
192.168.1.115:5353 : answer pluto-2.local. A 192.168.1.115

Signed-off-by: Robin Getz <[email protected]>
@rgetz rgetz force-pushed the rgetz-fix_early_network_issue branch from 920b0c7 to 7cabf6a Compare November 10, 2023 16:28
@pcercuei pcercuei self-requested a review November 13, 2023 11:52
@pcercuei pcercuei merged commit 841a3b1 into analogdevicesinc:main Nov 13, 2023
20 of 23 checks passed
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.

DNS-SD PTR record ill formed on Pluto...
3 participants