From f0a05209f9227d310614f56670e337b6e18ccc78 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 15 Jun 2025 10:13:25 +0900 Subject: [PATCH] network: also include information about LLDP sender in reply for Describe() method Addresses https://github.com/systemd/systemd/pull/37845#issuecomment-2973257825. --- src/network/networkd-json.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/network/networkd-json.c b/src/network/networkd-json.c index d07227d2882..b6b4b02c06f 100644 --- a/src/network/networkd-json.c +++ b/src/network/networkd-json.c @@ -1404,6 +1404,23 @@ static int dhcp_client_append_json(Link *link, sd_json_variant **v) { return json_variant_set_field_non_null(v, "DHCPv4Client", w); } +static int lldp_tx_append_json(Link *link, sd_json_variant **v) { + _cleanup_(sd_json_variant_unrefp) sd_json_variant *w = NULL; + int r; + + assert(link); + assert(v); + + if (!link->lldp_tx) + return 0; + + r = sd_lldp_tx_describe(link->lldp_tx, &w); + if (r < 0) + return r; + + return json_variant_set_field_non_null(v, "LLDP", w); +} + int link_build_json(Link *link, sd_json_variant **ret) { _cleanup_(sd_json_variant_unrefp) sd_json_variant *v = NULL; _cleanup_free_ char *type = NULL, *flags = NULL; @@ -1540,6 +1557,10 @@ int link_build_json(Link *link, sd_json_variant **ret) { if (r < 0) return r; + r = lldp_tx_append_json(link, &v); + if (r < 0) + return r; + *ret = TAKE_PTR(v); return 0; } -- 2.47.3