diff options
-rw-r--r-- | sbin/iked/iked.h | 4 | ||||
-rw-r--r-- | sbin/iked/ikev1.c | 6 | ||||
-rw-r--r-- | sbin/iked/ikev2.c | 10 | ||||
-rw-r--r-- | sbin/iked/ikev2_msg.c | 19 | ||||
-rw-r--r-- | sbin/iked/util.c | 11 |
5 files changed, 26 insertions, 24 deletions
diff --git a/sbin/iked/iked.h b/sbin/iked/iked.h index bc001a35d0e..0a10a159270 100644 --- a/sbin/iked/iked.h +++ b/sbin/iked/iked.h @@ -1,4 +1,4 @@ -/* $OpenBSD: iked.h,v 1.6 2010/06/14 08:10:32 reyk Exp $ */ +/* $OpenBSD: iked.h,v 1.7 2010/06/14 08:55:59 reyk Exp $ */ /* $vantronix: iked.h,v 1.61 2010/06/03 07:57:33 reyk Exp $ */ /* @@ -605,6 +605,7 @@ struct ibuf * ikev2_msg_init(struct iked *, struct iked_message *, struct sockaddr_storage *, socklen_t, struct sockaddr_storage *, socklen_t, int); +void ikev2_msg_cleanup(struct iked *, struct iked_message *); u_int32_t ikev2_msg_id(struct iked *, struct iked_sa *, int); struct ibuf @@ -715,7 +716,6 @@ char *get_string(u_int8_t *, size_t); int print_id(struct iked_id *, off_t, char *, size_t); const char * print_proto(u_int8_t); -void message_cleanup(struct iked *, struct iked_message *); int expand_string(char *, size_t, const char *, const char *); u_int8_t *string2unicode(const char *, size_t *); diff --git a/sbin/iked/ikev1.c b/sbin/iked/ikev1.c index e90bb403cf9..26dcd450623 100644 --- a/sbin/iked/ikev1.c +++ b/sbin/iked/ikev1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ikev1.c,v 1.3 2010/06/10 14:08:37 reyk Exp $ */ +/* $OpenBSD: ikev1.c,v 1.4 2010/06/14 08:55:59 reyk Exp $ */ /* $vantronix: ikev1.c,v 1.13 2010/05/28 15:34:35 reyk Exp $ */ /* @@ -109,7 +109,7 @@ ikev1_dispatch_ikev2(int fd, struct iked_proc *p, struct imsg *imsg) log_debug("%s: message length %d", __func__, len); ikev1_recv(env, &msg); - message_cleanup(env, &msg); + ikev2_msg_cleanup(env, &msg); return (0); default: break; @@ -158,7 +158,7 @@ ikev1_msg_cb(int fd, short event, void *arg) ikev1_recv(env, &msg); done: - message_cleanup(env, &msg); + ikev2_msg_cleanup(env, &msg); } void diff --git a/sbin/iked/ikev2.c b/sbin/iked/ikev2.c index ef6291e2083..bd6ea7f612c 100644 --- a/sbin/iked/ikev2.c +++ b/sbin/iked/ikev2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ikev2.c,v 1.7 2010/06/14 08:10:32 reyk Exp $ */ +/* $OpenBSD: ikev2.c,v 1.8 2010/06/14 08:55:59 reyk Exp $ */ /* $vantronix: ikev2.c,v 1.101 2010/06/03 07:57:33 reyk Exp $ */ /* @@ -154,7 +154,7 @@ ikev2_dispatch_ikev1(int fd, struct iked_proc *p, struct imsg *imsg) log_debug("%s: message length %d", __func__, len); ikev2_recv(env, &msg); - message_cleanup(env, &msg); + ikev2_msg_cleanup(env, &msg); return (0); default: break; @@ -615,7 +615,7 @@ ikev2_init_ike_sa(struct iked *env, struct iked_policy *pol) done: if (ret == -1) sa_free(env, sa); - message_cleanup(env, &req); + ikev2_msg_cleanup(env, &req); return (ret); } @@ -1295,7 +1295,7 @@ ikev2_resp_ike_sa_init(struct iked *env, struct iked_message *msg) ret = ikev2_msg_send(env, msg->msg_fd, &resp); done: - message_cleanup(env, &resp); + ikev2_msg_cleanup(env, &resp); return (ret); } @@ -1766,7 +1766,7 @@ ikev2_send_informational(struct iked *env, struct iked_message *msg) done: ibuf_release(e); - message_cleanup(env, &resp); + ikev2_msg_cleanup(env, &resp); return (ret); } diff --git a/sbin/iked/ikev2_msg.c b/sbin/iked/ikev2_msg.c index 115f2a459d2..34ff1f9153a 100644 --- a/sbin/iked/ikev2_msg.c +++ b/sbin/iked/ikev2_msg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ikev2_msg.c,v 1.2 2010/06/14 08:10:32 reyk Exp $ */ +/* $OpenBSD: ikev2_msg.c,v 1.3 2010/06/14 08:55:59 reyk Exp $ */ /* $vantronix: ikev2.c,v 1.101 2010/06/03 07:57:33 reyk Exp $ */ /* @@ -104,7 +104,7 @@ ikev2_msg_cb(int fd, short event, void *arg) ikev2_recv(env, &msg); done: - message_cleanup(env, &msg); + ikev2_msg_cleanup(env, &msg); } struct ibuf * @@ -120,10 +120,21 @@ ikev2_msg_init(struct iked *env, struct iked_message *msg, msg->msg_response = response ? 1 : 0; msg->msg_fd = -1; msg->msg_data = ibuf_static(); + TAILQ_INIT(&msg->msg_proposals); return (msg->msg_data); } +void +ikev2_msg_cleanup(struct iked *env, struct iked_message *msg) +{ + if (msg->msg_data != NULL) { + ibuf_release(msg->msg_data); + msg->msg_data = NULL; + } + config_free_proposals(&msg->msg_proposals, 0); +} + int ikev2_msg_valid_ike_sa(struct iked *env, struct ike_header *oldhdr, struct iked_message *msg) @@ -190,7 +201,7 @@ ikev2_msg_valid_ike_sa(struct iked *env, struct ike_header *oldhdr, (void)ikev2_msg_send(env, msg->msg_fd, &resp); done: - message_cleanup(env, &resp); + ikev2_msg_cleanup(env, &resp); #endif /* Always fail */ @@ -563,7 +574,7 @@ ikev2_msg_send_encrypt(struct iked *env, struct iked_sa *sa, done: /* e is cleaned up by the calling function */ *ep = e; - message_cleanup(env, &resp); + ikev2_msg_cleanup(env, &resp); return (ret); } diff --git a/sbin/iked/util.c b/sbin/iked/util.c index d7c31128f7d..cd54fea4abc 100644 --- a/sbin/iked/util.c +++ b/sbin/iked/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.2 2010/06/10 09:14:38 reyk Exp $ */ +/* $OpenBSD: util.c,v 1.3 2010/06/14 08:55:59 reyk Exp $ */ /* $vantronix: util.c,v 1.39 2010/06/02 12:22:58 reyk Exp $ */ /* @@ -726,15 +726,6 @@ print_proto(u_int8_t proto) return (buf[idx++]); } -void -message_cleanup(struct iked *env, struct iked_message *msg) -{ - if (msg->msg_data != NULL) { - ibuf_release(msg->msg_data); - msg->msg_data = NULL; - } -} - int expand_string(char *label, size_t len, const char *srch, const char *repl) { |