Query, Fetch, and Browse with umDNS

Hello friends! I am hoping to gain a better understanding of how to interact with umDNS. Specifically, I am looking for some help (and hopefully examples) with the query, fetch, and browse actions of umDNS.

Here's where I'm at...

root@AP-Office:~# ubus -v list umdns
'umdns' @151b34b6
	"set_config":{"interfaces":"Array","keep":"Boolean"}
	"query":{"question":"String","interface":"String","type":"Integer"}
	"fetch":{"question":"String","interface":"String","type":"Integer"}
	"update":{}
	"browse":{}
	"hosts":{}
	"reload":{}

I am generally familiar with the output from browse. But I cannot find any examples of how to properly use query and fetch. Any help with that would be most appreciated. :pray:

Secondly, in looking over the source of mdnsd, I see some very interesting commits that speak to some functionality I'm looking for:

ubus: make it possible to return txt records as an array
&&
ubus: allow filtering by service when invoking the browse method

But again, I'm not familiar enough with ubus and umDNS to know how to make use of those features.

If I'm not mistaken, I believe @blogic is the author of those commits. Someone please correct me if I'm wrong.

Thanks in advance for any usage guidance! :slight_smile:

Well, I made one interesting discovery. Turns out the umdns Makefile is currently pointing at an older commit:

service: fix compilation with GCC 10

I updated my Makefile to the latest commit (65b3308d13de7d7975444d34389651612e2a4d38) and, lo and behold, I now see something I can work with re: browse! :slight_smile:

root@AP-Office:~# ubus -v list umdns
'umdns' @4b06a93d
	"set_config":{"interfaces":"Array","keep":"Boolean"}
	"query":{"question":"String","interface":"String","type":"Integer"}
	"fetch":{"question":"String","interface":"String","type":"Integer"}
	"browse":{"service":"String","array":"Boolean"}
	"update":{}
	"hosts":{}
	"reload":{}

For example:

root@AP-Office:~# ubus call umdns browse '{ "service": "_ipp._tcp" }'
{
	"_ipp._tcp": {
		"Brother HL-L2360D": {
			"iface": "br-lan.1"
		}
	}
}

Going to see if I can make sense of the "txt records as an array" bit now. That was easy...

It's simply an additional boolean passed into the browse call:

ubus call umdns browse '{ "service": "_ipp._tcp", "array": true }'


@blogic What would it take to go ahead and push https://git.openwrt.org/?p=project/mdnsd.git;a=commit;h=65b3308d13de7d7975444d34389651612e2a4d38 to snapshot (and possibly the release branches)?

2 Likes

Probably prepare a PR, for it to be merged/ discussed on github. This update is needed for this kind of service query to work (tested on x86_64, mt7621 and ipq807x).

1 Like

Definitely! I do have plans to follow up with @blogic later this week to discuss this more. I'll keep this thread open and updated until I have some more feedback on how this is progressing.

1 Like