]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: address - introduce address_is_ready() 1530/head
authorTom Gundersen <teg@jklm.no>
Mon, 28 Sep 2015 11:30:10 +0000 (13:30 +0200)
committerTom Gundersen <teg@jklm.no>
Sun, 11 Oct 2015 13:04:16 +0000 (15:04 +0200)
Checks that a given address is not tentative nor deprecated.

src/network/networkd-address.c
src/network/networkd-address.h
src/network/networkd-link.c

index 48715972b6e18b7c2092a4445973a60cb5e4a705..316ae2e4cb2d013177552a624810c2a738e2a8e3 100644 (file)
@@ -738,3 +738,9 @@ int config_parse_label(const char *unit,
 
         return 0;
 }
+
+bool address_is_ready(const Address *a) {
+        assert(a);
+
+        return !(a->flags & (IFA_F_TENTATIVE | IFA_F_DEPRECATED));
+}
index 22ac5e95c1b7c5643b193589a41f356ad966eb9e..425344fe48e0cd9b62be1853ea4c164173b603a2 100644 (file)
@@ -67,6 +67,7 @@ int address_configure(Address *address, Link *link, sd_netlink_message_handler_t
 int address_update(Address *address, Link *link, sd_netlink_message_handler_t callback);
 int address_remove(Address *address, Link *link, sd_netlink_message_handler_t callback);
 bool address_equal(Address *a1, Address *a2);
+bool address_is_ready(const Address *a);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(Address*, address_free);
 #define _cleanup_address_free_ _cleanup_(address_freep)
index 78853c8cca929fa110528ae62763252a5119ca3d..755d9c919d01fc000497b9b33d34ee011644b08f 100644 (file)
@@ -2275,7 +2275,7 @@ static void link_update_operstate(Link *link) {
 
                 /* if we have carrier, check what addresses we have */
                 SET_FOREACH(address, link->addresses, i) {
-                        if (address->flags & (IFA_F_TENTATIVE | IFA_F_DEPRECATED))
+                        if (!address_is_ready(address))
                                 continue;
 
                         if (address->scope < scope)