]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: vxlan improve logging
authorSusant Sahani <susant@redhat.com>
Wed, 10 Jun 2015 06:25:54 +0000 (11:55 +0530)
committerSusant Sahani <susant@redhat.com>
Wed, 10 Jun 2015 06:32:48 +0000 (12:02 +0530)
Replaces a lof of strerror() usage with log_netdev_error_errno()

src/network/networkd-netdev-vxlan.c

index e2c2b108b9d08c8b7b00907f8de0fbc2790c0982..01a1e5089cec31e7d205408e4567c5053ca1fb51 100644 (file)
@@ -39,123 +39,67 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_
 
         if (v->id <= VXLAN_VID_MAX) {
                 r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_ID, v->id);
-                if (r < 0) {
-                        log_netdev_error(netdev,
-                                         "Could not append IFLA_VXLAN_ID attribute: %s",
-                                         strerror(-r));
-                        return r;
-                }
+                if (r < 0)
+                        return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_ID attribute: %m");
         }
 
         r = sd_rtnl_message_append_in_addr(m, IFLA_VXLAN_GROUP, &v->group.in);
-        if (r < 0) {
-                log_netdev_error(netdev,
-                                 "Could not append IFLA_VXLAN_GROUP attribute: %s",
-                                 strerror(-r));
-                return r;
-        }
+        if (r < 0)
+                return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_GROUP attribute: %m");
 
         r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_LINK, link->ifindex);
-        if (r < 0) {
-                log_netdev_error(netdev,
-                                 "Could not append IFLA_VXLAN_LINK attribute: %s",
-                                 strerror(-r));
-                return r;
-        }
+        if (r < 0)
+                return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LINK attribute: %m");
 
         if(v->ttl) {
                 r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_TTL, v->ttl);
-                if (r < 0) {
-                        log_netdev_error(netdev,
-                                         "Could not append IFLA_VXLAN_TTL attribute: %s",
-                                         strerror(-r));
-                        return r;
-                }
+                if (r < 0)
+                        return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_TTL attribute: %m");
         }
 
         if(v->tos) {
                 r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_TOS, v->tos);
-                if (r < 0) {
-                        log_netdev_error(netdev,
-                                         "Could not append IFLA_VXLAN_TOS attribute: %s",
-                                         strerror(-r));
-                        return r;
-                }
+                if (r < 0)
+                        return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_TOS attribute: %m");
         }
 
         r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_LEARNING, v->learning);
-        if (r < 0) {
-                log_netdev_error(netdev,
-                                 "Could not append IFLA_VXLAN_LEARNING attribute: %s",
-                                 strerror(-r));
-                return r;
-        }
+        if (r < 0)
+                return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LEARNING attribute: %m");
 
         r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_RSC, v->route_short_circuit);
-        if (r < 0) {
-                log_netdev_error(netdev,
-                                 "Could not append IFLA_VXLAN_RSC attribute: %s",
-                                 strerror(-r));
-                return r;
-        }
+        if (r < 0)
+                return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_RSC attribute: %m");
 
         r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_PROXY, v->arp_proxy);
-        if (r < 0) {
-                log_netdev_error(netdev,
-                                 "Could not append IFLA_VXLAN_PROXY attribute: %s",
-                                 strerror(-r));
-                return r;
-        }
+        if (r < 0)
+                return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_PROXY attribute: %m");
 
         r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_L2MISS, v->l2miss);
-        if (r < 0) {
-                log_netdev_error(netdev,
-                                 "Could not append IFLA_VXLAN_L2MISS attribute: %s",
-                                 strerror(-r));
-                return r;
-        }
+        if (r < 0)
+                return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_L2MISS attribute: %m");
 
         r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_L3MISS, v->l3miss);
-        if (r < 0) {
-                log_netdev_error(netdev,
-                                 "Could not append IFLA_VXLAN_L3MISS attribute: %s",
-                                 strerror(-r));
-                return r;
-        }
+        if (r < 0)
+                return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_L3MISS attribute: %m");
 
         if(v->fdb_ageing) {
                 r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_AGEING, v->fdb_ageing / USEC_PER_SEC);
-                if (r < 0) {
-                        log_netdev_error(netdev,
-                                         "Could not append IFLA_VXLAN_AGEING attribute: %s",
-                                         strerror(-r));
-                        return r;
-                }
+                if (r < 0)
+                        return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_AGEING attribute: %m");
         }
 
         r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_CSUM, v->udpcsum);
-        if (r < 0) {
-                log_netdev_error(netdev,
-                                 "Could not append IFLA_VXLAN_UDP_CSUM attribute: %s",
-                                 strerror(-r));
-                return r;
-        }
+        if (r < 0)
+                return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_UDP_CSUM attribute: %m");
 
         r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, v->udp6zerocsumtx);
-        if (r < 0) {
-                log_netdev_error(netdev,
-                                 "Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_TX attribute: %s",
-                                 strerror(-r));
-                return r;
-        }
+        if (r < 0)
+                return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_TX attribute: %m");
 
         r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, v->udp6zerocsumrx);
-        if (r < 0) {
-                log_netdev_error(netdev,
-                                 "Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_RX attribute: %s",
-                                 strerror(-r));
-                return r;
-        }
+        if (r < 0)
+                return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_RX attribute: %m");
 
         return r;
 }