avahi/fruit: _device-info._tcp not propagated
Rouven WEILER
Rouven_Weiler at gmx.net
Tue Jan 15 13:26:17 UTC 2019
I would like to recommend a change in the avahi part propagating the Finder Device Icon to MacOS.
Therefore, I would change the avahi_register.c to include parts for sending "_device-info._tcp" when the vfs_object fruit is loaded.
For adding this info to avahi the entry
--
<service> <type>_device-info._tcp</type> <port>0</port> <txt-record>model=RackMac</txt-record> </service>
--
has to be put into the avahi service file (see: https://jonathanmumm.com/tech-it/mdns-bonjour-bible-common-service-strings-for-various-vendors/ and https://simonwheatley.co.uk/2008/04/avahi-finder-icons/).
This works fine when doing that manually with avahi.
I thought of adding that now into samba.
As a first try I added a new avahi_register.c file showing the first ideas.
If that sounds good too you I would appreciate some help concerning:
- How would I chech whether fruit has been loaded to start the _device-info propagation?
- Is the coding/error handling etc okay?
If my changes are not necessary, please tell me how to change the "MacSamba" Icon to e.g. "RackMac".
I actually do not see this change on my Mac using samba internals. Avahi as standalone works. (Maybe a bug?)
Thanks in advance.
Here the changes I thought of in "avahi_register.c", function "avahi_client_callback":
static void avahi_client_callback(AvahiClient *c, AvahiClientState status,
void *userdata)
{
...
state->entry_group = avahi_entry_group_new(
c, avahi_entry_group_callback, state);
if (state->entry_group == NULL) {
error = avahi_client_errno(c);
DBG_DEBUG("avahi_entry_group_new failed: %s\n",
avahi_strerror(error));
break;
}
error = avahi_entry_group_add_service(
state->entry_group, AVAHI_IF_UNSPEC,
AVAHI_PROTO_UNSPEC, 0, hostname,
"_smb._tcp", NULL, NULL, state->port, NULL);
error = avahi_entry_group_add_service(
state->entry_group, AVAHI_IF_UNSPEC,
AVAHI_PROTO_UNSPEC, 0, hostname,
"_device-info._tcp", NULL, NULL, 0, NULL);
if (error != AVAHI_OK) {
DBG_DEBUG("avahi_entry_group_add_service failed: %s\n",
avahi_strerror(error));
avahi_entry_group_free(state->entry_group);
state->entry_group = NULL;
break;
}
device_info = avahi_string_list_add_printf(
device_info, "model=%s",
lp_parm_const_string(-1, FRUIT_PARAM_TYPE_NAME, "model", "MacSamba");
if (device_info == NULL) {
DBG_DEBUG("avahi_string_list_add_printf"
"failed: returned NULL\n");
avahi_string_list_free(adisk);
avahi_entry_group_free(state->entry_group);
state->entry_group = NULL;
break;
}
...
}
More information about the samba-technical
mailing list