[avahi] Inconsistent orders of TXT argument in Avahi client API

Handa Wang handaw at google.com
Tue Feb 14 08:02:51 UTC 2023


Hello,

(This is the same as issue #436
<https://github.com/lathiat/avahi/issues/436>.)

It seems that in `avahi_entry_group_add_service_strlst` the passed in TXT
argument is reversed before passing to the server:
https://github.com/lathiat/avahi/blob/master/avahi-client/entrygroup.c#L373.
In this way when we call the `avahi_entry_group_add_service_strlst` API, we
can construct the TXT string list by calling `avahi_string_list_add` in the
normal order.

On the other hand, the TXT passed into `AvahiServiceResolverCallback` is in
the reverse order, which is different from above. When a user receives the
TXT in the callback, the user may have to reverse the TXT string list first
to get the correct order.

Is this a bug or by design?

Also, it seems that `avahi-browse` also doesn't reverse the TXT string list
in its callback so that it returns the TXT record in the reversed order.
This can be confirmed by following commands:

```
$ sudo avahi-publish-service test1 _test._udp 1234 k1=v1 k2=v2
```

```
$ avahi-browse -rt  _test._udp
```

Regards,
Handa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/avahi/attachments/20230214/d6569995/attachment.htm>


More information about the avahi mailing list