Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/crypto/dist/ipsec-tools/src/racoon Fix my previous patch to ...
details: https://anonhg.NetBSD.org/src/rev/1e1bd4799155
branches: trunk
changeset: 758830:1e1bd4799155
user: tteras <tteras%NetBSD.org@localhost>
date: Wed Nov 17 10:40:41 2010 +0000
description:
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).
diffstat:
crypto/dist/ipsec-tools/src/racoon/handler.c | 18 +++++++++++++++++-
crypto/dist/ipsec-tools/src/racoon/handler.h | 3 ++-
crypto/dist/ipsec-tools/src/racoon/isakmp.c | 24 ++++--------------------
crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c | 10 ++++++----
4 files changed, 29 insertions(+), 26 deletions(-)
diffs (127 lines):
diff -r 17a73006c01f -r 1e1bd4799155 crypto/dist/ipsec-tools/src/racoon/handler.c
--- a/crypto/dist/ipsec-tools/src/racoon/handler.c Wed Nov 17 08:55:27 2010 +0000
+++ b/crypto/dist/ipsec-tools/src/racoon/handler.c Wed Nov 17 10:40:41 2010 +0000
@@ -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 @@
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
diff -r 17a73006c01f -r 1e1bd4799155 crypto/dist/ipsec-tools/src/racoon/handler.h
--- a/crypto/dist/ipsec-tools/src/racoon/handler.h Wed Nov 17 08:55:27 2010 +0000
+++ b/crypto/dist/ipsec-tools/src/racoon/handler.h Wed Nov 17 10:40:41 2010 +0000
@@ -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 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),
diff -r 17a73006c01f -r 1e1bd4799155 crypto/dist/ipsec-tools/src/racoon/isakmp.c
--- a/crypto/dist/ipsec-tools/src/racoon/isakmp.c Wed Nov 17 08:55:27 2010 +0000
+++ b/crypto/dist/ipsec-tools/src/racoon/isakmp.c Wed Nov 17 10:40:41 2010 +0000
@@ -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 @@
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 @@
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 @@
}
}
- /* 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
diff -r 17a73006c01f -r 1e1bd4799155 crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c
--- a/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c Wed Nov 17 08:55:27 2010 +0000
+++ b/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c Wed Nov 17 10:40:41 2010 +0000
@@ -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 @@
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;
Home |
Main Index |
Thread Index |
Old Index