[systemd-commits] 3 commits - src/libsystemd src/network src/udev

Tom Gundersen tomegun at kemper.freedesktop.org
Sun Apr 20 05:45:18 PDT 2014


 src/libsystemd/sd-rtnl/sd-rtnl.c |   12 +++++++++---
 src/network/networkd-link.c      |    5 +++--
 src/udev/net/link-config.c       |   18 +-----------------
 3 files changed, 13 insertions(+), 22 deletions(-)

New commits:
commit 069e10a0e0c628875386002778750307ee353bee
Author: Tom Gundersen <teg at jklm.no>
Date:   Sun Apr 20 12:59:24 2014 +0200

    networkd: link - make debug logging a bit more readable
    
    Drop leading zeros which will never be used when printing the link flags.

diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index aad72de..39f2a59 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1095,12 +1095,13 @@ static int link_update_flags(Link *link, unsigned flags) {
         else if (flags_removed & IFF_RUNNING)
                 log_debug_link(link, "link is not running");
 
+        /* link flags are currently at most 18 bits, let's default to printing 20 */
         if (flags_added & generic_flags)
-                log_debug_link(link, "ignored link flags gained: %#.8x",
+                log_debug_link(link, "unknown link flags gained: %#.5x (ignoring)",
                                flags_added & generic_flags);
 
         if (flags_removed & generic_flags)
-                log_debug_link(link, "ignored link flags lost: %#.8x",
+                log_debug_link(link, "unknown link flags lost: %#.5x (ignoring)",
                                 flags_removed & generic_flags);
 
         if (carrier_gained) {

commit 92d927f850d4b668b44f3e5f41e266d934d03726
Author: Tom Gundersen <teg at jklm.no>
Date:   Sun Apr 20 07:53:16 2014 +0200

    udev: link-config - treat any non-random mac address as persistent
    
    The address may be already changed by other processes, or set
    when creating the netdev from userspace.

diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
index 345a380..7be4d24 100644
--- a/src/udev/net/link-config.c
+++ b/src/udev/net/link-config.c
@@ -278,22 +278,6 @@ static bool mac_is_random(struct udev_device *device) {
         return type == 1;
 }
 
-static bool mac_is_permanent(struct udev_device *device) {
-        const char *s;
-        unsigned type;
-        int r;
-
-        s = udev_device_get_sysattr_value(device, "addr_assign_type");
-        if (!s)
-                return true; /* if we don't know, assume it is permanent */
-        r = safe_atou(s, &type);
-        if (r < 0)
-                return true;
-
-        /* check for NET_ADDR_PERM */
-        return type == 0;
-}
-
 static int get_mac(struct udev_device *device, bool want_random, struct ether_addr *mac) {
         int r;
 
@@ -389,7 +373,7 @@ int link_config_apply(link_config_ctx *ctx, link_config *config, struct udev_dev
 
         switch (config->mac_policy) {
                 case MACPOLICY_PERSISTENT:
-                        if (!mac_is_permanent(device)) {
+                        if (mac_is_random(device)) {
                                 r = get_mac(device, false, &generated_mac);
                                 if (r < 0)
                                         return r;

commit 6190b9f9d2574428d560458a99f2838041cfdaac
Author: Tom Gundersen <teg at jklm.no>
Date:   Sun Apr 20 07:51:28 2014 +0200

    sd-rtnl: log when queues are exhausted

diff --git a/src/libsystemd/sd-rtnl/sd-rtnl.c b/src/libsystemd/sd-rtnl/sd-rtnl.c
index 8650f55..543bad9 100644
--- a/src/libsystemd/sd-rtnl/sd-rtnl.c
+++ b/src/libsystemd/sd-rtnl/sd-rtnl.c
@@ -203,8 +203,10 @@ int sd_rtnl_send(sd_rtnl *nl,
                 }
         } else {
                 /* append to queue */
-                if (nl->wqueue_size >= RTNL_WQUEUE_MAX)
+                if (nl->wqueue_size >= RTNL_WQUEUE_MAX) {
+                        log_debug("rtnl: exhausted the write queue size (%d)", RTNL_WQUEUE_MAX);
                         return -ENOBUFS;
+                }
 
                 if (!GREEDY_REALLOC(nl->wqueue, nl->wqueue_allocated, nl->wqueue_size + 1))
                         return -ENOMEM;
@@ -221,8 +223,10 @@ int sd_rtnl_send(sd_rtnl *nl,
 int rtnl_rqueue_make_room(sd_rtnl *rtnl) {
         assert(rtnl);
 
-        if (rtnl->rqueue_size >= RTNL_RQUEUE_MAX)
+        if (rtnl->rqueue_size >= RTNL_RQUEUE_MAX) {
+                log_debug("rtnl: exhausted the read queue size (%d)", RTNL_RQUEUE_MAX);
                 return -ENOBUFS;
+        }
 
         if (!GREEDY_REALLOC(rtnl->rqueue, rtnl->rqueue_allocated, rtnl->rqueue_size + 1))
                 return -ENOMEM;
@@ -233,8 +237,10 @@ int rtnl_rqueue_make_room(sd_rtnl *rtnl) {
 int rtnl_rqueue_partial_make_room(sd_rtnl *rtnl) {
         assert(rtnl);
 
-        if (rtnl->rqueue_partial_size >= RTNL_RQUEUE_MAX)
+        if (rtnl->rqueue_partial_size >= RTNL_RQUEUE_MAX) {
+                log_debug("rtnl: exhausted the partial read queue size (%d)", RTNL_RQUEUE_MAX);
                 return -ENOBUFS;
+        }
 
         if (!GREEDY_REALLOC(rtnl->rqueue_partial, rtnl->rqueue_partial_allocated,
                             rtnl->rqueue_partial_size + 1))



More information about the systemd-commits mailing list