How to announce service with umDNS?

I'd say it's simpler to add JSON file with your service to the /etc/umdns/ directory.

Examples:

1 Like

@rmilecki : this isn't working for me... :confused: ( I just tried )
Furthermore I want to use the ubus bus to communicate between umdns and my daemon...

Is there somebody who uses umdns and can confirm that it's working?

I forgot to edit the config

/etc/config/umdns

And add the line

list network wan

Now it works. :slight_smile:

For me it is still not working.

"dig _http._tcp.local @192.168.50.1 -p 5353" hangs forever. "ubus call umdns browse
" is void.

cat /etc/config/umdns 
config umdns
        option jail 1
        list network lan
        list network lan2
        list network wan


netstat -plan | grep mdns
udp        0      0 224.0.0.251:5353        0.0.0.0:*                           4973/umdns
udp        0      0 192.168.50.1:5353       0.0.0.0:*                           4973/umdns
udp        0      0 224.0.0.251:5353        0.0.0.0:*                           4973/umdns
udp        0      0 192.168.182.1:5353      0.0.0.0:*                           4973/umdns
udp        0      0 ff02::fb:5353           :::*                                4973/umdns
udp        0      0 fe80::7aa3:51ff:fe10:590c:5353 :::*                                4973/umdns
udp        0      0 ff02::fb:5353           :::*                                4973/umdns
udp        0      0 fe80::7aa3:51ff:fe10:590d:5353 :::*                                4973/umdns
unix  3      [ ]         STREAM     CONNECTED     922780 4973/umdns


ubus call service list | jsonfilter -e '@[*].instances[*].data.mdns'
{ "ssh_22": { "service": "_ssh._tcp.local", "port": 22, "txt": [ "daemon=dropbear" ] } }


 ubus call umdns browse
{

}


Any clue?

Something is werid. Is this a bug? I still have to add umdns to wan although I have a dump AP!

2 Likes

Hi, Sorry for hijacking old thread but seems like indeed there is still indeed an unresolved bug in umDNS. I am using custom build OpenWRT 19.07. But without any modification to packages involved. I have followed the guide here: https://openwrt.org/docs/guide-developer/mdns

But my locally advertised printer is not on the list.
I have placed /etc/umdns/printer_service.json with the following content:

{
"HP\032LaserJet\032P1005\032Series": {
"service": "_printer._tcp",
"port": "9100",
"txt": [
"txtvers=1",
"qtotal=1",
"rp=RAW",
"priority=50",
"note=Livingroom",
"ty=HP LaserJet P1005",
"product=(HP LaserJet P1005)",
"usb_MFG=Hewlett-Packard",
"usb_MDL=HP LaserJet P1005",
"Color=F",
"Duplex=F",
"Bind=F",
"Collate=F",
"Sort=F",
"Staple=F",
"Punch=F",
"PaperMax=legal-A4"
]
}
}

I've checked the syntax with some online JSON syntax checked and I had a typo but I fixed it and its correct JSON now. Also I verified that printer is working besides network discovery. The printer works normally via network when added manually on Linux box and it prints. The firmware is loaded etc. I just want to make it discoverable on the br-lan.

I have two devices in network a router and ap both Turris Omnias and when I issue:
root@router:~# ubus call umdns browse
{
"_ssh._tcp": {
"ap": {
"ipv4": "$AP_IPv4",
"ipv6": "fe80::da58:d7ff:fe00:3d9e",
"port": 22
}
}
}

The same on the AP the router's SSH service is discoverable:
root@ap:~# ubus call umdns browse
{
"_ssh._tcp": {
"router": {
"ipv4": "$ROUTER_IPv4",
"ipv6": "fe80::da58:d7ff:fe00:20ac",
"port": 22
}
}
}

So it seems like umDNS is working but ignoring services defined in /etc/umdns/*.json.

Could it be some permission/ownership issue? Any ideas?

EDIT: I forgot to mention that printer is connected to dumb AP's USB port.
EDIT2: I forgot to mention my local DNS uses domain .lan instead of .local.

Related topic:

if you run umdns on the wan port, make sure to open the 5353 port on the wan interface inside the firewall, otherwise wan side machines can see you but local browse wont see the remote machines.

I have this rule on both devices; the rule is the last one:

/etc/config/firewall
config rule
option src_port '5353'
option name 'Allow-mDNS'
option target 'ACCEPT'
list dest_ip '224.0.0.251'
option dest_port '5353'
list proto 'udp'
option src '*'

Also this is the scan from other device in the network:

root@wizard:~# nmap -sU -p 5353 ap.lan
Starting Nmap 7.91 ( https://nmap.org ) at 2021-07-17 13:58 UTC
Nmap scan report for ap.lan ($AP_IPv4)
Host is up (0.00012s latency).
PORT STATE SERVICE
5353/udp open|filtered zeroconf
MAC Address: D8:58:D7:00:3D:9E (CZ.NIC, z.s.p.o.)
Nmap done: 1 IP address (1 host up) scanned in 0.79 seconds

EDIT: I've runned wireshark with remote ssh session on br-lan of ap device and I could see mdns traffic with this filter udp && ip.dst == 224.0.0.251. The traffic was from $ROUTER_IPv4, from $AP_IPv4 and from some IP of Android device advertising PTR records for SSH and GoogleCast respectively. All to 224.0.0.251 protocol MDNS. So it seems like it's no firewall issue but more likely a bug in umdns package ignoring services in /etc/umdns/*.json.

umdns version:
root@ap:~# opkg list-installed | grep umdns
umdns - 2020-04-25-cdac0460-2

Could someone please try to reproduce it or is using similar setup that works?

I have this running locally and it works.
so what exactly is your issue ?

  1. browse does not show remote announce
  2. extra *.json is not parsed
    ???

"bug in umdns package ignoring services in /etc/umdns/*.json." .... Ok, added to my todo list for next week. not tested that feature in a while ...

1 Like

That would be number two.

Ok thank you for your time! Waiting for your response after tests.

its on my ~/todo for next week ... so allow me a few days. having written the large part of that code I really wanna fix this :wink: I did work when I initially dropped the code, lol :stuck_out_tongue:

oh, please paste the json that you are using for publishing

root@ap:~# cat /etc/umdns/printer_service.json | curl -F 'clbin=<-' https://clbin.com
HERE it is to preserve formatting and whitespaces: https://clbin.com/uEsnd
I've checked with https://jsonchecker.com/ and its correct JSON.

@blogic Did you managed to take a look what might be wrong? In one week I will be offline for longer period and until that I could help out testing.

@blogic bump?

@blogic Next bump. Did you at least managed to take a look? I am not talking about writing new code yet.

Config files in "/etc/umdns/*.json" still don't work? Or this was fixed? Mine are still not working

Yes it does, I have successfully created some .json files that they got parsed.
For example:

/etc/umdns/smb.json

{
	"smb_139": { "service": "_smb._tcp.local", "port": 139, "txt": [ "daemon=samba36" ] },
}

/etc/umdns/http.json

{
	"http_80": { "service": "_http._tcp.local", "port": 80, "txt": [ "daemon=uhttpd" ] },
}

And so on, have already done it with other services like DLNA.
Just try to keep the same context as said in the examples and you will be ok.

2023 report. Not working for cross-vlan situation.
I gdb the code, and the design of it is really bizzar.
Find the service_reply function, it traverses the services avl, and got different outcomes comparing to umdns_browse.
Turns out, "service_reply" only check the json-added service but but not the cached services learned from different vlans, in my case, only find the default ssh and http which were added by json as I wanted to announced them.
So I figure, umdns need me to add the usefull services from cached-services to the annouced-service i guess. Emmmm, that's really balls-aching for someone didn't know that.

1 Like