/* Update the scope field for the address */
addr->global_scope = ifaddrmsg->ifa_scope == RT_SCOPE_UNIVERSE || ifaddrmsg->ifa_scope == RT_SCOPE_SITE;
+ addr->deprecated = !!(ifaddrmsg->ifa_flags & IFA_F_DEPRECATED);
} else {
AvahiInterfaceAddress *addr;
assert(n->nlmsg_type == RTM_DELADDR);
avahi_address_snprint(t, sizeof(t), &a->address);
if (avahi_s_entry_group_get_state(a->entry_group) == AVAHI_ENTRY_GROUP_REGISTERING &&
- m->server->state == AVAHI_SERVER_REGISTERING)
+ m->server->state == AVAHI_SERVER_REGISTERING)
avahi_server_decrease_host_rr_pending(m->server);
avahi_log_info("Withdrawing address record for %s on %s.", t, a->interface->hardware->name);
a->address = *addr;
a->prefix_len = prefix_len;
a->global_scope = 0;
+ a->deprecated = 0;
a->entry_group = NULL;
AVAHI_LLIST_PREPEND(AvahiInterfaceAddress, address, i->addresses, a);
AvahiInterfaceAddress *b;
assert(a);
- /* Publish public IP addresses */
- if (a->global_scope)
+ /* Publish public and non-deprecated IP addresses */
+ if (a->global_scope && !a->deprecated)
return 1;
- else {
-
- /* Publish link local IP addresses if they are the only ones on the link */
- for (b = a->interface->addresses; b; b = b->address_next) {
- if (b == a)
- continue;
- if (b->global_scope)
- return 0;
- }
+ /* Publish link-local and deprecated IP addresses only if they are
+ * the only ones on the link */
+ for (b = a->interface->addresses; b; b = b->address_next) {
+ if (b == a)
+ continue;
- return 1;
+ if (b->global_scope && !b->deprecated)
+ return 0;
}
- return 0;
+ return 1;
}
int avahi_interface_match(AvahiInterface *i, AvahiIfIndex idx, AvahiProtocol protocol) {