bus: Change ike_update() signature and only call it once

This avoids multiple events when both addresses change (e.g. switching
address families).
This commit is contained in:
Tobias Brunner
2021-01-18 11:34:40 +01:00
parent 5ef10ec326
commit 08a3ee0cce
6 changed files with 43 additions and 50 deletions
+4 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2016 Tobias Brunner
* Copyright (C) 2011-2020 Tobias Brunner
* Copyright (C) 2006 Martin Willi
* HSR Hochschule fuer Technik Rapperswil
*
@@ -866,7 +866,7 @@ METHOD(bus_t, ike_rekey, void,
}
METHOD(bus_t, ike_update, void,
private_bus_t *this, ike_sa_t *ike_sa, bool local, host_t *new)
private_bus_t *this, ike_sa_t *ike_sa, host_t *local, host_t *remote)
{
enumerator_t *enumerator;
entry_t *entry;
@@ -881,7 +881,8 @@ METHOD(bus_t, ike_update, void,
continue;
}
entry->calling++;
keep = entry->listener->ike_update(entry->listener, ike_sa, local, new);
keep = entry->listener->ike_update(entry->listener, ike_sa, local,
remote);
entry->calling--;
if (!keep)
{
+5 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2012-2016 Tobias Brunner
* Copyright (C) 2012-2020 Tobias Brunner
* Copyright (C) 2006-2009 Martin Willi
* HSR Hochschule fuer Technik Rapperswil
*
@@ -417,10 +417,11 @@ struct bus_t {
* IKE_SA peer endpoint update hook.
*
* @param ike_sa updated IKE_SA, having old endpoints set
* @param local TRUE if local endpoint gets updated, FALSE for remote
* @param new new endpoint address and port
* @param local new/current local endpoint address and port
* @param remote new/current remote endpoint address and port
*/
void (*ike_update)(bus_t *this, ike_sa_t *ike_sa, bool local, host_t *new);
void (*ike_update)(bus_t *this, ike_sa_t *ike_sa, host_t *local,
host_t *remote);
/**
* IKE_SA reestablishing hook (before resolving hosts).
+6 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2016 Tobias Brunner
* Copyright (C) 2011-2020 Tobias Brunner
* Copyright (C) 2009 Martin Willi
* HSR Hochschule fuer Technik Rapperswil
*
@@ -160,13 +160,15 @@ struct listener_t {
/**
* Hook called for IKE_SA peer endpoint updates.
*
* At least one endpoint has changed when this is invoked.
*
* @param ike_sa updated IKE_SA, having old endpoints set
* @param local TRUE if local endpoint gets updated, FALSE for remote
* @param new new endpoint address and port
* @param local new/current local endpoint address and port
* @param remote new/current remote endpoint address and port
* @return TRUE to stay registered, FALSE to unregister
*/
bool (*ike_update)(listener_t *this, ike_sa_t *ike_sa,
bool local, host_t *new);
host_t *local, host_t *remote);
/**
* Hook called when an initiator reestablishes an IKE_SA.