Rename msg_id to msg_peerid now that we also have msg_localid.
authortobhe <tobhe@openbsd.org>
Sat, 27 Nov 2021 21:50:05 +0000 (21:50 +0000)
committertobhe <tobhe@openbsd.org>
Sat, 27 Nov 2021 21:50:05 +0000 (21:50 +0000)
ok patrick@

sbin/iked/iked.h
sbin/iked/ikev2.c
sbin/iked/ikev2_msg.c
sbin/iked/ikev2_pld.c
sbin/iked/policy.c

index 3067d86..4ac27c1 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: iked.h,v 1.198 2021/11/26 16:22:44 patrick Exp $      */
+/*     $OpenBSD: iked.h,v 1.199 2021/11/27 21:50:05 tobhe Exp $        */
 
 /*
  * Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
@@ -597,7 +597,7 @@ struct iked_message {
        uint16_t                 msg_dhgroup;   /* dh group */
        struct ibuf             *msg_ke;        /* dh key exchange */
        struct iked_id           msg_auth;      /* AUTH payload */
-       struct iked_id           msg_id;
+       struct iked_id           msg_peerid;
        struct iked_id           msg_localid;
        struct iked_id           msg_cert;
        struct ibuf             *msg_cookie;
index 18c4f29..8cbbfca 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ikev2.c,v 1.336 2021/11/26 14:05:01 tobhe Exp $       */
+/*     $OpenBSD: ikev2.c,v 1.337 2021/11/27 21:50:05 tobhe Exp $       */
 
 /*
  * Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
@@ -887,7 +887,7 @@ ikev2_ike_auth_recv(struct iked *env, struct iked_sa *sa,
                id = &sa->sa_iid;
 
        /* try to relookup the policy based on the peerid */
-       if (msg->msg_id.id_type && !sa->sa_hdr.sh_initiator) {
+       if (msg->msg_peerid.id_type && !sa->sa_hdr.sh_initiator) {
                old = sa->sa_policy;
 
                sa->sa_policy = NULL;
@@ -930,9 +930,9 @@ ikev2_ike_auth_recv(struct iked *env, struct iked_sa *sa,
                    old->pol_nflows) != 0 || msg->msg_policy != old) {
 
                        /* get dstid */
-                       if (msg->msg_id.id_type) {
-                               memcpy(id, &msg->msg_id, sizeof(*id));
-                               bzero(&msg->msg_id, sizeof(msg->msg_id));
+                       if (msg->msg_peerid.id_type) {
+                               memcpy(id, &msg->msg_peerid, sizeof(*id));
+                               bzero(&msg->msg_peerid, sizeof(msg->msg_peerid));
                        }
                        log_warnx("%s: policy mismatch", SPI_SA(sa, __func__));
                        ikev2_send_auth_failed(env, sa);
@@ -949,18 +949,18 @@ ikev2_ike_auth_recv(struct iked *env, struct iked_sa *sa,
        if (!msg->msg_auth.id_type &&
            !sa->sa_policy->pol_auth.auth_eap) {
                /* get dstid */
-               if (msg->msg_id.id_type) {
-                       memcpy(id, &msg->msg_id, sizeof(*id));
-                       bzero(&msg->msg_id, sizeof(msg->msg_id));
+               if (msg->msg_peerid.id_type) {
+                       memcpy(id, &msg->msg_peerid, sizeof(*id));
+                       bzero(&msg->msg_peerid, sizeof(msg->msg_peerid));
                }
                log_debug("%s: missing auth payload", SPI_SA(sa, __func__));
                ikev2_send_auth_failed(env, sa);
                return (-1);
        }
 
-       if (msg->msg_id.id_type) {
-               memcpy(id, &msg->msg_id, sizeof(*id));
-               bzero(&msg->msg_id, sizeof(msg->msg_id));
+       if (msg->msg_peerid.id_type) {
+               memcpy(id, &msg->msg_peerid, sizeof(*id));
+               bzero(&msg->msg_peerid, sizeof(msg->msg_peerid));
 
                if (!sa->sa_hdr.sh_initiator) {
                        if ((authmsg = ikev2_msg_auth(env, sa,
index 1b66b99..d586e4f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ikev2_msg.c,v 1.81 2021/11/26 16:22:44 patrick Exp $  */
+/*     $OpenBSD: ikev2_msg.c,v 1.82 2021/11/27 21:50:05 tobhe Exp $    */
 
 /*
  * Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
@@ -193,7 +193,7 @@ ikev2_msg_cleanup(struct iked *env, struct iked_message *msg)
                ibuf_release(msg->msg_nonce);
                ibuf_release(msg->msg_ke);
                ibuf_release(msg->msg_auth.id_buf);
-               ibuf_release(msg->msg_id.id_buf);
+               ibuf_release(msg->msg_peerid.id_buf);
                ibuf_release(msg->msg_localid.id_buf);
                ibuf_release(msg->msg_cert.id_buf);
                ibuf_release(msg->msg_cookie);
@@ -207,7 +207,7 @@ ikev2_msg_cleanup(struct iked *env, struct iked_message *msg)
                msg->msg_nonce = NULL;
                msg->msg_ke = NULL;
                msg->msg_auth.id_buf = NULL;
-               msg->msg_id.id_buf = NULL;
+               msg->msg_peerid.id_buf = NULL;
                msg->msg_localid.id_buf = NULL;
                msg->msg_cert.id_buf = NULL;
                msg->msg_cookie = NULL;
index 12d1d18..027a87a 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ikev2_pld.c,v 1.120 2021/11/26 16:22:44 patrick Exp $ */
+/*     $OpenBSD: ikev2_pld.c,v 1.121 2021/11/27 21:50:05 tobhe Exp $   */
 
 /*
  * Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
@@ -761,7 +761,7 @@ ikev2_pld_id(struct iked *env, struct ikev2_payload *pld,
 
        if (((sa->sa_hdr.sh_initiator && payload == IKEV2_PAYLOAD_IDr) ||
            (!sa->sa_hdr.sh_initiator && payload == IKEV2_PAYLOAD_IDi)))
-               idp = &msg->msg_parent->msg_id;
+               idp = &msg->msg_parent->msg_peerid;
        else if (!sa->sa_hdr.sh_initiator && payload == IKEV2_PAYLOAD_IDr)
                idp = &msg->msg_parent->msg_localid;
        else {
index 66354e7..99c24c1 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: policy.c,v 1.87 2021/11/26 16:22:44 patrick Exp $     */
+/*     $OpenBSD: policy.c,v 1.88 2021/11/27 21:50:05 tobhe Exp $       */
 
 /*
  * Copyright (c) 2020-2021 Tobias Heider <tobhe@openbsd.org>
@@ -103,10 +103,10 @@ policy_lookup(struct iked *env, struct iked_message *msg,
                pol.pol_flags |= IKED_POLICY_TRANSPORT;
        memcpy(&pol.pol_peer.addr, &msg->msg_peer, sizeof(msg->msg_peer));
        memcpy(&pol.pol_local.addr, &msg->msg_local, sizeof(msg->msg_local));
-       if (msg->msg_id.id_type &&
-           ikev2_print_id(&msg->msg_id, idstr, IKED_ID_SIZE) == 0 &&
+       if (msg->msg_peerid.id_type &&
+           ikev2_print_id(&msg->msg_peerid, idstr, IKED_ID_SIZE) == 0 &&
            (s = strchr(idstr, '/')) != NULL) {
-               pol.pol_peerid.id_type = msg->msg_id.id_type;
+               pol.pol_peerid.id_type = msg->msg_peerid.id_type;
                pol.pol_peerid.id_length = strlen(s+1);
                strlcpy(pol.pol_peerid.id_data, s+1,
                    sizeof(pol.pol_peerid.id_data));