resolve: introduce io.systemd.Resolve.Monitor.ResetServerFeatures
Add varlink version of ResetServerFeatures. Add this to io.systemd.Resolve.Monitor, since that interface already handles many manager related things.
This commit is contained in:
@@ -1394,6 +1394,20 @@ static int vl_method_flush_caches(sd_varlink *link, sd_json_variant *parameters,
|
||||
return sd_varlink_reply(link, NULL);
|
||||
}
|
||||
|
||||
static int vl_method_reset_server_features(sd_varlink *link, sd_json_variant *parameters, sd_varlink_method_flags_t flags, void *userdata) {
|
||||
Manager *m = ASSERT_PTR(sd_varlink_get_userdata(ASSERT_PTR(link)));
|
||||
int r;
|
||||
|
||||
r = verify_polkit(link, parameters, "org.freedesktop.resolve1.reset-server-features");
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
(void) dns_stream_disconnect_all(m);
|
||||
manager_reset_server_features(m);
|
||||
|
||||
return sd_varlink_reply(link, NULL);
|
||||
}
|
||||
|
||||
static int vl_method_subscribe_dns_configuration(sd_varlink *link, sd_json_variant *parameters, sd_varlink_method_flags_t flags, void *userdata) {
|
||||
Manager *m = ASSERT_PTR(sd_varlink_get_userdata(ASSERT_PTR(link)));
|
||||
int r;
|
||||
@@ -1478,7 +1492,8 @@ static int varlink_monitor_server_init(Manager *m) {
|
||||
"io.systemd.Resolve.Monitor.DumpStatistics", vl_method_dump_statistics,
|
||||
"io.systemd.Resolve.Monitor.ResetStatistics", vl_method_reset_statistics,
|
||||
"io.systemd.Resolve.Monitor.SubscribeDNSConfiguration", vl_method_subscribe_dns_configuration,
|
||||
"io.systemd.Resolve.Monitor.FlushCaches", vl_method_flush_caches);
|
||||
"io.systemd.Resolve.Monitor.FlushCaches", vl_method_flush_caches,
|
||||
"io.systemd.Resolve.Monitor.ResetServerFeatures", vl_method_reset_server_features);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to register varlink methods: %m");
|
||||
|
||||
|
||||
@@ -137,6 +137,10 @@ static SD_VARLINK_DEFINE_METHOD(
|
||||
FlushCaches,
|
||||
VARLINK_DEFINE_POLKIT_INPUT);
|
||||
|
||||
static SD_VARLINK_DEFINE_METHOD(
|
||||
ResetServerFeatures,
|
||||
VARLINK_DEFINE_POLKIT_INPUT);
|
||||
|
||||
SD_VARLINK_DEFINE_INTERFACE(
|
||||
io_systemd_Resolve_Monitor,
|
||||
"io.systemd.Resolve.Monitor",
|
||||
@@ -170,4 +174,6 @@ SD_VARLINK_DEFINE_INTERFACE(
|
||||
SD_VARLINK_SYMBOL_COMMENT("Sends the complete global and per-link DNS configurations when any changes are made to them. The current configurations are given immediately when this method is invoked."),
|
||||
&vl_method_SubscribeDNSConfiguration,
|
||||
SD_VARLINK_SYMBOL_COMMENT("Flushes all DNS resource record caches the service maintains locally."),
|
||||
&vl_method_FlushCaches);
|
||||
&vl_method_FlushCaches,
|
||||
SD_VARLINK_SYMBOL_COMMENT("Flushes all feature level information the resolver learnt about specific servers, and ensures that the server feature probing logic is started from the beginning with the next look-up request."),
|
||||
&vl_method_ResetServerFeatures);
|
||||
|
||||
Reference in New Issue
Block a user