X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-core%2Fiface.c;h=f9c3103e4a3250676b7885cc5748fec06e8106f1;hb=e14682626f03c86aad4d71d5a8562715ebbb2927;hp=81b8375576fd7682b04209a788288c9f8fa21a09;hpb=8b5cd6ffd9137b14b7ed678f10a551e3911e4a40;p=catta diff --git a/avahi-core/iface.c b/avahi-core/iface.c index 81b8375..f9c3103 100644 --- a/avahi-core/iface.c +++ b/avahi-core/iface.c @@ -32,6 +32,7 @@ #include #include +#include #include #include "iface.h" @@ -344,7 +345,7 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat AvahiHwInterface *hw; struct rtattr *a = NULL; size_t l; - + if (ifinfomsg->ifi_family != AF_UNSPEC) return; @@ -507,7 +508,7 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat m->list = LIST_ADDR; } else { m->list = LIST_DONE; - avahi_log_debug("Enumeration complete"); + avahi_log_debug("Network interface enumeration completed"); } } else if (n->nlmsg_type == NLMSG_ERROR && (n->nlmsg_seq == m->query_link_seq || n->nlmsg_seq == m->query_addr_seq)) { @@ -822,3 +823,21 @@ int avahi_interface_address_on_link(AvahiInterface *i, const AvahiAddress *a) { return 0; } + +int avahi_interface_has_address(AvahiInterfaceMonitor *m, AvahiIfIndex iface, const AvahiAddress *a) { + AvahiInterface *i; + AvahiInterfaceAddress *j; + + assert(m); + assert(iface != AVAHI_IF_UNSPEC); + assert(a); + + if (!(i = avahi_interface_monitor_get_interface(m, iface, a->family))) + return 0; + + for (j = i->addresses; j; j = j->address_next) + if (avahi_address_cmp(a, &j->address) == 0) + return 1; + + return 0; +}