diff --git a/src/libsystemd/sd-bus/bus-common-errors.c b/src/libsystemd/sd-bus/bus-common-errors.c index 4e23edd9232..9ab3286cc93 100644 --- a/src/libsystemd/sd-bus/bus-common-errors.c +++ b/src/libsystemd/sd-bus/bus-common-errors.c @@ -102,7 +102,6 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_common_errors[] = { SD_BUS_ERROR_MAP(BUS_ERROR_NO_PRODUCT_UUID, EOPNOTSUPP), - SD_BUS_ERROR_MAP(BUS_ERROR_SPEED_METER_INACTIVE, EOPNOTSUPP), SD_BUS_ERROR_MAP(BUS_ERROR_UNMANAGED_INTERFACE, EOPNOTSUPP), SD_BUS_ERROR_MAP_END diff --git a/src/libsystemd/sd-bus/bus-common-errors.h b/src/libsystemd/sd-bus/bus-common-errors.h index 8da56551f69..106bc159a6e 100644 --- a/src/libsystemd/sd-bus/bus-common-errors.h +++ b/src/libsystemd/sd-bus/bus-common-errors.h @@ -81,7 +81,6 @@ #define BUS_ERROR_NO_PRODUCT_UUID "org.freedesktop.hostname1.NoProductUUID" -#define BUS_ERROR_SPEED_METER_INACTIVE "org.freedesktop.network1.SpeedMeterInactive" #define BUS_ERROR_UNMANAGED_INTERFACE "org.freedesktop.network1.UnmanagedInterface" BUS_ERROR_MAP_ELF_USE(bus_common_errors); diff --git a/src/network/networkctl.c b/src/network/networkctl.c index 5d94167e3a1..78035a84308 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -349,8 +349,7 @@ static int acquire_link_bitrates(sd_bus *bus, LinkInfo *link) { "org.freedesktop.network1.Link", "BitRates"); if (r < 0) { - bool quiet = sd_bus_error_has_name(&error, SD_BUS_ERROR_UNKNOWN_PROPERTY) || - sd_bus_error_has_name(&error, BUS_ERROR_SPEED_METER_INACTIVE); + bool quiet = sd_bus_error_has_name(&error, SD_BUS_ERROR_UNKNOWN_PROPERTY); return log_full_errno(quiet ? LOG_DEBUG : LOG_WARNING, r, "Failed to query link bit rates: %s", bus_error_message(&error, r)); @@ -368,7 +367,7 @@ static int acquire_link_bitrates(sd_bus *bus, LinkInfo *link) { if (r < 0) return bus_log_parse_error(r); - link->has_bitrates = true; + link->has_bitrates = link->tx_bitrate != UINT64_MAX && link->rx_bitrate != UINT64_MAX; return 0; } diff --git a/src/network/networkd-link-bus.c b/src/network/networkd-link-bus.c index b0abc0a2169..356ceaf0630 100644 --- a/src/network/networkd-link-bus.c +++ b/src/network/networkd-link-bus.c @@ -41,14 +41,10 @@ static int property_get_bit_rates( manager = link->manager; - if (!manager->use_speed_meter) - return sd_bus_error_set(error, BUS_ERROR_SPEED_METER_INACTIVE, "Speed meter is disabled."); - - if (manager->speed_meter_usec_old == 0) - return sd_bus_error_set(error, BUS_ERROR_SPEED_METER_INACTIVE, "Speed meter is not active."); - - if (!link->stats_updated) - return sd_bus_error_set(error, BUS_ERROR_SPEED_METER_INACTIVE, "Failed to measure bit-rates."); + if (!manager->use_speed_meter || + manager->speed_meter_usec_old == 0 || + !link->stats_updated) + return sd_bus_message_append(reply, "(tt)", UINT64_MAX, UINT64_MAX); assert(manager->speed_meter_usec_new > manager->speed_meter_usec_old); interval_sec = (manager->speed_meter_usec_new - manager->speed_meter_usec_old) / USEC_PER_SEC;