summaryrefslogtreecommitdiffstats
path: root/src/libsystemd
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-16 18:27:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-16 18:27:56 +0000
commit26fde72265073b26498ce55596c0eda1bc3113b4 (patch)
tree580247f9ae59f3bb05e3b9ee52eb4fe51b63887b /src/libsystemd
parentAdding upstream version 256.5. (diff)
downloadsystemd-26fde72265073b26498ce55596c0eda1bc3113b4.tar.xz
systemd-26fde72265073b26498ce55596c0eda1bc3113b4.zip
Adding upstream version 256.6.upstream/256.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-netlink/test-netlink.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/libsystemd/sd-netlink/test-netlink.c b/src/libsystemd/sd-netlink/test-netlink.c
index cf19c48..c58cfc0 100644
--- a/src/libsystemd/sd-netlink/test-netlink.c
+++ b/src/libsystemd/sd-netlink/test-netlink.c
@@ -92,18 +92,24 @@ TEST(message_address) {
struct in_addr in_data;
struct ifa_cacheinfo cache;
const char *label;
+ int r;
assert_se(sd_netlink_open(&rtnl) >= 0);
ifindex = (int) if_nametoindex("lo");
assert_se(sd_rtnl_message_new_addr(rtnl, &message, RTM_GETADDR, ifindex, AF_INET) >= 0);
assert_se(sd_netlink_message_set_request_dump(message, true) >= 0);
- assert_se(sd_netlink_call(rtnl, message, 0, &reply) == 1);
- assert_se(sd_netlink_message_read_in_addr(reply, IFA_LOCAL, &in_data) >= 0);
- assert_se(sd_netlink_message_read_in_addr(reply, IFA_ADDRESS, &in_data) >= 0);
- assert_se(sd_netlink_message_read_string(reply, IFA_LABEL, &label) >= 0);
- assert_se(sd_netlink_message_read_cache_info(reply, IFA_CACHEINFO, &cache) == 0);
+ r = sd_netlink_call(rtnl, message, 0, &reply);
+ assert_se(r >= 0);
+
+ /* If the loopback device is down we won't get any results. */
+ if (r > 0) {
+ assert_se(sd_netlink_message_read_in_addr(reply, IFA_LOCAL, &in_data) >= 0);
+ assert_se(sd_netlink_message_read_in_addr(reply, IFA_ADDRESS, &in_data) >= 0);
+ assert_se(sd_netlink_message_read_string(reply, IFA_LABEL, &label) >= 0);
+ assert_se(sd_netlink_message_read_cache_info(reply, IFA_CACHEINFO, &cache) == 0);
+ }
}
TEST(message_route) {