ibuf_cat() is the same as ibuf_add_buf() so use the latter.

-- 
:wq Claudio

Index: eap.c
===================================================================
RCS file: /cvs/src/sbin/iked/eap.c,v
retrieving revision 1.24
diff -u -p -r1.24 eap.c
--- eap.c       23 May 2023 13:57:14 -0000      1.24
+++ eap.c       18 Jul 2023 13:11:27 -0000
@@ -112,7 +112,7 @@ eap_identity_request(struct iked *env, s
        if ((pld = ikev2_add_payload(e)) == NULL)
                goto done;
        firstpayload = IKEV2_PAYLOAD_IDr;
-       if (ibuf_cat(e, id->id_buf) != 0)
+       if (ibuf_add_buf(e, id->id_buf) != 0)
                goto done;
        len = ibuf_size(id->id_buf);
 
@@ -127,7 +127,7 @@ eap_identity_request(struct iked *env, s
                if ((cert = ibuf_reserve(e, sizeof(*cert))) == NULL)
                        goto done;
                cert->cert_type = certid->id_type;
-               if (ibuf_cat(e, certid->id_buf) != 0)
+               if (ibuf_add_buf(e, certid->id_buf) != 0)
                        goto done;
                len = ibuf_size(certid->id_buf) + sizeof(*cert);
 
@@ -142,7 +142,7 @@ eap_identity_request(struct iked *env, s
                        if ((cert = ibuf_reserve(e, sizeof(*cert))) == NULL)
                                goto done;
                        cert->cert_type = sa->sa_scert[i].id_type;
-                       if (ibuf_cat(e, sa->sa_scert[i].id_buf) != 0)
+                       if (ibuf_add_buf(e, sa->sa_scert[i].id_buf) != 0)
                                goto done;
                        len = ibuf_size(sa->sa_scert[i].id_buf) + sizeof(*cert);
                }
@@ -157,7 +157,7 @@ eap_identity_request(struct iked *env, s
        if ((auth = ibuf_reserve(e, sizeof(*auth))) == NULL)
                goto done;
        auth->auth_method = sa->sa_localauth.id_type;
-       if (ibuf_cat(e, sa->sa_localauth.id_buf) != 0)
+       if (ibuf_add_buf(e, sa->sa_localauth.id_buf) != 0)
                goto done;
        len = ibuf_size(sa->sa_localauth.id_buf) + sizeof(*auth);
 
Index: iked.h
===================================================================
RCS file: /cvs/src/sbin/iked/iked.h,v
retrieving revision 1.221
diff -u -p -r1.221 iked.h
--- iked.h      16 Jul 2023 15:21:46 -0000      1.221
+++ iked.h      18 Jul 2023 13:11:31 -0000
@@ -1268,7 +1268,6 @@ struct ibuf *
         ibuf_new(const void *, size_t);
 struct ibuf *
         ibuf_static(void);
-int     ibuf_cat(struct ibuf *, struct ibuf *);
 size_t  ibuf_length(struct ibuf *);
 int     ibuf_setsize(struct ibuf *, size_t);
 struct ibuf *
Index: ikev2.c
===================================================================
RCS file: /cvs/src/sbin/iked/ikev2.c,v
retrieving revision 1.373
diff -u -p -r1.373 ikev2.c
--- ikev2.c     16 Jul 2023 15:21:46 -0000      1.373
+++ ikev2.c     18 Jul 2023 13:13:37 -0000
@@ -1609,7 +1609,7 @@ ikev2_init_ike_auth(struct iked *env, st
        if ((pld = ikev2_add_payload(e)) == NULL)
                goto done;
        firstpayload = IKEV2_PAYLOAD_IDi;
-       if (ibuf_cat(e, id->id_buf) != 0)
+       if (ibuf_add_buf(e, id->id_buf) != 0)
                goto done;
        len = ibuf_size(id->id_buf);
 
@@ -1623,7 +1623,7 @@ ikev2_init_ike_auth(struct iked *env, st
                        goto done;
                if ((pld = ikev2_add_payload(e)) == NULL)
                        goto done;
-               if (ibuf_cat(e, peerid.id_buf) != 0)
+               if (ibuf_add_buf(e, peerid.id_buf) != 0)
                        goto done;
                len = ibuf_size(peerid.id_buf);
        }
@@ -1639,7 +1639,7 @@ ikev2_init_ike_auth(struct iked *env, st
                if ((cert = ibuf_reserve(e, sizeof(*cert))) == NULL)
                        goto done;
                cert->cert_type = certid->id_type;
-               if (ibuf_cat(e, certid->id_buf) != 0)
+               if (ibuf_add_buf(e, certid->id_buf) != 0)
                        goto done;
                len = ibuf_size(certid->id_buf) + sizeof(*cert);
 
@@ -1654,7 +1654,7 @@ ikev2_init_ike_auth(struct iked *env, st
                        if ((cert = ibuf_reserve(e, sizeof(*cert))) == NULL)
                                goto done;
                        cert->cert_type = sa->sa_scert[i].id_type;
-                       if (ibuf_cat(e, sa->sa_scert[i].id_buf) != 0)
+                       if (ibuf_add_buf(e, sa->sa_scert[i].id_buf) != 0)
                                goto done;
                        len = ibuf_size(sa->sa_scert[i].id_buf) + sizeof(*cert);
                }
@@ -1679,7 +1679,7 @@ ikev2_init_ike_auth(struct iked *env, st
        if ((auth = ibuf_reserve(e, sizeof(*auth))) == NULL)
                goto done;
        auth->auth_method = sa->sa_localauth.id_type;
-       if (ibuf_cat(e, sa->sa_localauth.id_buf) != 0)
+       if (ibuf_add_buf(e, sa->sa_localauth.id_buf) != 0)
                goto done;
        len = ibuf_size(sa->sa_localauth.id_buf) + sizeof(*auth);
 
@@ -2212,7 +2212,7 @@ ikev2_add_vendor_id(struct ibuf *e, stru
                        return (-1);
        if ((*pld = ikev2_add_payload(e)) == NULL)
                return (-1);
-       if (ibuf_cat(e, id) == -1)
+       if (ibuf_add_buf(e, id) == -1)
                return (-1);
 
        return (ibuf_length(id));
@@ -3908,7 +3908,7 @@ ikev2_resp_ike_auth(struct iked *env, st
                if ((pld = ikev2_add_payload(e)) == NULL)
                        goto done;
                firstpayload = IKEV2_PAYLOAD_IDr;
-               if (ibuf_cat(e, id->id_buf) != 0)
+               if (ibuf_add_buf(e, id->id_buf) != 0)
                        goto done;
                len = ibuf_size(id->id_buf);
 
@@ -3924,7 +3924,7 @@ ikev2_resp_ike_auth(struct iked *env, st
                        if ((cert = ibuf_reserve(e, sizeof(*cert))) == NULL)
                                goto done;
                        cert->cert_type = certid->id_type;
-                       if (ibuf_cat(e, certid->id_buf) != 0)
+                       if (ibuf_add_buf(e, certid->id_buf) != 0)
                                goto done;
                        len = ibuf_size(certid->id_buf) + sizeof(*cert);
 
@@ -3940,7 +3940,8 @@ ikev2_resp_ike_auth(struct iked *env, st
                                    sizeof(*cert))) == NULL)
                                        goto done;
                                cert->cert_type = sa->sa_scert[i].id_type;
-                               if (ibuf_cat(e, sa->sa_scert[i].id_buf) != 0)
+                               if (ibuf_add_buf(e, sa->sa_scert[i].id_buf) !=
+                                   0)
                                        goto done;
                                len = ibuf_size(sa->sa_scert[i].id_buf)
                                    + sizeof(*cert);
@@ -3958,7 +3959,7 @@ ikev2_resp_ike_auth(struct iked *env, st
        if ((auth = ibuf_reserve(e, sizeof(*auth))) == NULL)
                goto done;
        auth->auth_method = sa->sa_localauth.id_type;
-       if (ibuf_cat(e, sa->sa_localauth.id_buf) != 0)
+       if (ibuf_add_buf(e, sa->sa_localauth.id_buf) != 0)
                goto done;
        len = ibuf_size(sa->sa_localauth.id_buf) + sizeof(*auth);
 
@@ -4036,7 +4037,7 @@ ikev2_send_ike_e(struct iked *env, struc
                goto done;
 
        if (buf) {
-               if (ibuf_cat(e, buf) != 0)
+               if (ibuf_add_buf(e, buf) != 0)
                        goto done;
 
                if (ikev2_next_payload(pld, ibuf_size(buf),
@@ -5320,7 +5321,7 @@ ikev2_send_informational(struct iked *en
                        log_debug("%s: encryption failed", __func__);
                        goto done;
                }
-               if (ibuf_cat(buf, e) != 0)
+               if (ibuf_add_buf(buf, e) != 0)
                        goto done;
                if (ikev2_next_payload(pld, ibuf_size(e),
                    IKEV2_PAYLOAD_NOTIFY) == -1)
@@ -5351,7 +5352,7 @@ ikev2_send_informational(struct iked *en
                    IKEV2_PAYLOAD_NOTIFY, IKEV2_EXCHANGE_INFORMATIONAL,
                    0)) == NULL)
                        goto done;
-               if (ibuf_cat(buf, e) != 0)
+               if (ibuf_add_buf(buf, e) != 0)
                        goto done;
                if (ikev2_set_header(hdr, ibuf_size(buf) - sizeof(*hdr)) == -1)
                        goto done;
@@ -6192,13 +6193,13 @@ ikev2_childsa_negotiate(struct iked *env
                            ibuf_length(kex->kex_dhpeer));
                        goto done;
                }
-               if (ibuf_cat(seed, dhsecret) != 0) {
+               if (ibuf_add_buf(seed, dhsecret) != 0) {
                        log_debug("%s: failed to set dh secret", __func__);
                        goto done;
                }
        }
-       if (ibuf_cat(seed, kex->kex_inonce) != 0 ||
-           ibuf_cat(seed, kex->kex_rnonce) != 0 ||
+       if (ibuf_add_buf(seed, kex->kex_inonce) != 0 ||
+           ibuf_add_buf(seed, kex->kex_rnonce) != 0 ||
            (keymat = ikev2_prfplus(sa->sa_prf,
            sa->sa_key_d, seed, ilen)) == NULL) {
                log_debug("%s: failed to get IKE SA key material", __func__);
Index: ikev2_msg.c
===================================================================
RCS file: /cvs/src/sbin/iked/ikev2_msg.c,v
retrieving revision 1.96
diff -u -p -r1.96 ikev2_msg.c
--- ikev2_msg.c 28 Jun 2023 14:10:24 -0000      1.96
+++ ikev2_msg.c 18 Jul 2023 13:12:02 -0000
@@ -300,7 +300,7 @@ ikev2_msg_send(struct iked *env, struct 
                        log_debug("%s: failed to set NAT-T", __func__);
                        return (-1);
                }
-               if (ibuf_cat(new, buf) == -1) {
+               if (ibuf_add_buf(new, buf) == -1) {
                        ibuf_free(new);
                        log_debug("%s: failed to set NAT-T", __func__);
                        return (-1);
@@ -779,7 +779,7 @@ ikev2_msg_send_encrypt(struct iked *env,
                log_debug("%s: encryption failed", __func__);
                goto done;
        }
-       if (ibuf_cat(buf, e) != 0)
+       if (ibuf_add_buf(buf, e) != 0)
                goto done;
 
        /* Add integrity checksum (HMAC) */
@@ -887,7 +887,7 @@ ikev2_send_encrypted_fragments(struct ik
                        log_debug("%s: encryption failed", __func__);
                        goto done;
                }
-               if (ibuf_cat(buf, e) != 0)
+               if (ibuf_add_buf(buf, e) != 0)
                        goto done;
 
                /* Add integrity checksum (HMAC) */
@@ -961,7 +961,7 @@ ikev2_msg_auth(struct iked *env, struct 
 
        if ((authmsg = ibuf_dup(buf)) == NULL)
                return (NULL);
-       if (ibuf_cat(authmsg, nonce) != 0)
+       if (ibuf_add_buf(authmsg, nonce) != 0)
                goto fail;
 
        if ((hash_setkey(sa->sa_prf, ibuf_data(prfkey),
Index: imsg_util.c
===================================================================
RCS file: /cvs/src/sbin/iked/imsg_util.c,v
retrieving revision 1.20
diff -u -p -r1.20 imsg_util.c
--- imsg_util.c 16 Jul 2023 15:21:46 -0000      1.20
+++ imsg_util.c 18 Jul 2023 13:10:47 -0000
@@ -36,12 +36,6 @@
  * Extending the imsg buffer API for internal use
  */
 
-int
-ibuf_cat(struct ibuf *dst, struct ibuf *src)
-{
-       return (ibuf_add(dst, src->buf, ibuf_size(src)));
-}
-
 struct ibuf *
 ibuf_new(const void *data, size_t len)
 {

Reply via email to