2020-12-23 22:21:36 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2019-09-25 13:13:40 +02:00
|
|
|
/*
|
2019-10-01 09:20:35 +02:00
|
|
|
* Copyright (C) 2016 Atul Anand <atulhjp@gmail.com>.
|
|
|
|
|
* Copyright (C) 2016 - 2017 Red Hat, Inc.
|
2016-08-16 05:55:57 +05:30
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef __NETWORKMANAGER_PACRUNNER_MANAGER_H__
|
|
|
|
|
#define __NETWORKMANAGER_PACRUNNER_MANAGER_H__
|
|
|
|
|
|
2016-10-04 12:13:16 +02:00
|
|
|
#define NM_TYPE_PACRUNNER_MANAGER (nm_pacrunner_manager_get_type())
|
|
|
|
|
#define NM_PACRUNNER_MANAGER(obj) \
|
2022-12-14 16:21:48 +01:00
|
|
|
(_NM_G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_PACRUNNER_MANAGER, NMPacrunnerManager))
|
2016-10-04 12:13:16 +02:00
|
|
|
#define NM_PACRUNNER_MANAGER_CLASS(klass) \
|
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_PACRUNNER_MANAGER, NMPacrunnerManagerClass))
|
2016-08-16 05:55:57 +05:30
|
|
|
#define NM_IS_PACRUNNER_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_PACRUNNER_MANAGER))
|
|
|
|
|
#define NM_IS_PACRUNNER_MANAGER_CLASS(klass) \
|
|
|
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_PACRUNNER_MANAGER))
|
2016-10-04 12:13:16 +02:00
|
|
|
#define NM_PACRUNNER_MANAGER_GET_CLASS(obj) \
|
|
|
|
|
(G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_PACRUNNER_MANAGER, NMPacrunnerManagerClass))
|
2016-08-16 05:55:57 +05:30
|
|
|
|
2016-10-04 12:13:16 +02:00
|
|
|
typedef struct _NMPacrunnerManagerClass NMPacrunnerManagerClass;
|
2016-08-16 05:55:57 +05:30
|
|
|
|
pacrunner: refactor pacrunner to use GDBusConnection
- use GDBusConnection instead of GDBusProxy.
- rename "call-id" to "conf-id". It's really not a "call" but
configuration that gets added and NMPacrunnerManager ensures that
the configuration is send to pacrunner.
- let "conf-id" keep a reference to NMPacrunnerManager. For one,
when we remove configurations we need to call DestroyProxyConfiguration
to remove it again. We cannot just abort the requests but must linger
around until our configuration is properly cleaned up. Hence, we
anyway cannot destroy the NMPacrunnerManager earlier.
With respect to fixing shutdown not to leak anything, this merely
means that we must wait (and iterate the main loop) as long as
NMPacrunnerManager singleton still exits (that is anyway the plan
how to fix shutdown).
With these considerations it's also clear that our D-Bus calls must
have a stricter timeout: NM_SHUTDOWN_TIMEOUT_MS.
This is also nice because nm_pacrunner_manager_remove() no longer
needs a manager parameter, it can just rely on having a reference
to the manager.
- for logging the configuration IDs, don't log pointer values.
Logging pointer values should be avoided as it defeats ASLR.
Instead, give them a "log_id" number.
- pacrunner is a D-Bus activatable service. D-Bus activatable services
needs special care. We don't want to start it over and over again.
Instead, we only try to "StartServiceByName" if
- we have any configuration to add
- if pacrunner is currently confirmed not to be running (by watching
name owner changes)
- we didn't try to start it already. That means, only start it
at the beginning and afterwards set a flag to block it. When
we see pacrunner appear on D-Bus we always clear that flag,
that means if pacrunner drops of, we will try to restart it
(once).
2019-05-05 09:51:09 +02:00
|
|
|
typedef struct _NMPacrunnerConfId NMPacrunnerConfId;
|
2017-04-21 15:46:56 +02:00
|
|
|
|
2016-10-04 12:13:16 +02:00
|
|
|
GType nm_pacrunner_manager_get_type(void);
|
2016-08-16 05:55:57 +05:30
|
|
|
|
2016-10-04 12:13:16 +02:00
|
|
|
NMPacrunnerManager *nm_pacrunner_manager_get(void);
|
2016-08-16 05:55:57 +05:30
|
|
|
|
2021-08-06 15:17:05 +02:00
|
|
|
NMPacrunnerConfId *
|
|
|
|
|
nm_pacrunner_manager_add(NMPacrunnerManager *self, const char *iface, const NML3ConfigData *l3cd);
|
2017-04-21 15:46:56 +02:00
|
|
|
|
pacrunner: refactor pacrunner to use GDBusConnection
- use GDBusConnection instead of GDBusProxy.
- rename "call-id" to "conf-id". It's really not a "call" but
configuration that gets added and NMPacrunnerManager ensures that
the configuration is send to pacrunner.
- let "conf-id" keep a reference to NMPacrunnerManager. For one,
when we remove configurations we need to call DestroyProxyConfiguration
to remove it again. We cannot just abort the requests but must linger
around until our configuration is properly cleaned up. Hence, we
anyway cannot destroy the NMPacrunnerManager earlier.
With respect to fixing shutdown not to leak anything, this merely
means that we must wait (and iterate the main loop) as long as
NMPacrunnerManager singleton still exits (that is anyway the plan
how to fix shutdown).
With these considerations it's also clear that our D-Bus calls must
have a stricter timeout: NM_SHUTDOWN_TIMEOUT_MS.
This is also nice because nm_pacrunner_manager_remove() no longer
needs a manager parameter, it can just rely on having a reference
to the manager.
- for logging the configuration IDs, don't log pointer values.
Logging pointer values should be avoided as it defeats ASLR.
Instead, give them a "log_id" number.
- pacrunner is a D-Bus activatable service. D-Bus activatable services
needs special care. We don't want to start it over and over again.
Instead, we only try to "StartServiceByName" if
- we have any configuration to add
- if pacrunner is currently confirmed not to be running (by watching
name owner changes)
- we didn't try to start it already. That means, only start it
at the beginning and afterwards set a flag to block it. When
we see pacrunner appear on D-Bus we always clear that flag,
that means if pacrunner drops of, we will try to restart it
(once).
2019-05-05 09:51:09 +02:00
|
|
|
void nm_pacrunner_manager_remove(NMPacrunnerConfId *conf_id);
|
2016-08-16 05:55:57 +05:30
|
|
|
|
pacrunner: refactor pacrunner to use GDBusConnection
- use GDBusConnection instead of GDBusProxy.
- rename "call-id" to "conf-id". It's really not a "call" but
configuration that gets added and NMPacrunnerManager ensures that
the configuration is send to pacrunner.
- let "conf-id" keep a reference to NMPacrunnerManager. For one,
when we remove configurations we need to call DestroyProxyConfiguration
to remove it again. We cannot just abort the requests but must linger
around until our configuration is properly cleaned up. Hence, we
anyway cannot destroy the NMPacrunnerManager earlier.
With respect to fixing shutdown not to leak anything, this merely
means that we must wait (and iterate the main loop) as long as
NMPacrunnerManager singleton still exits (that is anyway the plan
how to fix shutdown).
With these considerations it's also clear that our D-Bus calls must
have a stricter timeout: NM_SHUTDOWN_TIMEOUT_MS.
This is also nice because nm_pacrunner_manager_remove() no longer
needs a manager parameter, it can just rely on having a reference
to the manager.
- for logging the configuration IDs, don't log pointer values.
Logging pointer values should be avoided as it defeats ASLR.
Instead, give them a "log_id" number.
- pacrunner is a D-Bus activatable service. D-Bus activatable services
needs special care. We don't want to start it over and over again.
Instead, we only try to "StartServiceByName" if
- we have any configuration to add
- if pacrunner is currently confirmed not to be running (by watching
name owner changes)
- we didn't try to start it already. That means, only start it
at the beginning and afterwards set a flag to block it. When
we see pacrunner appear on D-Bus we always clear that flag,
that means if pacrunner drops of, we will try to restart it
(once).
2019-05-05 09:51:09 +02:00
|
|
|
gboolean nm_pacrunner_manager_remove_clear(NMPacrunnerConfId **p_conf_id);
|
2016-08-16 05:55:57 +05:30
|
|
|
|
|
|
|
|
#endif /* __NETWORKMANAGER_PACRUNNER_MANAGER_H__ */
|