mirror of
https://github.com/systemd/systemd.git
synced 2025-03-08 08:58:27 +03:00
Merge pull request #31880 from yuwata/network-varlink-trivial-cleanups
network: trivial varlink cleanups
This commit is contained in:
commit
ec0bc263d7
@ -93,7 +93,7 @@ JsonFormatFlags arg_json_format_flags = JSON_FORMAT_OFF;
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_drop_in, freep);
|
||||
|
||||
static int varlink_connect_networkd(Varlink **ret_varlink) {
|
||||
_cleanup_(varlink_unrefp) Varlink *vl = NULL;
|
||||
_cleanup_(varlink_flush_close_unrefp) Varlink *vl = NULL;
|
||||
JsonVariant *reply;
|
||||
uint64_t id;
|
||||
int r;
|
||||
@ -102,6 +102,8 @@ static int varlink_connect_networkd(Varlink **ret_varlink) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to connect to network service /run/systemd/netif/io.systemd.Network: %m");
|
||||
|
||||
(void) varlink_set_description(vl, "varlink-network");
|
||||
|
||||
r = varlink_set_allow_fd_passing_output(vl, true);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to allow passing file descriptor through varlink: %m");
|
||||
@ -2431,7 +2433,7 @@ static int link_status(int argc, char *argv[], void *userdata) {
|
||||
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
|
||||
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
|
||||
_cleanup_(sd_hwdb_unrefp) sd_hwdb *hwdb = NULL;
|
||||
_cleanup_(varlink_unrefp) Varlink *vl = NULL;
|
||||
_cleanup_(varlink_flush_close_unrefp) Varlink *vl = NULL;
|
||||
_cleanup_(link_info_array_freep) LinkInfo *links = NULL;
|
||||
int r, c;
|
||||
|
||||
@ -2593,7 +2595,7 @@ static int dump_lldp_neighbors_json(JsonVariant *reply, char * const *patterns)
|
||||
}
|
||||
|
||||
static int link_lldp_status(int argc, char *argv[], void *userdata) {
|
||||
_cleanup_(varlink_unrefp) Varlink *vl = NULL;
|
||||
_cleanup_(varlink_flush_close_unrefp) Varlink *vl = NULL;
|
||||
_cleanup_(table_unrefp) Table *table = NULL;
|
||||
JsonVariant *reply;
|
||||
uint64_t all = 0;
|
||||
@ -2934,7 +2936,7 @@ static int verb_reconfigure(int argc, char *argv[], void *userdata) {
|
||||
}
|
||||
|
||||
static int verb_persistent_storage(int argc, char *argv[], void *userdata) {
|
||||
_cleanup_(varlink_unrefp) Varlink *vl = NULL;
|
||||
_cleanup_(varlink_flush_close_unrefp) Varlink *vl = NULL;
|
||||
bool ready;
|
||||
int r;
|
||||
|
||||
|
@ -275,6 +275,8 @@ int manager_connect_varlink(Manager *m) {
|
||||
|
||||
varlink_server_set_userdata(s, m);
|
||||
|
||||
(void) varlink_server_set_description(s, "varlink-api-network");
|
||||
|
||||
r = varlink_server_add_interface(s, &vl_interface_io_systemd_Network);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to add Network interface to varlink server: %m");
|
||||
|
@ -3377,7 +3377,7 @@ int varlink_server_add_connection(VarlinkServer *server, int fd, Varlink **ret)
|
||||
}
|
||||
|
||||
_cleanup_free_ char *desc = NULL;
|
||||
if (asprintf(&desc, "%s-%i", server->description ?: "varlink", v->fd) >= 0)
|
||||
if (asprintf(&desc, "%s-%i", varlink_server_description(server), v->fd) >= 0)
|
||||
v->description = TAKE_PTR(desc);
|
||||
|
||||
/* Link up the server and the connection, and take reference in both directions. Note that the
|
||||
|
Loading…
x
Reference in New Issue
Block a user