Пример #1
0
static gboolean
arping_timeout_cb (gpointer user_data)
{
    NMArpingManager *self = user_data;
    NMArpingManagerPrivate *priv = NM_ARPING_MANAGER_GET_PRIVATE (self);
    GHashTableIter iter;
    AddressInfo *info;

    priv->timer = 0;

    g_hash_table_iter_init (&iter, priv->addresses);
    while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &info)) {
        nm_clear_g_source (&info->watch);
        if (info->pid) {
            _LOGD ("DAD timed out for %s",
                   nm_utils_inet4_ntop (info->address, NULL));
            nm_utils_kill_child_async (info->pid, SIGTERM, LOGD_IP4,
                                       "arping", 1000, NULL, NULL);
            info->pid = 0;
        }
    }

    priv->state = STATE_PROBE_DONE;
    g_signal_emit (self, signals[PROBE_TERMINATED], 0);

    return G_SOURCE_REMOVE;
}
Пример #2
0
static void
teamd_cleanup (NMDevice *device, gboolean free_tdc)
{
	NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (device);

	if (priv->teamd_process_watch) {
		g_source_remove (priv->teamd_process_watch);
		priv->teamd_process_watch = 0;
	}

	if (priv->teamd_timeout) {
		g_source_remove (priv->teamd_timeout);
		priv->teamd_timeout = 0;
	}

	if (priv->teamd_pid > 0) {
		nm_utils_kill_child_async (priv->teamd_pid, SIGTERM, LOGD_TEAM, "teamd", 2000, NULL, NULL);
		priv->teamd_pid = 0;
	}

	if (priv->tdc && free_tdc) {
		teamdctl_disconnect (priv->tdc);
		teamdctl_free (priv->tdc);
		priv->tdc = NULL;
	}
}
Пример #3
0
static void
destroy_address_info (gpointer data)
{
    AddressInfo *info = (AddressInfo *) data;

    nm_clear_g_source (&info->watch);

    if (info->pid) {
        nm_utils_kill_child_async (info->pid, SIGTERM, LOGD_IP4, "arping",
                                   1000, NULL, NULL);
    }

    g_slice_free (AddressInfo, info);
}
Пример #4
0
static void
_ppp_kill (NMPPPManager *manager)
{
	NMPPPManagerPrivate *priv;

	g_return_if_fail (NM_IS_PPP_MANAGER (manager));

	priv = NM_PPP_MANAGER_GET_PRIVATE (manager);

	if (priv->pid) {
		nm_utils_kill_child_async (priv->pid, SIGTERM, LOGD_PPP, "pppd", 2000, NULL, NULL);
		priv->pid = 0;
	}
}
void
nm_dnsmasq_manager_stop (NMDnsMasqManager *manager)
{
	NMDnsMasqManagerPrivate *priv;

	g_return_if_fail (NM_IS_DNSMASQ_MANAGER (manager));

	priv = NM_DNSMASQ_MANAGER_GET_PRIVATE (manager);

	if (priv->dm_watch_id) {
		g_source_remove (priv->dm_watch_id);
		priv->dm_watch_id = 0;
	}

	if (priv->pid) {
		nm_utils_kill_child_async (priv->pid, SIGTERM, LOGD_SHARING, "dnsmasq", 2000, NULL, NULL);
		priv->pid = 0;
	}

	unlink (priv->pidfile);
}
Пример #6
0
void
nm_ppp_manager_stop (NMPPPManager *manager,
                     GCancellable *cancellable,
                     GAsyncReadyCallback callback,
                     gpointer user_data)
{
	NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager);
	StopContext *ctx;

	ctx = g_slice_new0 (StopContext);
	ctx->manager = g_object_ref (manager);
	ctx->result = g_simple_async_result_new (G_OBJECT (manager),
	                                         callback,
	                                         user_data,
	                                         nm_ppp_manager_stop);

	/* Setup cancellable */
	ctx->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
	if (stop_context_complete_if_cancelled (ctx))
		return;

	/* Cleanup internals */
	_ppp_cleanup (manager);

	/* If no pppd running, we're done */
	if (!priv->pid) {
		stop_context_complete (ctx);
		return;
	}

	/* No cancellable operation, so just wait until it returns always */
	nm_utils_kill_child_async (priv->pid,
	                           SIGTERM,
	                           LOGD_PPP,
	                           "pppd",
	                           2000,
	                           (NMUtilsKillChildAsyncCb) kill_child_ready,
	                           ctx);
	priv->pid = 0;
}