Fix my previous patch to not call purge_remote() twice. Change the place
where purge_remote() is called. This fixes also a possible crash from the same patch since ph1->remote can be NULL (when we are responder and config is not yet selected).
This commit is contained in:
parent
40d1f42309
commit
6a6cffd67e
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: handler.c,v 1.33 2010/10/21 06:04:33 tteras Exp $ */
|
||||
/* $NetBSD: handler.c,v 1.34 2010/11/17 10:40:41 tteras Exp $ */
|
||||
|
||||
/* Id: handler.c,v 1.28 2006/05/26 12:17:29 manubsd Exp */
|
||||
|
||||
|
@ -514,6 +514,22 @@ initph1tree()
|
|||
LIST_INIT(&ph1tree);
|
||||
}
|
||||
|
||||
int
|
||||
ph1_rekey_enabled(iph1)
|
||||
struct ph1handle *iph1;
|
||||
{
|
||||
if (iph1->rmconf == NULL)
|
||||
return 0;
|
||||
if (iph1->rmconf->rekey == REKEY_FORCE)
|
||||
return 1;
|
||||
#ifdef ENABLE_DPD
|
||||
if (iph1->rmconf->rekey == REKEY_ON && iph1->dpd_support &&
|
||||
iph1->rmconf->dpd_interval)
|
||||
return 1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* %%% management phase 2 handler */
|
||||
|
||||
int
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: handler.h,v 1.24 2010/11/12 09:09:47 tteras Exp $ */
|
||||
/* $NetBSD: handler.h,v 1.25 2010/11/17 10:40:41 tteras Exp $ */
|
||||
|
||||
/* Id: handler.h,v 1.19 2006/02/25 08:25:12 manubsd Exp */
|
||||
|
||||
|
@ -493,6 +493,7 @@ extern void remph1 __P((struct ph1handle *));
|
|||
extern int resolveph1rmconf __P((struct ph1handle *));
|
||||
extern void flushph1 __P((void));
|
||||
extern void initph1tree __P((void));
|
||||
extern int ph1_rekey_enabled __P((struct ph1handle *));
|
||||
|
||||
extern int enumph2 __P((struct ph2selector *ph2sel,
|
||||
int (* enum_func)(struct ph2handle *iph2, void *arg),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: isakmp.c,v 1.65 2010/11/12 10:36:37 tteras Exp $ */
|
||||
/* $NetBSD: isakmp.c,v 1.66 2010/11/17 10:40:41 tteras Exp $ */
|
||||
|
||||
/* Id: isakmp.c,v 1.74 2006/05/07 21:32:59 manubsd Exp */
|
||||
|
||||
|
@ -766,20 +766,6 @@ isakmp_main(msg, remote, local)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ph1_rekey_enabled(iph1)
|
||||
struct ph1handle *iph1;
|
||||
{
|
||||
if (iph1->rmconf->rekey == REKEY_FORCE)
|
||||
return 1;
|
||||
#ifdef ENABLE_DPD
|
||||
if (iph1->rmconf->rekey == REKEY_ON && iph1->dpd_support &&
|
||||
iph1->rmconf->dpd_interval)
|
||||
return 1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* main function of phase 1.
|
||||
*/
|
||||
|
@ -2081,11 +2067,9 @@ isakmp_ph1delete(iph1)
|
|||
src, dst, isakmp_pindex(&iph1->index, 0));
|
||||
|
||||
evt_phase1(iph1, EVT_PHASE1_DOWN, NULL);
|
||||
|
||||
if (new_iph1 == NULL && ph1_rekey_enabled(iph1)) {
|
||||
purge_remote(iph1);
|
||||
if (new_iph1 == NULL && ph1_rekey_enabled(iph1))
|
||||
script_hook(iph1, SCRIPT_PHASE1_DEAD);
|
||||
}
|
||||
|
||||
racoon_free(src);
|
||||
racoon_free(dst);
|
||||
|
||||
|
@ -3521,7 +3505,7 @@ delete_spd(iph2, created)
|
|||
}
|
||||
}
|
||||
|
||||
/* make source address in spidx */
|
||||
/* make source address in spidx */
|
||||
if (iph2->id_p != NULL
|
||||
&& (_XIDT(iph2->id_p) == IPSECDOI_ID_IPV4_ADDR
|
||||
|| _XIDT(iph2->id_p) == IPSECDOI_ID_IPV6_ADDR
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: isakmp_inf.c,v 1.43 2010/11/12 09:09:47 tteras Exp $ */
|
||||
/* $NetBSD: isakmp_inf.c,v 1.44 2010/11/17 10:40:41 tteras Exp $ */
|
||||
|
||||
/* Id: isakmp_inf.c,v 1.44 2006/05/06 20:45:52 manubsd Exp */
|
||||
|
||||
|
@ -516,10 +516,12 @@ isakmp_info_recv_d(iph1, delete, msgid, encrypted)
|
|||
sched_cancel(&del_ph1->scr);
|
||||
|
||||
/*
|
||||
* Do not delete IPsec SAs when receiving an IKE delete notification.
|
||||
* Just delete the IKE SA.
|
||||
* Delete also IPsec-SAs if rekeying is enabled.
|
||||
*/
|
||||
isakmp_ph1expire(del_ph1);
|
||||
if (ph1_rekey_enabled(del_ph1))
|
||||
purge_remote(del_ph1);
|
||||
else
|
||||
isakmp_ph1expire(del_ph1);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue