[systemd-commits] 2 commits - src/network

Tom Gundersen tomegun at kemper.freedesktop.org
Thu Aug 14 05:15:22 PDT 2014


 src/network/networkd-link.c |   36 +++++++++++++++++++++++++++---------
 1 file changed, 27 insertions(+), 9 deletions(-)

New commits:
commit 9fdaa9925e1919b766fe1e095228fe663c583923
Author: Tom Gundersen <teg at jklm.no>
Date:   Thu Aug 14 14:13:36 2014 +0200

    networkd: link - don't enter LINK_CONFIGURED more than once

diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index d929a80..160f507 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -380,7 +380,8 @@ void link_client_handler(Link *link) {
                 if (!link->dhcp4_configured)
                         return;
 
-        link_enter_configured(link);
+        if (link->state != LINK_STATE_CONFIGURED)
+                link_enter_configured(link);
 
         return;
 }

commit c6d3b3034acf1faec43b1281d3c7b94c23eb69d1
Author: Tom Gundersen <teg at jklm.no>
Date:   Thu Aug 14 14:01:11 2014 +0200

    networkd: link - print address lifetime for tracked addresses
    
    This should help in debugging issues with DHCP lease renewal.

diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 908d834..d929a80 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1336,6 +1336,8 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message,
         _cleanup_address_free_ Address *address = NULL;
         Address *ad;
         char buf[INET6_ADDRSTRLEN];
+        char valid_buf[FORMAT_TIMESPAN_MAX];
+        const char *valid_str = NULL;
         bool address_dropped = false;
         int r, ifindex;
 
@@ -1419,6 +1421,17 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message,
                 return 0;
         }
 
+        r = sd_rtnl_message_read_cache_info(message, IFA_CACHEINFO,
+                                            &address->cinfo);
+        if (r >= 0) {
+                if (address->cinfo.ifa_valid == CACHE_INFO_INFINITY_LIFE_TIME)
+                        valid_str = "ever";
+                else
+                        valid_str = format_timespan(valid_buf, FORMAT_TIMESPAN_MAX,
+                                                    address->cinfo.ifa_valid * USEC_PER_SEC,
+                                                    USEC_PER_SEC);
+        }
+
         LIST_FOREACH(addresses, ad, link->addresses) {
                 if (address_equal(ad, address)) {
                         LIST_REMOVE(addresses, link->addresses, ad);
@@ -1434,11 +1447,13 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message,
         switch (type) {
         case RTM_NEWADDR:
                 if (!address_dropped)
-                        log_debug_link(link, "added address: %s/%u", buf,
-                                       address->prefixlen);
+                        log_debug_link(link, "added address: %s/%u (valid for %s)",
+                                       buf, address->prefixlen,
+                                       strna(valid_str));
                 else
-                        log_debug_link(link, "updated address: %s/%u", buf,
-                                       address->prefixlen);
+                        log_debug_link(link, "updated address: %s/%u (valid for %s)",
+                                       buf, address->prefixlen,
+                                       strna(valid_str));
 
                 LIST_PREPEND(addresses, link->addresses, address);
                 address = NULL;
@@ -1448,14 +1463,16 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message,
                 break;
         case RTM_DELADDR:
                 if (address_dropped) {
-                        log_debug_link(link, "removed address: %s/%u", buf,
-                                       address->prefixlen);
+                        log_debug_link(link, "removed address: %s/%u (valid for %s)",
+                                       buf, address->prefixlen,
+                                       strna(valid_str));
 
                         link_save(link);
                 } else
                         log_warning_link(link,
-                                         "removing non-existent address: %s/%u",
-                                         buf, address->prefixlen);
+                                         "removing non-existent address: %s/%u (valid for %s)",
+                                         buf, address->prefixlen,
+                                         strna(valid_str));
 
                 break;
         default:



More information about the systemd-commits mailing list