From 907bf2598220828a50b22cc00395524bb74feb8e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 16 Sep 2005 01:19:32 +0000 Subject: [PATCH] Make AVAHI_PROTO_xxx well defined constants git-svn-id: file:///home/lennart/svn/public/avahi/trunk@595 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-common/address.c | 53 ++++++++++++++++++++++++++-------- avahi-common/address.h | 19 ++++++++---- avahi-core/iface.c | 28 +++++++++--------- avahi-core/resolve-address.c | 4 +-- avahi-core/resolve-host-name.c | 4 +-- avahi-core/resolve-service.c | 4 +-- avahi-core/server.c | 26 ++++++++--------- avahi-core/socket.c | 2 +- avahi-daemon/dbus-protocol.c | 12 ++++---- 9 files changed, 95 insertions(+), 57 deletions(-) diff --git a/avahi-common/address.c b/avahi-common/address.c index 50224ed..8c4dd38 100644 --- a/avahi-common/address.c +++ b/avahi-common/address.c @@ -35,9 +35,9 @@ size_t avahi_address_get_size(const AvahiAddress *a) { assert(a); - if (a->family == AVAHI_PROTO_INET) + if (a->proto == AVAHI_PROTO_INET) return 4; - else if (a->family == AVAHI_PROTO_INET6) + else if (a->proto == AVAHI_PROTO_INET6) return 16; return 0; @@ -47,7 +47,7 @@ int avahi_address_cmp(const AvahiAddress *a, const AvahiAddress *b) { assert(a); assert(b); - if (a->family != b->family) + if (a->proto != b->proto) return -1; return memcmp(a->data.data, b->data.data, avahi_address_get_size(a)); @@ -58,7 +58,7 @@ char *avahi_address_snprint(char *s, size_t length, const AvahiAddress *a) { assert(length); assert(a); - return (char*) inet_ntop(a->family, a->data.data, s, length); + return (char*) inet_ntop(avahi_proto_to_af(a->proto), a->data.data, s, length); } char* avahi_reverse_lookup_name_ipv4(const AvahiIPv4Address *a) { @@ -114,23 +114,23 @@ char *avahi_reverse_lookup_name_ipv6_int(const AvahiIPv6Address *a) { return reverse_lookup_name_ipv6(a, "ip6.int"); } -AvahiAddress *avahi_address_parse(const char *s, AvahiProtocol family, AvahiAddress *ret_addr) { +AvahiAddress *avahi_address_parse(const char *s, AvahiProtocol proto, AvahiAddress *ret_addr) { assert(ret_addr); assert(s); - if (family == AVAHI_PROTO_UNSPEC) { + if (proto == AVAHI_PROTO_UNSPEC) { if (inet_pton(AF_INET, s, ret_addr->data.data) <= 0) { if (inet_pton(AF_INET6, s, ret_addr->data.data) <= 0) return NULL; else - ret_addr->family = AVAHI_PROTO_INET6; + ret_addr->proto = AVAHI_PROTO_INET6; } else - ret_addr->family = AVAHI_PROTO_INET; + ret_addr->proto = AVAHI_PROTO_INET; } else { - if (inet_pton(family, s, ret_addr->data.data) <= 0) + if (inet_pton(avahi_proto_to_af(proto), s, ret_addr->data.data) <= 0) return NULL; - ret_addr->family = family; + ret_addr->proto = proto; } return ret_addr; @@ -142,7 +142,7 @@ AvahiAddress *avahi_address_from_sockaddr(const struct sockaddr* sa, AvahiAddres assert(sa->sa_family == AF_INET || sa->sa_family == AF_INET6); - ret_addr->family = sa->sa_family; + ret_addr->proto = avahi_af_to_proto(sa->sa_family); if (sa->sa_family == AF_INET) memcpy(&ret_addr->data.ipv4, &((const struct sockaddr_in*) sa)->sin_addr, sizeof(ret_addr->data.ipv4)); @@ -173,9 +173,38 @@ int avahi_address_is_ipv4_in_ipv6(const AvahiAddress *a) { assert(a); - if (a->family != AVAHI_PROTO_INET6) + if (a->proto != AVAHI_PROTO_INET6) return 0; return memcmp(a->data.ipv6.address, ipv4_in_ipv6, sizeof(ipv4_in_ipv6)) == 0; } +int avahi_proto_to_af(AvahiProtocol proto) { + if (proto == AVAHI_PROTO_INET) + return AF_INET; + if (proto == AVAHI_PROTO_INET6) + return AF_INET6; + + assert(proto == AVAHI_PROTO_UNSPEC); + return AF_UNSPEC; +} + +AvahiProtocol avahi_af_to_proto(int af) { + if (af == AF_INET) + return AVAHI_PROTO_INET; + if (af == AF_INET6) + return AVAHI_PROTO_INET6; + + assert(af == AF_UNSPEC); + return AVAHI_PROTO_UNSPEC; +} + +const char* avahi_proto_to_string(AvahiProtocol proto) { + if (proto == AVAHI_PROTO_INET) + return "IPv4"; + if (proto == AVAHI_PROTO_INET6) + return "IPv6"; + + assert(proto == AVAHI_PROTO_UNSPEC); + return "UNSPEC"; +} diff --git a/avahi-common/address.h b/avahi-common/address.h index 60495a3..c5e5297 100644 --- a/avahi-common/address.h +++ b/avahi-common/address.h @@ -32,16 +32,16 @@ AVAHI_C_DECL_BEGIN /** Protocol family specification, takes the values AVAHI_INET, AVAHI_INET6, AVAHI_UNSPEC */ -typedef unsigned char AvahiProtocol; +typedef char AvahiProtocol; /** Numeric network interface index. Takes OS dependent values and the special constant AVAHI_IF_UNSPEC */ typedef int AvahiIfIndex; /** Values for AvahiProtocol */ enum { - AVAHI_PROTO_INET = AF_INET, /**< IPv4 */ - AVAHI_PROTO_INET6 = AF_INET6, /**< IPv6 */ - AVAHI_PROTO_UNSPEC = AF_UNSPEC /**< Unspecified/all protocol(s) */ + AVAHI_PROTO_INET = 0, /**< IPv4 */ + AVAHI_PROTO_INET6 = 1, /**< IPv6 */ + AVAHI_PROTO_UNSPEC = -1 /**< Unspecified/all protocol(s) */ }; /** Special values for AvahiIfIndex */ @@ -61,7 +61,7 @@ typedef struct { /** Protocol (address family) independent address structure */ typedef struct { - AvahiProtocol family; /**< Address family */ + AvahiProtocol proto; /**< Address family */ union { AvahiIPv6Address ipv6; /** Address when IPv6 */ @@ -103,6 +103,15 @@ char* avahi_reverse_lookup_name_ipv6_int(const AvahiIPv6Address *a); * encapsulated IPv4 address, returns 1 if yes, 0 otherwise */ int avahi_address_is_ipv4_in_ipv6(const AvahiAddress *a); +/** Map AVAHI_PROTO_xxx constants to Unix AF_xxx constants */ +int avahi_proto_to_af(AvahiProtocol proto); + +/** Map Unix AF_xxx constants to AVAHI_PROTO_xxx constants */ +AvahiProtocol avahi_af_to_proto(int af); + +/** Return a textual representation of the specified protocol number. i.e. "IPv4", "IPv6" or "UNSPEC" */ +const char* avahi_proto_to_string(AvahiProtocol proto); + AVAHI_C_DECL_END #endif diff --git a/avahi-core/iface.c b/avahi-core/iface.c index 38d9909..1692938 100644 --- a/avahi-core/iface.c +++ b/avahi-core/iface.c @@ -243,7 +243,7 @@ static int netlink_list_items(AvahiNetlink *nl, uint16_t type, unsigned *ret_seq n = (struct nlmsghdr*) req; n->nlmsg_len = NLMSG_LENGTH(sizeof(struct rtgenmsg)); n->nlmsg_type = type; - n->nlmsg_flags = NLM_F_ROOT/*|NLM_F_MATCH*/|NLM_F_REQUEST; + n->nlmsg_flags = NLM_F_ROOT|NLM_F_REQUEST; n->nlmsg_pid = 0; gen = NLMSG_DATA(n); @@ -307,7 +307,7 @@ static void check_interface_relevant(AvahiInterfaceMonitor *m, AvahiInterface *i b = avahi_interface_relevant(i); if (m->list == LIST_DONE && b && !i->announcing) { - avahi_log_info("New relevant interface %s.%i.", i->hardware->name, i->protocol); + avahi_log_info("New relevant interface %s.%s.", i->hardware->name, avahi_proto_to_string(i->protocol)); if (i->protocol == AVAHI_PROTO_INET) avahi_mdns_mcast_join_ipv4(m->server->fd_ipv4, i->hardware->index); @@ -318,7 +318,7 @@ static void check_interface_relevant(AvahiInterfaceMonitor *m, AvahiInterface *i avahi_announce_interface(m->server, i); avahi_browser_new_interface(m->server, i); } else if (!b && i->announcing) { - avahi_log_info("Interface %s.%i no longer relevant.", i->hardware->name, i->protocol); + avahi_log_info("Interface %s.%s no longer relevant.", i->hardware->name, avahi_proto_to_string(i->protocol)); if (i->protocol == AVAHI_PROTO_INET) avahi_mdns_mcast_leave_ipv4(m->server->fd_ipv4, i->hardware->index); @@ -450,13 +450,13 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat AvahiAddress raddr; int raddr_valid = 0; - if (ifaddrmsg->ifa_family != AVAHI_PROTO_INET && ifaddrmsg->ifa_family != AVAHI_PROTO_INET6) + if (ifaddrmsg->ifa_family != AF_INET && ifaddrmsg->ifa_family != AF_INET6) return; - if (!(i = (AvahiInterface*) avahi_interface_monitor_get_interface(m, (AvahiIfIndex) ifaddrmsg->ifa_index, (AvahiProtocol) ifaddrmsg->ifa_family))) + if (!(i = (AvahiInterface*) avahi_interface_monitor_get_interface(m, (AvahiIfIndex) ifaddrmsg->ifa_index, avahi_af_to_proto(ifaddrmsg->ifa_family)))) return; - raddr.family = (AvahiProtocol) ifaddrmsg->ifa_family; + raddr.proto = avahi_af_to_proto(ifaddrmsg->ifa_family); l = NLMSG_PAYLOAD(n, sizeof(struct ifaddrmsg)); a = IFA_RTA(ifaddrmsg); @@ -465,8 +465,8 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat switch(a->rta_type) { case IFA_ADDRESS: - if ((raddr.family == AVAHI_PROTO_INET6 && RTA_PAYLOAD(a) != 16) || - (raddr.family == AVAHI_PROTO_INET && RTA_PAYLOAD(a) != 4)) + if ((raddr.proto == AVAHI_PROTO_INET6 && RTA_PAYLOAD(a) != 16) || + (raddr.proto == AVAHI_PROTO_INET && RTA_PAYLOAD(a) != 4)) return; memcpy(raddr.data.data, RTA_DATA(a), RTA_PAYLOAD(a)); @@ -630,7 +630,7 @@ void avahi_interface_send_packet_unicast(AvahiInterface *i, AvahiDnsPacket *p, c if (!avahi_interface_relevant(i)) return; - assert(!a || a->family == i->protocol); + assert(!a || a->proto == i->protocol); /* if (a) */ /* avahi_log_debug("unicast sending on '%s.%i' to %s:%u", i->hardware->name, i->protocol, avahi_address_snprint(t, sizeof(t), a), port); */ @@ -687,7 +687,7 @@ int avahi_dump_caches(AvahiInterfaceMonitor *m, AvahiDumpCallback callback, void for (i = m->interfaces; i; i = i->interface_next) { if (avahi_interface_relevant(i)) { char ln[256]; - snprintf(ln, sizeof(ln), ";;; INTERFACE %s.%i ;;;", i->hardware->name, i->protocol); + snprintf(ln, sizeof(ln), ";;; INTERFACE %s.%s ;;;", i->hardware->name, avahi_proto_to_string(i->protocol)); callback(ln, userdata); if (avahi_cache_dump(i->cache, callback, userdata) < 0) return -1; @@ -825,12 +825,12 @@ int avahi_interface_address_on_link(AvahiInterface *i, const AvahiAddress *a) { assert(i); assert(a); - if (a->family != i->protocol) + if (a->proto != i->protocol) return 0; for (ia = i->addresses; ia; ia = ia->address_next) { - if (a->family == AVAHI_PROTO_INET) { + if (a->proto == AVAHI_PROTO_INET) { uint32_t m; m = ~(((uint32_t) -1) >> ia->prefix_len); @@ -840,7 +840,7 @@ int avahi_interface_address_on_link(AvahiInterface *i, const AvahiAddress *a) { } else { unsigned j; unsigned char pl; - assert(a->family == AVAHI_PROTO_INET6); + assert(a->proto == AVAHI_PROTO_INET6); pl = ia->prefix_len; @@ -875,7 +875,7 @@ int avahi_interface_has_address(AvahiInterfaceMonitor *m, AvahiIfIndex iface, co assert(iface != AVAHI_IF_UNSPEC); assert(a); - if (!(i = avahi_interface_monitor_get_interface(m, iface, a->family))) + if (!(i = avahi_interface_monitor_get_interface(m, iface, a->proto))) return 0; for (j = i->addresses; j; j = j->address_next) diff --git a/avahi-core/resolve-address.c b/avahi-core/resolve-address.c index 18c862c..d5fe743 100644 --- a/avahi-core/resolve-address.c +++ b/avahi-core/resolve-address.c @@ -141,9 +141,9 @@ AvahiSAddressResolver *avahi_s_address_resolver_new(AvahiServer *server, AvahiIf assert(address); assert(callback); - assert(address->family == AVAHI_PROTO_INET || address->family == AVAHI_PROTO_INET6); + assert(address->proto == AVAHI_PROTO_INET || address->proto == AVAHI_PROTO_INET6); - if (address->family == AVAHI_PROTO_INET) + if (address->proto == AVAHI_PROTO_INET) n = avahi_reverse_lookup_name_ipv4(&address->data.ipv4); else n = avahi_reverse_lookup_name_ipv6_arpa(&address->data.ipv6); diff --git a/avahi-core/resolve-host-name.c b/avahi-core/resolve-host-name.c index d9c3341..7bb5727 100644 --- a/avahi-core/resolve-host-name.c +++ b/avahi-core/resolve-host-name.c @@ -72,12 +72,12 @@ static void finish(AvahiSHostNameResolver *r, AvahiResolverEvent event) { switch (r->address_record->key->type) { case AVAHI_DNS_TYPE_A: - a.family = AVAHI_PROTO_INET; + a.proto = AVAHI_PROTO_INET; a.data.ipv4 = r->address_record->data.a.address; break; case AVAHI_DNS_TYPE_AAAA: - a.family = AVAHI_PROTO_INET6; + a.proto = AVAHI_PROTO_INET6; a.data.ipv6 = r->address_record->data.aaaa.address; break; diff --git a/avahi-core/resolve-service.c b/avahi-core/resolve-service.c index 6dbca40..0ecd388 100644 --- a/avahi-core/resolve-service.c +++ b/avahi-core/resolve-service.c @@ -84,12 +84,12 @@ static void finish(AvahiSServiceResolver *r, AvahiResolverEvent event) { switch (r->address_record->key->type) { case AVAHI_DNS_TYPE_A: - a.family = AVAHI_PROTO_INET; + a.proto = AVAHI_PROTO_INET; a.data.ipv4 = r->address_record->data.a.address; break; case AVAHI_DNS_TYPE_AAAA: - a.family = AVAHI_PROTO_INET6; + a.proto = AVAHI_PROTO_INET6; a.data.ipv6 = r->address_record->data.aaaa.address; break; diff --git a/avahi-core/server.c b/avahi-core/server.c index 11deb24..c746287 100644 --- a/avahi-core/server.c +++ b/avahi-core/server.c @@ -814,7 +814,7 @@ static void reflect_legacy_unicast_query_packet(AvahiServer *s, AvahiDnsPacket * assert(i); assert(a); assert(port > 0); - assert(i->protocol == a->family); + assert(i->protocol == a->proto); if (!s->config.enable_reflector) return; @@ -902,7 +902,7 @@ static int is_mdns_mcast_address(const AvahiAddress *a) { AvahiAddress b; assert(a); - avahi_address_parse(a->family == AVAHI_PROTO_INET ? AVAHI_IPV4_MCAST_GROUP : AVAHI_IPV6_MCAST_GROUP, a->family, &b); + avahi_address_parse(a->proto == AVAHI_PROTO_INET ? AVAHI_IPV4_MCAST_GROUP : AVAHI_IPV6_MCAST_GROUP, a->proto, &b); return avahi_address_cmp(a, &b) == 0; } @@ -930,7 +930,7 @@ static void dispatch_packet(AvahiServer *s, AvahiDnsPacket *p, const struct sock assert(dest); assert(iface > 0); - if (!(i = avahi_interface_monitor_get_interface(s->monitor, iface, sa->sa_family)) || + if (!(i = avahi_interface_monitor_get_interface(s->monitor, iface, avahi_af_to_proto(sa->sa_family))) || !avahi_interface_relevant(i)) { avahi_log_warn("Recieved packet from invalid interface."); return; @@ -1024,7 +1024,7 @@ static void dispatch_legacy_unicast_packet(AvahiServer *s, AvahiDnsPacket *p, co assert(sa); assert(iface > 0); - if (!(i = avahi_interface_monitor_get_interface(s->monitor, iface, sa->sa_family)) || + if (!(i = avahi_interface_monitor_get_interface(s->monitor, iface, avahi_af_to_proto(sa->sa_family))) || !avahi_interface_relevant(i)) { avahi_log_warn("Recieved packet from invalid interface."); return; @@ -1049,7 +1049,7 @@ static void dispatch_legacy_unicast_packet(AvahiServer *s, AvahiDnsPacket *p, co return; } - if (!(j = avahi_interface_monitor_get_interface(s->monitor, slot->interface, slot->address.family)) || + if (!(j = avahi_interface_monitor_get_interface(s->monitor, slot->interface, slot->address.proto)) || !avahi_interface_relevant(j)) return; @@ -1078,27 +1078,27 @@ static void socket_event(AvahiWatch *w, int fd, AvahiWatchEvent events, void *us if (events & AVAHI_WATCH_IN) { if (fd == s->fd_ipv4) { - dest.family = AVAHI_PROTO_INET; + dest.proto = AVAHI_PROTO_INET; if ((p = avahi_recv_dns_packet_ipv4(s->fd_ipv4, &sa, &dest.data.ipv4, &iface, &ttl))) { dispatch_packet(s, p, (struct sockaddr*) &sa, &dest, iface, ttl); avahi_dns_packet_free(p); } } else if (fd == s->fd_ipv6) { - dest.family = AVAHI_PROTO_INET6; + dest.proto = AVAHI_PROTO_INET6; if ((p = avahi_recv_dns_packet_ipv6(s->fd_ipv6, &sa6, &dest.data.ipv6, &iface, &ttl))) { dispatch_packet(s, p, (struct sockaddr*) &sa6, &dest, iface, ttl); avahi_dns_packet_free(p); } } else if (fd == s->fd_legacy_unicast_ipv4) { - dest.family = AVAHI_PROTO_INET; + dest.proto = AVAHI_PROTO_INET; if ((p = avahi_recv_dns_packet_ipv4(s->fd_legacy_unicast_ipv4, &sa, &dest.data.ipv4, &iface, &ttl))) { dispatch_legacy_unicast_packet(s, p, (struct sockaddr*) &sa, iface, ttl); avahi_dns_packet_free(p); } } else if (fd == s->fd_legacy_unicast_ipv6) { - dest.family = AVAHI_PROTO_INET6; + dest.proto = AVAHI_PROTO_INET6; if ((p = avahi_recv_dns_packet_ipv6(s->fd_legacy_unicast_ipv6, &sa6, &dest.data.ipv6, &iface, &ttl))) { dispatch_legacy_unicast_packet(s, p, (struct sockaddr*) &sa6, iface, ttl); @@ -1686,7 +1686,7 @@ int avahi_server_add_address( goto fail; } - if (a->family == AVAHI_PROTO_INET) { + if (a->proto == AVAHI_PROTO_INET) { char *reverse; AvahiRecord *r; @@ -1714,7 +1714,7 @@ int avahi_server_add_address( char *reverse; AvahiRecord *r; - assert(a->family == AVAHI_PROTO_INET6); + assert(a->proto == AVAHI_PROTO_INET6); if (!(r = avahi_record_new_full(name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_AAAA, AVAHI_DEFAULT_TTL_HOST_NAME))) { ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY); @@ -2064,7 +2064,7 @@ int avahi_server_add_dns_server_address( assert(s); assert(address); assert(type == AVAHI_DNS_SERVER_UPDATE || type == AVAHI_DNS_SERVER_RESOLVE); - assert(address->family == AVAHI_PROTO_INET || address->family == AVAHI_PROTO_INET6); + assert(address->proto == AVAHI_PROTO_INET || address->proto == AVAHI_PROTO_INET6); if (port == 0) return avahi_server_set_errno(s, AVAHI_ERR_INVALID_PORT); @@ -2072,7 +2072,7 @@ int avahi_server_add_dns_server_address( if (domain && !avahi_is_valid_domain_name(domain)) return avahi_server_set_errno(s, AVAHI_ERR_INVALID_DOMAIN_NAME); - if (address->family == AVAHI_PROTO_INET) { + if (address->proto == AVAHI_PROTO_INET) { hexstring(n+3, sizeof(n)-3, &address->data, 4); r = avahi_record_new_full(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_A, AVAHI_DEFAULT_TTL_HOST_NAME); r->data.a.address = address->data.ipv4; diff --git a/avahi-core/socket.c b/avahi-core/socket.c index b2d6e6f..91cbf40 100644 --- a/avahi-core/socket.c +++ b/avahi-core/socket.c @@ -397,7 +397,7 @@ int avahi_send_dns_packet_ipv4(int fd, int interface, AvahiDnsPacket *p, const A msg.msg_controllen = sizeof(cmsg_data); msg.msg_flags = 0; - return sendmsg_loop(fd, &msg, 0 /*MSG_DONTROUTE*/); + return sendmsg_loop(fd, &msg, 0); } int avahi_send_dns_packet_ipv6(int fd, int interface, AvahiDnsPacket *p, const AvahiIPv6Address *a, uint16_t port) { diff --git a/avahi-daemon/dbus-protocol.c b/avahi-daemon/dbus-protocol.c index 1e69916..d817038 100644 --- a/avahi-daemon/dbus-protocol.c +++ b/avahi-daemon/dbus-protocol.c @@ -877,7 +877,7 @@ static void sync_host_name_resolver_callback(AvahiSHostNameResolver *r, AvahiIfI i_interface = (int32_t) interface; i_protocol = (int32_t) protocol; - i_aprotocol = (int32_t) a->family; + i_aprotocol = (int32_t) a->proto; reply = dbus_message_new_method_return(i->message); dbus_message_append_args( @@ -917,7 +917,7 @@ static void sync_address_resolver_callback(AvahiSAddressResolver *r, AvahiIfInde i_interface = (int32_t) interface; i_protocol = (int32_t) protocol; - i_aprotocol = (int32_t) address->family; + i_aprotocol = (int32_t) address->proto; reply = dbus_message_new_method_return(i->message); dbus_message_append_args( @@ -1201,7 +1201,7 @@ static void sync_service_resolver_callback( i_interface = (int32_t) interface; i_protocol = (int32_t) protocol; - i_aprotocol = (int32_t) a->family; + i_aprotocol = (int32_t) a->proto; reply = dbus_message_new_method_return(i->message); dbus_message_append_args( @@ -1247,7 +1247,7 @@ static void async_address_resolver_callback(AvahiSAddressResolver *r, AvahiIfInd i_interface = (int32_t) interface; i_protocol = (int32_t) protocol; - i_aprotocol = (int32_t) address->family; + i_aprotocol = (int32_t) address->proto; reply = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_ADDRESS_RESOLVER, "Found"); dbus_message_append_args( @@ -1331,7 +1331,7 @@ static void async_host_name_resolver_callback(AvahiSHostNameResolver *r, AvahiIf i_interface = (int32_t) interface; i_protocol = (int32_t) protocol; - i_aprotocol = (int32_t) a->family; + i_aprotocol = (int32_t) a->proto; reply = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_HOST_NAME_RESOLVER, "Found"); dbus_message_append_args( @@ -1429,7 +1429,7 @@ static void async_service_resolver_callback( i_interface = (int32_t) interface; i_protocol = (int32_t) protocol; - i_aprotocol = (int32_t) a->family; + i_aprotocol = (int32_t) a->proto; reply = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_SERVICE_RESOLVER, "Found"); dbus_message_append_args( -- 2.39.2