Tuesday, 10 January 2017

Re: Using the dummy0 interface for a local-only service to be broadcasted by Avahi

On 01/10/2017 02:10 AM, Mathieu Trudel-Lapierre wrote:
> On Fri, Dec 30, 2016 at 2:44 PM, Till Kamppeter
> <[email protected] <mailto:[email protected]>> wrote:
> [...]
>
> I also get:
>
> [email protected]:~$ hostname -I
> 192.168.0.15 192.168.122.1 2804:14c:5ba8:8b97::1
> 2804:14c:5ba8:8b97:205:1bff:feb0:7395 fd00:1:1::1
> [email protected]:~$ hostname -A
> till-x1carbon till-x1carbon till-x1carbon till-x1carbon
> ippusbxd-printers
> t[email protected]:~$
>
> Does this mean that the first 4 IPs have the host name till-x1carbon
> and the address fd00:1:1::1 has the host name ippusbxd-printers?
>
> "ping ippusbxd-printers" pings the address fd00:1:1::1.
>
>
> The man page states for -A: "Do not make any assumptions about the
> order of the output."
>
> It simply means that there are a few names you can use *locally* to
> refer to this system; one of which being "ippusbxd-printers"; as
> discovered by looking at each configured interface and resolving the
> address. Nothing more.
>
> Any service that needs to listen to things and care about hostname will
> need to ask the system on its own what the hostname should be. This is
> typically done using gethostname() (and it looks like that's what avahi
> is doing), or looking at files such as /etc/hostname, or asking a daemon
> like systemd-hostnamed. The closer approximation on the command-line
> would probably be "getent hosts fd00:1:1::1", but it won't help you if
> that's not what avahi cares about.
>
>
> Problems:
>
> 1. I would like to assign the name by Zeroconf and not by modifying
> /etc/hosts. How can I do this.
>
> 2. Bonjour/Avahi broadcasting still does not work correctly.
>
> I still register via
>
> error =
> avahi_entry_group_add_service_strlst(bonjour_data->ipp_ref,
> (int)if_nametoindex("ippusbxd"),
> AVAHI_PROTO_UNSPEC, 0,
> dnssd_name,
> "_ipp._tcp", NULL, NULL, 60000,
> ipp_txt);
>
>
> Set something other than NULL as the "host" parameter? (the second NULL
> in that call)
>
>
>
> but the "Address:" entry in the Bonjour record visible in
> avahi-discover (Interface: ippusbxd -> local -> Internet Printer)
> still uses the wrong host name:
>
> Address: till-x1carbon.local/fd00:1:1::1:60000
>
> It should be
>
> Address: ippusbxd-printers/fd00:1:1::1:60000
>
> How can I fix this?
>
>
> I expect that will be fixed when you specify a hostname as you register
> the service. Otherwise, NULL just tells avahi to use the hostname it
> already knows, which will be what gethostname() returns.

I have tried this one

error =
avahi_entry_group_add_service_strlst(bonjour_data->ipp_ref,
(int)if_nametoindex("ippusbxd"),
AVAHI_PROTO_UNSPEC, 0,
dnssd_name,
"_ipp._tcp", NULL, "ippusbxd-printers", 60000,
ipp_txt);

end it returns error code -3.

As I told already earlier, I have assigned the host name
"ippusbxd-printers" to the IPP address fd00:1:1::1 in /etc/hosts and
Firefox and CUPS resolve this host name correctly.

Till


--
ubuntu-devel mailing list
[email protected]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel