The D-Bus counterparts (bus_link_method_renew, bus_link_method_force_renew)
reject calls on unmanaged interfaces with BUS_ERROR_UNMANAGED_INTERFACE,
but the Varlink methods silently succeed. Add the same guard to both
Varlink methods, returning io.systemd.Network.Link.InterfaceUnmanaged,
and declare the error in the IDL.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
#include <linux/if_tunnel.h>
-#include "sd-netlink.h"
#include "sd-json.h"
+#include "sd-netlink.h"
#include "alloc-util.h"
#include "device-util.h"
if (r != 0)
return r;
+ if (!link->network)
+ return sd_varlink_error(vlink, "io.systemd.Network.Link.InterfaceUnmanaged", NULL);
+
r = varlink_verify_polkit_async(
vlink,
manager->bus,
if (r != 0)
return r;
+ if (!link->network)
+ return sd_varlink_error(vlink, "io.systemd.Network.Link.InterfaceUnmanaged", NULL);
+
r = varlink_verify_polkit_async(
vlink,
manager->bus,
VARLINK_NETWORK_INTERFACE_INPUTS,
VARLINK_DEFINE_POLKIT_INPUT);
+static SD_VARLINK_DEFINE_ERROR(InterfaceUnmanaged);
+
SD_VARLINK_DEFINE_INTERFACE(
io_systemd_Network_Link,
"io.systemd.Network.Link",
&vl_method_Reconfigure,
SD_VARLINK_SYMBOL_COMMENT("Describe the specified link by index or name."),
&vl_method_Describe,
+ SD_VARLINK_SYMBOL_COMMENT("The specified interface is not managed by systemd-networkd."),
+ &vl_error_InterfaceUnmanaged,
&vl_type_Address,
&vl_type_BitRates,
&vl_type_DHCPLease,