In investigating an mDNS SRV discovery issue with `systemd-resolved` I
hit a problem where `systemd-resolved` reports:
We have `squid-deb-proxy` and `apt-cacher-ng` (and others) that can advertise an mDNS SRV record `_apt_proxy._tcp`.
We have tools such as `auto-apt-proxy` and others that can (try to) discover the SRV record (it uses `apt-helper srv-lookup _apt_proxy._tcp.local`) BUT `systemd-resolved` considers `_apt_proxy` an illegal label because it contains an underscore after the first underscore and fails to resolve it with an error report:
`Resolve call failed: Invalid SRV service type '_apt_proxy._tcp'`.
I've seen this issue caused by `systemd-machined` in the context of using `mkosi` to build containers where mkosi can include an underscore in the machine name but `systemd-machined` treats it as illegal and won't allow it.
The solution is to advertise a legal SRV name as well and modify any tools that look-up the SRV record.
For `avahi-daemon`:
```
$ cat /etc/avahi/services/apt-cacher-ng.service
<?xml version="1.0" standalone='no'?>
<!--
From: Lisandro Damián Nicanor Pérez Meyer <lisandro@debian.org>
X-Source: http://blog.surgut.co.uk/2013/03/avahi-apt-cacher-ng-sbuild.html
See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=704790 for details.
-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">apt-cacher-ng proxy on %h</name>
<service protocol="ipv6">
<type>_apt_proxy._tcp</type>
<port>3142</port>
</service>
<service protocol="ipv4">
<type>_apt_proxy._tcp</type>
<port>3142</port>
</service>
<service protocol="ipv6">
<type>_apt-proxy._tcp</type>
<port>3142</port>
</service>
<service protocol="ipv4">
<type>_apt-proxy._tcp</type>
<port>3142</port>
</service>
</service-group>
```
And for `systemd-resolved`:
```
$ cat /etc/systemd/dnssd/squid-deb-proxy.dnssd
[Service]
Name=apt-cacher-ng proxy on %H systemd
Type=_apt-proxy._tcp
Port=3142
```
-- Package-specific info: