Lines Matching refs:iph1
123 isakmp_info_recv(iph1, msg0) in isakmp_info_recv() argument
124 struct ph1handle *iph1; in isakmp_info_recv()
149 if (iph1->ivm == NULL) {
155 ivm = oakley_newiv2(iph1, ((struct isakmp *)msg0->v)->msgid);
159 msg = oakley_do_decrypt(iph1, msg0, ivm->iv, ivm->ive);
187 if (iph1->status != PHASE1ST_ESTABLISHED) {
229 hash = oakley_compute_hash1(iph1, isakmp->msgid, payload);
262 switch (iph1->etype) {
266 if ((iph1->side == INITIATOR && iph1->status < PHASE1ST_MSG3SENT)
267 || (iph1->side == RESPONDER && iph1->status < PHASE1ST_MSG2SENT)) {
272 plog(LLV_ERROR, LOCATION, iph1->remote,
292 error = isakmp_info_recv_n(iph1,
297 error = isakmp_info_recv_d(iph1,
304 plog(LLV_ERROR, LOCATION, iph1->remote,
310 plog(LLV_ERROR, LOCATION, iph1->remote,
330 isakmp_info_recv_n(iph1, notify, msgid, encrypted) in isakmp_info_recv_n() argument
331 struct ph1handle *iph1; in isakmp_info_recv_n()
355 info_recv_initialcontact(iph1);
361 return isakmp_info_recv_r_u(iph1,
366 return isakmp_info_recv_r_u_ack(iph1,
377 plog(LLV_ERROR, LOCATION, iph1->remote,
381 if (getph2bymsgid(iph1, msgid) == NULL) {
382 plog(LLV_ERROR, LOCATION, iph1->remote,
387 plog(LLV_ERROR, LOCATION, iph1->remote,
394 plog(LLV_ERROR, LOCATION, iph1->remote,
406 plog(LLV_ERROR, LOCATION, iph1->remote,
412 plog(LLV_DEBUG, LOCATION, iph1->remote,
430 plog(LLV_ERROR, LOCATION, iph1->remote,
435 plog(LLV_ERROR, LOCATION, iph1->remote,
447 isakmp_info_recv_d(iph1, delete, msgid, encrypted) in isakmp_info_recv_d() argument
448 struct ph1handle *iph1; in isakmp_info_recv_d()
464 plog(LLV_ERROR, LOCATION, iph1->remote,
472 if (((iph1->mode_cfg->flags &
484 plog(LLV_ERROR, LOCATION, iph1->remote,
489 plog(LLV_DEBUG, LOCATION, iph1->remote,
493 if(!iph1->rmconf->weak_phase1_check && !encrypted) {
494 plog(LLV_WARNING, LOCATION, iph1->remote,
503 plog(LLV_ERROR, LOCATION, iph1->remote,
529 plog(LLV_ERROR, LOCATION, iph1->remote,
535 EVT_PUSH(iph1->local, iph1->remote,
537 purge_ipsec_spi(iph1->remote, delete->proto_id,
550 plog(LLV_ERROR, LOCATION, iph1->remote,
556 purge_ipsec_spi(iph1->remote, delete->proto_id,
561 plog(LLV_ERROR, LOCATION, iph1->remote,
577 isakmp_info_send_d1(iph1) in isakmp_info_send_d1() argument
578 struct ph1handle *iph1; in isakmp_info_send_d1()
585 if (iph1->status != PHASE2ST_ESTABLISHED)
607 memcpy(d + 1, &iph1->index, sizeof(isakmp_index));
609 error = isakmp_info_send_common(iph1, payload,
624 struct ph1handle *iph1; local
639 iph1 = getph1byaddr(iph2->src, iph2->dst, 0);
640 if (iph1 == NULL){
680 error = isakmp_info_send_common(iph1, payload,
698 struct ph1handle *iph1 = NULL; local
715 iph1 = newph1();
716 if (iph1 == NULL)
719 memcpy(&iph1->index.i_ck, &isakmp->i_ck, sizeof(cookie_t));
720 isakmp_newcookie((char *)&iph1->index.r_ck, remote, local);
721 iph1->status = PHASE1ST_START;
722 iph1->rmconf = rmconf;
723 iph1->side = INITIATOR;
724 iph1->version = isakmp->v;
725 iph1->flags = 0;
726 iph1->msgid = 0; /* XXX */
728 if ((iph1->mode_cfg = isakmp_cfg_mkstate()) == NULL)
732 iph1->frag = 0;
733 iph1->frag_chain = NULL;
737 if (copy_ph1addresses(iph1, rmconf, remote, local) < 0)
762 error = isakmp_info_send_common(iph1, payload, ISAKMP_NPTYPE_N, 0);
766 if (iph1 != NULL)
767 delph1(iph1);
776 isakmp_info_send_n1(iph1, type, data) in isakmp_info_send_n1() argument
777 struct ph1handle *iph1; in isakmp_info_send_n1()
815 n->doi = htonl(iph1->rmconf->doitype);
820 memcpy(n + 1, &iph1->index, sizeof(isakmp_index));
824 error = isakmp_info_send_common(iph1, payload, ISAKMP_NPTYPE_N, iph1->flags);
839 struct ph1handle *iph1 = iph2->ph1; local
874 error = isakmp_info_send_common(iph1, payload, ISAKMP_NPTYPE_N, iph2->flags);
885 isakmp_info_send_common(iph1, payload, np, flags) in isakmp_info_send_common() argument
886 struct ph1handle *iph1; in isakmp_info_send_common()
904 iph2->dst = dupsaddr(iph1->remote);
909 iph2->src = dupsaddr(iph1->local);
918 "invalid family: %d\n", iph1->remote->sa_family);
923 iph2->ph1 = iph1;
926 iph2->msgid = isakmp_newmsgid2(iph1);
929 if (iph1->skeyid_a != NULL) {
930 iph2->ivm = oakley_newiv2(iph1, iph2->msgid);
959 bindph12(iph1, iph2);
973 memcpy(&isakmp->i_ck, &iph1->index.i_ck, sizeof(cookie_t));
974 memcpy(&isakmp->r_ck, &iph1->index.r_ck, sizeof(cookie_t));
976 isakmp->v = iph1->version;
998 isakmp_printpacket(iph2->sendbuf, iph1->local, iph1->remote, 1);
1104 struct ph1handle *iph1; local
1108 iph1 = getph1byindex(&spi[i]);
1109 if (!iph1)
1117 SCHED_KILL(iph1->sce);
1118 iph1->status = PHASE1ST_EXPIRED;
1119 iph1->sce = sched_new(1, isakmp_ph1delete_stub, iph1);
1283 info_recv_initialcontact(iph1) in info_recv_initialcontact() argument
1284 struct ph1handle *iph1; in info_recv_initialcontact()
1301 loc = racoon_strdup(saddrwop2str(iph1->local));
1302 rem = racoon_strdup(saddrwop2str(iph1->remote));
1319 iph1->local, iph1->remote) == -1) {
1327 deleteallph2(iph1->local, iph1->remote, proto_id);
1334 iph1->remote, iph1->local) == -1) {
1342 deleteallph2(iph1->remote, iph1->local, proto_id);
1409 if(iph1->natt_flags & NAT_DETECTED){
1410 if (CMPSADDR(iph1->local, src) == 0 &&
1411 CMPSADDR(iph1->remote, dst) == 0)
1413 else if (CMPSADDR(iph1->remote, src) == 0 &&
1414 CMPSADDR(iph1->local, dst) == 0)
1427 if (cmpsaddrwop(iph1->local, src) == 0 &&
1428 cmpsaddrwop(iph1->remote, dst) == 0)
1430 else if (cmpsaddrwop(iph1->remote, src) == 0 &&
1431 cmpsaddrwop(iph1->local, dst) == 0)
1480 isakmp_check_notify(gen, iph1) in isakmp_check_notify() argument
1482 struct ph1handle *iph1;
1486 plog(LLV_DEBUG, LOCATION, iph1->remote,
1497 plog(LLV_WARNING, LOCATION, iph1->remote,
1502 plog(LLV_WARNING, LOCATION, iph1->remote,
1507 isakmp_info_send_n1(iph1, ISAKMP_NTYPE_INVALID_PAYLOAD_TYPE, NULL);
1508 plog(LLV_ERROR, LOCATION, iph1->remote,
1519 isakmp_info_recv_r_u (iph1, ru, msgid) in isakmp_info_recv_r_u() argument
1520 struct ph1handle *iph1; in isakmp_info_recv_r_u()
1529 plog(LLV_DEBUG, LOCATION, iph1->remote,
1554 error = isakmp_info_send_common(iph1, payload, ISAKMP_NPTYPE_N,
1565 isakmp_info_recv_r_u_ack (iph1, ru, msgid) in isakmp_info_recv_r_u_ack() argument
1566 struct ph1handle *iph1; in isakmp_info_recv_r_u_ack()
1571 plog(LLV_DEBUG, LOCATION, iph1->remote,
1577 if (ntohl(ru->data) != iph1->dpd_seq-1) {
1578 plog(LLV_ERROR, LOCATION, iph1->remote,
1580 ntohl(ru->data), iph1->dpd_seq-1);
1584 if (memcmp(ru->i_ck, iph1->index.i_ck, sizeof(cookie_t)) ||
1585 memcmp(ru->r_ck, iph1->index.r_ck, sizeof(cookie_t))) {
1586 plog(LLV_ERROR, LOCATION, iph1->remote,
1591 iph1->dpd_fails = 0;
1594 iph1->dpd_lastack = time(NULL);
1596 SCHED_KILL(iph1->dpd_r_u);
1598 isakmp_sched_r_u(iph1, 0);
1615 struct ph1handle *iph1 = arg; local
1623 plog(LLV_DEBUG, LOCATION, iph1->remote, "DPD monitoring....\n");
1625 iph1->dpd_r_u=NULL;
1627 if (iph1->dpd_fails >= iph1->rmconf->dpd_maxfails) {
1629 plog(LLV_INFO, LOCATION, iph1->remote,
1631 isakmp_pindex(&iph1->index, 0));
1633 EVT_PUSH(iph1->local, iph1->remote, EVTT_DPD_TIMEOUT, NULL);
1634 purge_remote(iph1);
1659 memcpy(ru->i_ck, iph1->index.i_ck, sizeof(cookie_t));
1660 memcpy(ru->r_ck, iph1->index.r_ck, sizeof(cookie_t));
1662 if (iph1->dpd_seq == 0){
1665 iph1->dpd_seq = rand() & 0x0fff;
1668 ru->data = htonl(iph1->dpd_seq);
1670 error = isakmp_info_send_common(iph1, payload, ISAKMP_NPTYPE_N, 0);
1673 plog(LLV_DEBUG, LOCATION, iph1->remote,
1677 iph1->dpd_fails++;
1680 iph1->dpd_seq++;
1684 isakmp_sched_r_u(iph1, 1);
1686 plog(LLV_DEBUG, LOCATION, iph1->remote,
1687 "rescheduling send_r_u (%d).\n", iph1->rmconf->dpd_retry);
1692 isakmp_sched_r_u(iph1, retry) in isakmp_sched_r_u() argument
1693 struct ph1handle *iph1; in isakmp_sched_r_u()
1696 if(iph1 == NULL ||
1697 iph1->rmconf == NULL)
1701 if(iph1->dpd_support == 0 ||
1702 iph1->rmconf->dpd_interval == 0)
1706 iph1->dpd_r_u = sched_new(iph1->rmconf->dpd_retry,
1707 isakmp_info_send_r_u, iph1);
1709 iph1->dpd_r_u = sched_new(iph1->rmconf->dpd_interval,
1710 isakmp_info_send_r_u, iph1);