Lines Matching refs:iph2
114 quick_timeover(iph2) in quick_timeover() argument
115 struct ph2handle *iph2; in quick_timeover()
119 saddrwop2str(iph2->dst));
122 if (iph2->side == INITIATOR)
123 pk_sendeacquire(iph2);
125 remph2(iph2);
126 delph2(iph2);
136 quick_i1prep(iph2, msg) in quick_i1prep() argument
137 struct ph2handle *iph2; in quick_i1prep()
143 if (iph2->status != PHASE2ST_STATUS2) {
145 "status mismatched %d.\n", iph2->status);
149 iph2->msgid = isakmp_newmsgid2(iph2->ph1);
150 iph2->ivm = oakley_newiv2(iph2->ph1, iph2->msgid);
151 if (iph2->ivm == NULL)
154 iph2->status = PHASE2ST_GETSPISENT;
163 if (pk_sendgetspi(iph2) < 0)
168 sched_schedule(&iph2->sce, lcconf->wait_ph2complete,
182 quick_i1send(iph2, msg) in quick_i1send() argument
183 struct ph2handle *iph2; in quick_i1send()
207 if (iph2->status != PHASE2ST_GETSPIDONE) {
209 "status mismatched %d.\n", iph2->status);
214 if (ipsecdoi_setph2proposal(iph2) < 0)
218 iph2->nonce = eay_set_random(iph2->ph1->rmconf->nonce_size);
219 if (iph2->nonce == NULL)
228 pfsgroup = iph2->proposal->pfs_group;
231 if (oakley_setdhgroup(pfsgroup, &iph2->pfsgrp) < 0) {
236 if (oakley_dh_generate(iph2->pfsgrp,
237 &iph2->dhpub, &iph2->dhpriv) < 0) {
243 if (ipsecdoi_setid2(iph2) < 0) {
249 plogdump(LLV_DEBUG, iph2->id->v, iph2->id->l);
251 plogdump(LLV_DEBUG, iph2->id_p->v, iph2->id_p->l);
262 id = (struct ipsecdoi_id_b *)iph2->id->v;
263 id_p = (struct ipsecdoi_id_b *)iph2->id_p->v;
266 iph2->ph1->rmconf->support_proxy == 0 &&
267 iph2->sa_src == NULL && iph2->sa_dst == NULL &&
268 ipsecdoi_transportmode(iph2->proposal)) {
278 if (ipsecdoi_transportmode(iph2->proposal)
279 && (iph2->ph1->natt_flags & NAT_DETECTED)) {
280 natoa = iph2->ph1->natt_options->payload_nat_oa;
282 nat_oai = ipsecdoi_sockaddr2id(iph2->src,
284 nat_oar = ipsecdoi_sockaddr2id(iph2->dst,
303 tlen = + sizeof(*gen) + iph2->sa->l
304 + sizeof(*gen) + iph2->nonce->l;
306 tlen += (sizeof(*gen) + iph2->dhpub->l);
308 tlen += sizeof(*gen) + iph2->id->l;
310 tlen += sizeof(*gen) + iph2->id_p->l;
326 p = set_isakmp_payload(p, iph2->sa, ISAKMP_NPTYPE_NONCE);
335 p = set_isakmp_payload(p, iph2->nonce, np);
340 p = set_isakmp_payload(p, iph2->dhpub, np);
345 p = set_isakmp_payload(p, iph2->id, np);
349 p = set_isakmp_payload(p, iph2->id_p, natoa);
360 hash = oakley_compute_hash1(iph2->ph1, iph2->msgid, body);
365 iph2->sendbuf = quick_ir1mx(iph2, body, hash);
366 if (iph2->sendbuf == NULL)
370 if (isakmp_ph2send(iph2) == -1)
374 iph2->status = PHASE2ST_MSG1SENT;
398 quick_i2recv(iph2, msg0) in quick_i2recv() argument
399 struct ph2handle *iph2; in quick_i2recv()
415 if (iph2->status != PHASE2ST_MSG1SENT) {
417 "status mismatched %d.\n", iph2->status);
423 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
427 msg = oakley_do_decrypt(iph2->ph1, msg0, iph2->ivm->iv, iph2->ivm->ive);
445 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
461 plog(LLV_WARNING, LOCATION, iph2->ph1->remote,
468 tlen = iph2->nonce->l
476 p = hbuf->v + iph2->nonce->l; /* retain the space for Ni_b */
482 iph2->sa_ret = NULL;
492 if (iph2->sa_ret != NULL) {
498 if (isakmp_p2ph(&iph2->sa_ret, pa->ptr) < 0) {
499 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
506 if (isakmp_p2ph(&iph2->nonce_p, pa->ptr) < 0) {
507 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
514 if (isakmp_p2ph(&iph2->dhpub_p, pa->ptr) < 0) {
515 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
529 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
536 ph2_recv_n(iph2, pa->ptr);
565 if (iph2->natoa_src == NULL)
566 iph2->natoa_src = daddr;
567 else if (iph2->natoa_dst == NULL)
568 iph2->natoa_dst = daddr;
571 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
581 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
595 if (hash == NULL || iph2->sa_ret == NULL || iph2->nonce_p == NULL) {
596 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
607 error = ipsecdoi_id2sockaddr(iph2->id,
627 set_port(iph2->natoa_src,
636 } else if (iph2->natoa_src != NULL
637 && cmpsaddr(iph2->natoa_src,
654 error = ipsecdoi_id2sockaddr(iph2->id_p,
675 set_port(iph2->natoa_dst,
684 } else if (iph2->natoa_dst != NULL
685 && cmpsaddr(iph2->natoa_dst,
699 memcpy(hbuf->v, iph2->nonce->v, iph2->nonce->l);
702 hbuf->l, tlen + iph2->nonce->l);
704 hbuf->l = iph2->nonce->l + tlen;
717 my_hash = oakley_compute_hash1(iph2->ph1, iph2->msgid, hbuf);
725 plog(LLV_DEBUG, LOCATION, iph2->ph1->remote,
733 if (ipsecdoi_checkph2proposal(iph2) < 0) {
734 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
741 iph2->status = PHASE2ST_STATUS6;
758 VPTRINIT(iph2->sa_ret);
759 VPTRINIT(iph2->nonce_p);
760 VPTRINIT(iph2->dhpub_p);
761 VPTRINIT(iph2->id);
762 VPTRINIT(iph2->id_p);
764 if (iph2->natoa_src) {
765 racoon_free(iph2->natoa_src);
766 iph2->natoa_src = NULL;
768 if (iph2->natoa_dst) {
769 racoon_free(iph2->natoa_dst);
770 iph2->natoa_dst = NULL;
783 quick_i2send(iph2, msg0) in quick_i2send() argument
784 struct ph2handle *iph2; in quick_i2send()
795 if (iph2->status != PHASE2ST_STATUS6) {
797 "status mismatched %d.\n", iph2->status);
807 tmp = vmalloc(iph2->nonce->l + iph2->nonce_p->l);
813 memcpy(tmp->v, iph2->nonce->v, iph2->nonce->l);
814 memcpy(tmp->v + iph2->nonce->l, iph2->nonce_p->v, iph2->nonce_p->l);
816 hash = oakley_compute_hash3(iph2->ph1, iph2->msgid, tmp);
834 p = set_isakmp_header2(buf, iph2, ISAKMP_NPTYPE_HASH);
842 isakmp_printpacket(buf, iph2->ph1->local, iph2->ph1->remote, 1);
846 iph2->sendbuf = oakley_do_encrypt(iph2->ph1, buf, iph2->ivm->ive, iph2->ivm->iv);
847 if (iph2->sendbuf == NULL)
851 if (ISSET(iph2->flags, ISAKMP_FLAG_C)) {
853 if (isakmp_ph2send(iph2) == -1)
857 if (isakmp_send(iph2->ph1, iph2->sendbuf) < 0)
862 if (add_recvdpkt(iph2->ph1->remote, iph2->ph1->local,
863 iph2->sendbuf, msg0) == -1) {
870 if (oakley_compute_keymat(iph2, INITIATOR) < 0)
873 iph2->status = PHASE2ST_ADDSA;
882 if (ISSET(iph2->flags, ISAKMP_FLAG_C)) {
883 iph2->status = PHASE2ST_COMMIT;
890 if (pk_sendupdate(iph2) < 0) {
897 if (pk_sendadd(iph2) < 0) {
921 quick_i3recv(iph2, msg0) in quick_i3recv() argument
922 struct ph2handle *iph2; in quick_i3recv()
933 if (iph2->status != PHASE2ST_COMMIT) {
935 "status mismatched %d.\n", iph2->status);
941 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
945 msg = oakley_do_decrypt(iph2->ph1, msg0, iph2->ivm->iv, iph2->ivm->ive);
968 ph2_recv_n(iph2, pa->ptr);
979 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
989 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
1006 my_hash = oakley_compute_hash1(iph2->ph1, iph2->msgid, notify);
1015 plog(LLV_DEBUG, LOCATION, iph2->ph1->remote,
1022 iph2->status = PHASE2ST_ADDSA;
1023 iph2->flags ^= ISAKMP_FLAG_C; /* reset bit */
1033 if (pk_sendupdate(iph2) < 0) {
1040 if (pk_sendadd(iph2) < 0) {
1064 quick_r1recv(iph2, msg0) in quick_r1recv() argument
1065 struct ph2handle *iph2; in quick_r1recv()
1080 if (iph2->status != PHASE2ST_START) {
1082 "status mismatched %d.\n", iph2->status);
1088 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
1094 msg = oakley_do_decrypt(iph2->ph1, msg0, iph2->ivm->iv, iph2->ivm->ive);
1096 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
1115 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
1132 plog(LLV_WARNING, LOCATION, iph2->ph1->remote,
1153 iph2->sa = NULL; /* we don't support multi SAs. */
1154 iph2->nonce_p = NULL;
1155 iph2->dhpub_p = NULL;
1156 iph2->id_p = NULL;
1157 iph2->id = NULL;
1178 if (iph2->sa != NULL) {
1183 if (isakmp_p2ph(&iph2->sa, pa->ptr) < 0) {
1184 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
1191 if (isakmp_p2ph(&iph2->nonce_p, pa->ptr) < 0) {
1192 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
1199 if (isakmp_p2ph(&iph2->dhpub_p, pa->ptr) < 0) {
1200 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
1207 if (iph2->id_p == NULL) {
1211 if (isakmp_p2ph(&iph2->id_p, pa->ptr) < 0)
1214 } else if (iph2->id == NULL) {
1224 if (isakmp_p2ph(&iph2->id, pa->ptr) < 0)
1229 plogdump(LLV_ERROR, iph2->id->v, iph2->id->l);
1236 ph2_recv_n(iph2, pa->ptr);
1265 if (iph2->natoa_dst == NULL)
1266 iph2->natoa_dst = daddr;
1267 else if (iph2->natoa_src == NULL)
1268 iph2->natoa_src = daddr;
1271 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
1281 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
1296 if (hash == NULL || iph2->sa == NULL || iph2->nonce_p == NULL) {
1297 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
1303 if (iph2->id_p) {
1305 plogdump(LLV_DEBUG, iph2->id_p->v, iph2->id_p->l);
1307 if (iph2->id) {
1309 plogdump(LLV_DEBUG, iph2->id->v, iph2->id->l);
1326 my_hash = oakley_compute_hash1(iph2->ph1, iph2->msgid, hbuf);
1334 plog(LLV_DEBUG, LOCATION, iph2->ph1->remote,
1342 error = get_sainfo_r(iph2);
1351 error = get_proposal_r(iph2);
1355 if (set_proposal_from_proposal(iph2)) {
1365 if (ipsecdoi_selectph2proposal(iph2) < 0) {
1366 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
1379 if (iph2->dhpub_p != NULL && iph2->approval->pfs_group == 0) {
1385 if (iph2->dhpub_p == NULL && iph2->approval->pfs_group != 0) {
1396 iph2->msg1 = vdup(msg0);
1399 iph2->status = PHASE2ST_STATUS2;
1412 VPTRINIT(iph2->sa);
1413 VPTRINIT(iph2->nonce_p);
1414 VPTRINIT(iph2->dhpub_p);
1415 VPTRINIT(iph2->id);
1416 VPTRINIT(iph2->id_p);
1418 if (iph2->natoa_src) {
1419 racoon_free(iph2->natoa_src);
1420 iph2->natoa_src = NULL;
1422 if (iph2->natoa_dst) {
1423 racoon_free(iph2->natoa_dst);
1424 iph2->natoa_dst = NULL;
1436 quick_r1prep(iph2, msg) in quick_r1prep() argument
1437 struct ph2handle *iph2; in quick_r1prep()
1443 if (iph2->status != PHASE2ST_STATUS2) {
1445 "status mismatched %d.\n", iph2->status);
1449 iph2->status = PHASE2ST_GETSPISENT;
1452 if (pk_sendgetspi(iph2) < 0)
1457 sched_schedule(&iph2->sce, lcconf->wait_ph2complete,
1471 quick_r2send(iph2, msg) in quick_r2send() argument
1472 struct ph2handle *iph2; in quick_r2send()
1495 if (iph2->status != PHASE2ST_GETSPIDONE) {
1497 "status mismatched %d.\n", iph2->status);
1502 if (ipsecdoi_updatespi(iph2) < 0) {
1508 iph2->nonce = eay_set_random(iph2->ph1->rmconf->nonce_size);
1509 if (iph2->nonce == NULL)
1513 pfsgroup = iph2->approval->pfs_group;
1514 if (iph2->dhpub_p != NULL && pfsgroup != 0) {
1516 if (oakley_setdhgroup(pfsgroup, &iph2->pfsgrp) < 0) {
1522 if (oakley_dh_generate(iph2->pfsgrp,
1523 &iph2->dhpub, &iph2->dhpriv) < 0) {
1533 if (ipsecdoi_transportmode(iph2->proposal)
1534 && (iph2->ph1->natt_flags & NAT_DETECTED)) {
1535 natoa = iph2->ph1->natt_options->payload_nat_oa;
1537 nat_oai = ipsecdoi_sockaddr2id(iph2->dst,
1539 nat_oar = ipsecdoi_sockaddr2id(iph2->src,
1556 tlen = sizeof(*gen) + iph2->sa_ret->l
1557 + sizeof(*gen) + iph2->nonce->l;
1558 if (iph2->dhpub_p != NULL && pfsgroup != 0)
1559 tlen += (sizeof(*gen) + iph2->dhpub->l);
1560 if (iph2->id_p != NULL)
1561 tlen += (sizeof(*gen) + iph2->id_p->l
1562 + sizeof(*gen) + iph2->id->l);
1577 p = set_isakmp_payload(body->v, iph2->sa_ret, ISAKMP_NPTYPE_NONCE);
1581 p = set_isakmp_payload(p, iph2->nonce,
1582 (iph2->dhpub_p != NULL && pfsgroup != 0)
1584 : (iph2->id_p != NULL
1589 if (iph2->dhpub_p != NULL && pfsgroup != 0) {
1591 p = set_isakmp_payload(p, iph2->dhpub,
1592 (iph2->id_p == NULL)
1598 if (iph2->id_p != NULL) {
1600 p = set_isakmp_payload(p, iph2->id_p, ISAKMP_NPTYPE_ID);
1603 p = set_isakmp_payload(p, iph2->id, natoa);
1617 struct saprop *pp = iph2->approval;
1664 tmp = vmalloc(iph2->nonce_p->l + body->l);
1670 memcpy(tmp->v, iph2->nonce_p->v, iph2->nonce_p->l);
1671 memcpy(tmp->v + iph2->nonce_p->l, body->v, body->l);
1673 hash = oakley_compute_hash1(iph2->ph1, iph2->msgid, tmp);
1681 iph2->sendbuf = quick_ir1mx(iph2, body, hash);
1682 if (iph2->sendbuf == NULL)
1686 if (isakmp_ph2send(iph2) == -1)
1690 if (add_recvdpkt(iph2->ph1->remote, iph2->ph1->local, iph2->sendbuf, iph2->msg1) == -1) {
1697 iph2->status = PHASE2ST_MSG1SENT;
1722 quick_r3recv(iph2, msg0) in quick_r3recv() argument
1723 struct ph2handle *iph2; in quick_r3recv()
1733 if (iph2->status != PHASE2ST_MSG1SENT) {
1735 "status mismatched %d.\n", iph2->status);
1741 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
1745 msg = oakley_do_decrypt(iph2->ph1, msg0, iph2->ivm->iv, iph2->ivm->ive);
1763 ph2_recv_n(iph2, pa->ptr);
1767 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
1777 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
1795 tmp = vmalloc(iph2->nonce_p->l + iph2->nonce->l);
1801 memcpy(tmp->v, iph2->nonce_p->v, iph2->nonce_p->l);
1802 memcpy(tmp->v + iph2->nonce_p->l, iph2->nonce->v, iph2->nonce->l);
1804 my_hash = oakley_compute_hash3(iph2->ph1, iph2->msgid, tmp);
1813 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
1821 if (ISSET(iph2->flags, ISAKMP_FLAG_C)) {
1822 iph2->status = PHASE2ST_COMMIT;
1824 iph2->status = PHASE2ST_STATUS6;
1842 quick_r3send(iph2, msg0) in quick_r3send() argument
1843 struct ph2handle *iph2; in quick_r3send()
1855 if (iph2->status != PHASE2ST_COMMIT) {
1857 "status mismatched %d.\n", iph2->status);
1866 tlen = sizeof(struct isakmp_pl_n) + iph2->approval->head->spisize;
1877 n->proto_id = iph2->approval->head->proto_id;
1878 n->spi_size = sizeof(iph2->approval->head->spisize);
1880 memcpy(n + 1, &iph2->approval->head->spi, iph2->approval->head->spisize);
1882 myhash = oakley_compute_hash1(iph2->ph1, iph2->msgid, notify);
1898 p = set_isakmp_header2(buf, iph2, ISAKMP_NPTYPE_HASH);
1909 isakmp_printpacket(buf, iph2->ph1->local, iph2->ph1->remote, 1);
1913 iph2->sendbuf = oakley_do_encrypt(iph2->ph1, buf, iph2->ivm->ive, iph2->ivm->iv);
1914 if (iph2->sendbuf == NULL)
1918 if (isakmp_send(iph2->ph1, iph2->sendbuf) < 0)
1922 if (add_recvdpkt(iph2->ph1->remote, iph2->ph1->local, iph2->sendbuf, msg0) == -1) {
1928 iph2->status = PHASE2ST_COMMIT;
1959 quick_r3prep(iph2, msg0) in quick_r3prep() argument
1960 struct ph2handle *iph2; in quick_r3prep()
1966 if (iph2->status != PHASE2ST_STATUS6) {
1968 "status mismatched %d.\n", iph2->status);
1973 if (oakley_compute_keymat(iph2, RESPONDER) < 0)
1976 iph2->status = PHASE2ST_ADDSA;
1977 iph2->flags ^= ISAKMP_FLAG_C; /* reset bit */
1987 if (pk_sendupdate(iph2) < 0) {
1994 if (pk_sendadd(iph2) < 0) {
2004 if (iph2->spidx_gen) {
2009 struct sockaddr *src = iph2->src;
2010 struct sockaddr *dst = iph2->dst;
2013 iph2->src = dst;
2014 iph2->dst = src;
2015 if (pk_sendspdupdate2(iph2) < 0) {
2023 spidx = (struct policyindex *)iph2->spidx_gen;
2026 if (tunnel_mode_prop(iph2->approval)) {
2028 if (pk_sendspdupdate2(iph2) < 0) {
2039 iph2->src = src;
2040 iph2->dst = dst;
2049 if (pk_sendspdupdate2(iph2) < 0) {
2058 delsp_bothdir((struct policyindex *)iph2->spidx_gen);
2059 racoon_free(iph2->spidx_gen);
2060 iph2->spidx_gen = NULL;
2061 iph2->generated_spidx=1;
2074 quick_ir1mx(iph2, body, hash) in quick_ir1mx() argument
2075 struct ph2handle *iph2; in quick_ir1mx()
2097 iph2->flags |= ISAKMP_FLAG_E;
2100 p = set_isakmp_header2(buf, iph2, ISAKMP_NPTYPE_HASH);
2112 isakmp_printpacket(buf, iph2->ph1->local, iph2->ph1->remote, 1);
2116 new = oakley_do_encrypt(iph2->ph1, buf, iph2->ivm->ive, iph2->ivm->iv);
2141 get_sainfo_r(iph2) in get_sainfo_r() argument
2142 struct ph2handle *iph2; in get_sainfo_r()
2147 if (iph2->id == NULL) {
2148 idsrc = ipsecdoi_sockaddr2id(iph2->src, IPSECDOI_PREFIX_HOST,
2151 idsrc = vdup(iph2->id);
2159 if (iph2->id_p == NULL) {
2160 iddst = ipsecdoi_sockaddr2id(iph2->dst, IPSECDOI_PREFIX_HOST,
2163 iddst = vdup(iph2->id_p);
2174 if (iph2->ph1->mode_cfg != NULL) {
2175 if ((iph2->ph1->mode_cfg->flags & ISAKMP_CFG_ADDR4_EXTERN) ||
2176 (iph2->ph1->mode_cfg->flags & ISAKMP_CFG_ADDR4_LOCAL)){
2184 &iph2->ph1->mode_cfg->addr4, sizeof(struct in_addr));
2192 client = ipsecdoi_sockaddr2id(iph2->dst, IPSECDOI_PREFIX_HOST,
2198 iph2->sainfo = getsainfo(idsrc, iddst, iph2->ph1->id_p, client, iph2->ph1->rmconf->ph1id);
2199 if (iph2->sainfo == NULL) {
2207 if (iph2->sainfo->group != NULL)
2208 if(group_check(iph2->ph1,&iph2->sainfo->group->v,1))
2213 "selected sainfo: %s\n", sainfo2str(iph2->sainfo));
2238 get_proposal_r(iph2) in get_proposal_r() argument
2239 struct ph2handle *iph2; in get_proposal_r()
2247 if ((iph2->id_p != NULL && iph2->id == NULL)
2248 || (iph2->id_p == NULL && iph2->id != NULL)) {
2255 if (iph2->sa_src || iph2->sa_dst) {
2273 if (iph2->id != NULL
2274 && (_XIDT(iph2->id) == IPSECDOI_ID_IPV4_ADDR
2275 || _XIDT(iph2->id) == IPSECDOI_ID_IPV6_ADDR
2276 || _XIDT(iph2->id) == IPSECDOI_ID_IPV4_ADDR_SUBNET
2277 || _XIDT(iph2->id) == IPSECDOI_ID_IPV6_ADDR_SUBNET)) {
2279 error = ipsecdoi_id2sockaddr(iph2->id,
2292 if (_XIDT(iph2->id) == IPSECDOI_ID_IPV6_ADDR) {
2294 iph2->src);
2300 if (_XIDT(iph2->id) == IPSECDOI_ID_IPV4_ADDR
2301 || _XIDT(iph2->id) == IPSECDOI_ID_IPV6_ADDR)
2302 idi2type = _XIDT(iph2->id);
2317 memcpy(&spidx.dst, iph2->src, sysdep_sa_len(iph2->src));
2334 if (iph2->id_p != NULL
2335 && (_XIDT(iph2->id_p) == IPSECDOI_ID_IPV4_ADDR
2336 || _XIDT(iph2->id_p) == IPSECDOI_ID_IPV6_ADDR
2337 || _XIDT(iph2->id_p) == IPSECDOI_ID_IPV4_ADDR_SUBNET
2338 || _XIDT(iph2->id_p) == IPSECDOI_ID_IPV6_ADDR_SUBNET)) {
2340 error = ipsecdoi_id2sockaddr(iph2->id_p,
2351 if (_XIDT(iph2->id_p) == IPSECDOI_ID_IPV6_ADDR) {
2353 iph2->dst);
2367 if (_XIDT(iph2->id_p) == idi2type &&
2369 iph2->sainfo && iph2->sainfo->id_i) {
2371 iph2->sa_src = dupsaddr((struct sockaddr *)&spidx.dst);
2372 if (iph2->sa_src == NULL) {
2378 iph2->sa_dst = dupsaddr((struct sockaddr *)&spidx.src);
2379 if (iph2->sa_dst == NULL) {
2391 _XIDT(iph2->id_p),idi2type);
2400 memcpy(&spidx.src, iph2->dst, sysdep_sa_len(iph2->dst));
2442 if (get_security_context(iph2->sa, &spidx)) {
2452 if (iph2->ph1->rmconf->gen_policy) {
2457 iph2->spidx_gen = racoon_malloc(sizeof(spidx));
2458 if (!iph2->spidx_gen) {
2463 memcpy(iph2->spidx_gen, &spidx, sizeof(spidx));
2472 if (iph2->ph1->rmconf->gen_policy) {
2476 iph2->spidx_gen = racoon_malloc(sizeof(spidx));
2477 if (!iph2->spidx_gen) {
2482 memcpy(iph2->spidx_gen, &spidx, sizeof(spidx));
2521 if (set_proposal_from_policy(iph2, sp_in, sp_out) < 0) {
2529 set_secctx_in_proposal(iph2, spidx);
2533 iph2->spid = sp_in->id;
2544 ph2_recv_n(iph2, gen) in ph2_recv_n() argument
2545 struct ph2handle *iph2; in ph2_recv_n()
2548 struct ph1handle *iph1 = iph2->ph1;
2558 return isakmp_info_recv_initialcontact(iph1, iph2);
2561 &iph2->lifetime_secs, &iph2->lifetime_kb);
2580 if (iph2->sainfo == NULL
2581 || iph2->sainfo->lifetime <= iph2->lifetime_secs) {
2584 iph2->lifetime_secs = 0;
2588 if (iph2->sainfo == NULL
2589 || iph2->sainfo->lifetime != iph2->lifetime_secs) {
2592 iph2->lifetime_secs = 0;
2598 isakmp_log_notify(iph2->ph1, notify, "phase2 exchange");
2599 isakmp_info_send_n2(iph2, ISAKMP_NTYPE_INVALID_PAYLOAD_TYPE,