summaryrefslogtreecommitdiffstats
path: root/avahi-core
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-06-28 22:02:20 +0200
committerLennart Poettering <lennart@poettering.net>2010-06-28 22:02:27 +0200
commit1fbf43bbd92a7ac7c07de6253f7a2efcc9a93c47 (patch)
treef6d2eadb98157d9b9fe2e1c233700fcc72e80168 /avahi-core
parente31663c4a2fb2f8bf22efc237c3092242cc9bac2 (diff)
iface: check for IFA_F_DEPRECATED
http://avahi.org/ticket/211
Diffstat (limited to 'avahi-core')
-rw-r--r--avahi-core/iface-linux.c1
-rw-r--r--avahi-core/iface.c26
-rw-r--r--avahi-core/iface.h1
3 files changed, 14 insertions, 14 deletions
diff --git a/avahi-core/iface-linux.c b/avahi-core/iface-linux.c
index 2782697..a1b7f73 100644
--- a/avahi-core/iface-linux.c
+++ b/avahi-core/iface-linux.c
@@ -238,6 +238,7 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
/* 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);
diff --git a/avahi-core/iface.c b/avahi-core/iface.c
index 0736df4..095580c 100644
--- a/avahi-core/iface.c
+++ b/avahi-core/iface.c
@@ -91,7 +91,7 @@ void avahi_interface_address_update_rrs(AvahiInterfaceAddress *a, int remove_rrs
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);
@@ -413,6 +413,7 @@ AvahiInterfaceAddress *avahi_interface_address_new(AvahiInterfaceMonitor *m, Ava
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);
@@ -670,24 +671,21 @@ int avahi_interface_address_is_relevant(AvahiInterfaceAddress *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) {
diff --git a/avahi-core/iface.h b/avahi-core/iface.h
index 466c16a..b38578c 100644
--- a/avahi-core/iface.h
+++ b/avahi-core/iface.h
@@ -123,6 +123,7 @@ struct AvahiInterfaceAddress {
unsigned prefix_len;
int global_scope;
+ int deprecated;
AvahiSEntryGroup *entry_group;
};