Lines Matching refs:iph1
124 isakmp_info_recv(iph1, msg0)
125 struct ph1handle *iph1;
150 if (iph1->ivm == NULL) {
151 plog(LLV_ERROR, LOCATION, NULL, "iph1->ivm == NULL\n");
156 ivm = oakley_newiv2(iph1, ((struct isakmp *)msg0->v)->msgid);
160 msg = oakley_do_decrypt(iph1, msg0, ivm->iv, ivm->ive);
188 if (iph1->status != PHASE1ST_ESTABLISHED) {
230 hash = oakley_compute_hash1(iph1, isakmp->msgid, payload);
263 switch (iph1->etype) {
267 if ((iph1->side == INITIATOR && iph1->status < PHASE1ST_MSG3SENT)
268 || (iph1->side == RESPONDER && iph1->status < PHASE1ST_MSG2SENT)) {
273 plog(LLV_ERROR, LOCATION, iph1->remote,
293 error = isakmp_info_recv_n(iph1,
298 error = isakmp_info_recv_d(iph1,
305 plog(LLV_ERROR, LOCATION, iph1->remote,
311 plog(LLV_ERROR, LOCATION, iph1->remote,
331 isakmp_info_recv_n(iph1, notify, msgid, encrypted)
332 struct ph1handle *iph1;
356 info_recv_initialcontact(iph1);
362 return isakmp_info_recv_r_u(iph1,
367 return isakmp_info_recv_r_u_ack(iph1,
378 plog(LLV_ERROR, LOCATION, iph1->remote,
382 if (getph2bymsgid(iph1, msgid) == NULL) {
383 plog(LLV_ERROR, LOCATION, iph1->remote,
388 plog(LLV_ERROR, LOCATION, iph1->remote,
395 plog(LLV_ERROR, LOCATION, iph1->remote,
407 plog(LLV_ERROR, LOCATION, iph1->remote,
413 plog(LLV_DEBUG, LOCATION, iph1->remote,
431 plog(LLV_ERROR, LOCATION, iph1->remote,
436 plog(LLV_ERROR, LOCATION, iph1->remote,
448 isakmp_info_recv_d(iph1, delete, msgid, encrypted)
449 struct ph1handle *iph1;
465 plog(LLV_ERROR, LOCATION, iph1->remote,
473 if (((iph1->mode_cfg->flags &
485 plog(LLV_ERROR, LOCATION, iph1->remote,
490 plog(LLV_DEBUG, LOCATION, iph1->remote,
494 if(!iph1->rmconf->weak_phase1_check && !encrypted) {
495 plog(LLV_WARNING, LOCATION, iph1->remote,
504 plog(LLV_ERROR, LOCATION, iph1->remote,
530 plog(LLV_ERROR, LOCATION, iph1->remote,
536 EVT_PUSH(iph1->local, iph1->remote,
538 purge_ipsec_spi(iph1->remote, delete->proto_id,
551 plog(LLV_ERROR, LOCATION, iph1->remote,
557 purge_ipsec_spi(iph1->remote, delete->proto_id,
562 plog(LLV_ERROR, LOCATION, iph1->remote,
578 isakmp_info_send_d1(iph1)
579 struct ph1handle *iph1;
586 if (iph1->status != PHASE2ST_ESTABLISHED)
608 memcpy(d + 1, &iph1->index, sizeof(isakmp_index));
610 error = isakmp_info_send_common(iph1, payload,
625 struct ph1handle *iph1;
640 iph1 = getph1byaddr(iph2->src, iph2->dst, 0);
641 if (iph1 == NULL){
681 error = isakmp_info_send_common(iph1, payload,
699 struct ph1handle *iph1 = NULL;
716 iph1 = newph1();
717 if (iph1 == NULL)
720 memcpy(&iph1->index.i_ck, &isakmp->i_ck, sizeof(cookie_t));
721 isakmp_newcookie((char *)&iph1->index.r_ck, remote, local);
722 iph1->status = PHASE1ST_START;
723 iph1->rmconf = rmconf;
724 iph1->side = INITIATOR;
725 iph1->version = isakmp->v;
726 iph1->flags = 0;
727 iph1->msgid = 0; /* XXX */
729 if ((iph1->mode_cfg = isakmp_cfg_mkstate()) == NULL)
733 iph1->frag = 0;
734 iph1->frag_chain = NULL;
738 if (copy_ph1addresses(iph1, rmconf, remote, local) < 0)
763 error = isakmp_info_send_common(iph1, payload, ISAKMP_NPTYPE_N, 0);
767 if (iph1 != NULL)
768 delph1(iph1);
777 isakmp_info_send_n1(iph1, type, data)
778 struct ph1handle *iph1;
816 n->doi = htonl(iph1->rmconf->doitype);
821 memcpy(n + 1, &iph1->index, sizeof(isakmp_index));
825 error = isakmp_info_send_common(iph1, payload, ISAKMP_NPTYPE_N, iph1->flags);
840 struct ph1handle *iph1 = iph2->ph1;
875 error = isakmp_info_send_common(iph1, payload, ISAKMP_NPTYPE_N, iph2->flags);
886 isakmp_info_send_common(iph1, payload, np, flags)
887 struct ph1handle *iph1;
905 iph2->dst = dupsaddr(iph1->remote);
910 iph2->src = dupsaddr(iph1->local);
919 "invalid family: %d\n", iph1->remote->sa_family);
924 iph2->ph1 = iph1;
927 iph2->msgid = isakmp_newmsgid2(iph1);
930 if (iph1->skeyid_a != NULL) {
931 iph2->ivm = oakley_newiv2(iph1, iph2->msgid);
960 bindph12(iph1, iph2);
974 memcpy(&isakmp->i_ck, &iph1->index.i_ck, sizeof(cookie_t));
975 memcpy(&isakmp->r_ck, &iph1->index.r_ck, sizeof(cookie_t));
977 isakmp->v = iph1->version;
999 isakmp_printpacket(iph2->sendbuf, iph1->local, iph1->remote, 1);
1105 struct ph1handle *iph1;
1109 iph1 = getph1byindex(&spi[i]);
1110 if (!iph1)
1118 SCHED_KILL(iph1->sce);
1119 iph1->status = PHASE1ST_EXPIRED;
1120 iph1->sce = sched_new(1, isakmp_ph1delete_stub, iph1);
1284 info_recv_initialcontact(iph1)
1285 struct ph1handle *iph1;
1302 loc = racoon_strdup(saddrwop2str(iph1->local));
1303 rem = racoon_strdup(saddrwop2str(iph1->remote));
1320 iph1->local, iph1->remote) == -1) {
1328 deleteallph2(iph1->local, iph1->remote, proto_id);
1335 iph1->remote, iph1->local) == -1) {
1343 deleteallph2(iph1->remote, iph1->local, proto_id);
1410 if(iph1->natt_flags & NAT_DETECTED){
1411 if (CMPSADDR(iph1->local, src) == 0 &&
1412 CMPSADDR(iph1->remote, dst) == 0)
1414 else if (CMPSADDR(iph1->remote, src) == 0 &&
1415 CMPSADDR(iph1->local, dst) == 0)
1428 if (cmpsaddrwop(iph1->local, src) == 0 &&
1429 cmpsaddrwop(iph1->remote, dst) == 0)
1431 else if (cmpsaddrwop(iph1->remote, src) == 0 &&
1432 cmpsaddrwop(iph1->local, dst) == 0)
1481 isakmp_check_notify(gen, iph1)
1483 struct ph1handle *iph1;
1487 plog(LLV_DEBUG, LOCATION, iph1->remote,
1498 plog(LLV_WARNING, LOCATION, iph1->remote,
1503 plog(LLV_WARNING, LOCATION, iph1->remote,
1508 isakmp_info_send_n1(iph1, ISAKMP_NTYPE_INVALID_PAYLOAD_TYPE, NULL);
1509 plog(LLV_ERROR, LOCATION, iph1->remote,
1520 isakmp_info_recv_r_u (iph1, ru, msgid)
1521 struct ph1handle *iph1;
1530 plog(LLV_DEBUG, LOCATION, iph1->remote,
1533 /* XXX should compare cookies with iph1->index?
1555 error = isakmp_info_send_common(iph1, payload, ISAKMP_NPTYPE_N,
1566 isakmp_info_recv_r_u_ack (iph1, ru, msgid)
1567 struct ph1handle *iph1;
1572 plog(LLV_DEBUG, LOCATION, iph1->remote,
1578 if (ntohl(ru->data) != iph1->dpd_seq-1) {
1579 plog(LLV_ERROR, LOCATION, iph1->remote,
1581 ntohl(ru->data), iph1->dpd_seq-1);
1585 if (memcmp(ru->i_ck, iph1->index.i_ck, sizeof(cookie_t)) ||
1586 memcmp(ru->r_ck, iph1->index.r_ck, sizeof(cookie_t))) {
1587 plog(LLV_ERROR, LOCATION, iph1->remote,
1592 iph1->dpd_fails = 0;
1595 iph1->dpd_lastack = time(NULL);
1597 SCHED_KILL(iph1->dpd_r_u);
1599 isakmp_sched_r_u(iph1, 0);
1616 struct ph1handle *iph1 = arg;
1624 plog(LLV_DEBUG, LOCATION, iph1->remote, "DPD monitoring....\n");
1626 iph1->dpd_r_u=NULL;
1628 if (iph1->dpd_fails >= iph1->rmconf->dpd_maxfails) {
1630 plog(LLV_INFO, LOCATION, iph1->remote,
1632 isakmp_pindex(&iph1->index, 0));
1634 EVT_PUSH(iph1->local, iph1->remote, EVTT_DPD_TIMEOUT, NULL);
1635 purge_remote(iph1);
1660 memcpy(ru->i_ck, iph1->index.i_ck, sizeof(cookie_t));
1661 memcpy(ru->r_ck, iph1->index.r_ck, sizeof(cookie_t));
1663 if (iph1->dpd_seq == 0){
1666 iph1->dpd_seq = rand() & 0x0fff;
1669 ru->data = htonl(iph1->dpd_seq);
1671 error = isakmp_info_send_common(iph1, payload, ISAKMP_NPTYPE_N, 0);
1674 plog(LLV_DEBUG, LOCATION, iph1->remote,
1678 iph1->dpd_fails++;
1681 iph1->dpd_seq++;
1685 isakmp_sched_r_u(iph1, 1);
1687 plog(LLV_DEBUG, LOCATION, iph1->remote,
1688 "rescheduling send_r_u (%d).\n", iph1->rmconf->dpd_retry);
1693 isakmp_sched_r_u(iph1, retry)
1694 struct ph1handle *iph1;
1697 if(iph1 == NULL ||
1698 iph1->rmconf == NULL)
1702 if(iph1->dpd_support == 0 ||
1703 iph1->rmconf->dpd_interval == 0)
1707 iph1->dpd_r_u = sched_new(iph1->rmconf->dpd_retry,
1708 isakmp_info_send_r_u, iph1);
1710 iph1->dpd_r_u = sched_new(iph1->rmconf->dpd_interval,
1711 isakmp_info_send_r_u, iph1);