Lines Matching defs:iph2
661 struct ph2handle *iph2;
695 iph2 = getph2bymsgid(iph1, msgid);
696 if (iph2 == NULL) {
712 iph2->flags |= ISAKMP_FLAG_C;
715 if (quick_main(iph2, msg) < 0) {
718 unbindph12(iph2);
719 remph2(iph2);
720 delph2(iph2);
945 quick_main(iph2, msg)
946 struct ph2handle *iph2;
956 if (iph2->status == PHASE2ST_ESTABLISHED
957 || iph2->status == PHASE2ST_GETSPISENT)
966 [iph2->side]
967 [iph2->status] == NULL) {
968 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
973 [iph2->side]
974 [iph2->status])(iph2, msg);
976 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
980 isakmp_info_send_n1(iph2->ph1, error, NULL);
985 if (iph2->status == PHASE2ST_ADDSA)
989 if (iph2->sendbuf == NULL) {
994 VPTRINIT(iph2->sendbuf);
997 SCHED_KILL(iph2->scr);
1002 [iph2->side]
1003 [iph2->status])(iph2, msg) != 0) {
1004 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
1013 s_isakmp_state(ISAKMP_ETYPE_QUICK, iph2->side, iph2->status),
1251 isakmp_ph2begin_i(iph1, iph2)
1253 struct ph2handle *iph2;
1268 a = racoon_strdup(saddr2str(iph2->src));
1273 a, saddr2str(iph2->dst));
1278 gettimeofday(&iph2->start, NULL);
1281 iph2);
1282 iph2->status = PHASE2ST_STATUS2;
1285 [iph2->side]
1286 [iph2->status])(iph2, NULL) < 0) {
1287 unbindph12(iph2);
1289 remph2(iph2);
1302 struct ph2handle *iph2 = 0;
1315 iph2 = newph2();
1316 if (iph2 == NULL) {
1322 iph2->ph1 = iph1;
1323 iph2->side = RESPONDER;
1324 iph2->status = PHASE2ST_START;
1325 iph2->flags = isakmp->flags;
1326 iph2->msgid = isakmp->msgid;
1327 iph2->seq = pk_getseq();
1328 iph2->ivm = oakley_newiv2(iph1, iph2->msgid);
1329 if (iph2->ivm == NULL) {
1330 delph2(iph2);
1333 iph2->dst = dupsaddr(iph1->remote); /* XXX should be considered */
1334 if (iph2->dst == NULL) {
1335 delph2(iph2);
1338 iph2->src = dupsaddr(iph1->local); /* XXX should be considered */
1339 if (iph2->src == NULL) {
1340 delph2(iph2);
1344 if (set_port(iph2->dst, 0) == NULL ||
1345 set_port(iph2->src, 0) == NULL) {
1347 "invalid family: %d\n", iph2->dst->sa_family);
1348 delph2(iph2);
1354 insph2(iph2);
1355 bindph12(iph1, iph2);
1361 a = racoon_strdup(saddr2str(iph2->src));
1366 a, saddr2str(iph2->dst));
1375 [iph2->side]
1376 [iph2->status])(iph2, msg);
1381 isakmp_info_send_n1(iph2->ph1, error, NULL);
1386 unbindph12(iph2);
1387 remph2(iph2);
1388 delph2(iph2);
1395 [iph2->side]
1396 [iph2->status])(iph2, msg) < 0) {
1397 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
1406 s_isakmp_state(ISAKMP_ETYPE_QUICK, iph2->side, iph2->status),
1927 struct ph2handle *iph2;
1929 iph2=(struct ph2handle *)p;
1931 if(isakmp_ph2resend(iph2) < 0){
1932 unbindph12(iph2);
1933 remph2(iph2);
1934 delph2(iph2);
1939 isakmp_ph2resend(iph2)
1940 struct ph2handle *iph2;
1944 if (iph2->ph1->status == PHASE1ST_EXPIRED){
1947 isakmp_pindex(&iph2->ph1->index, iph2->msgid));
1951 if (iph2->retry_counter <= 0) {
1954 isakmp_pindex(&iph2->ph1->index, iph2->msgid));
1955 EVT_PUSH(iph2->src, iph2->dst, EVTT_PEER_NO_RESPONSE, NULL);
1956 unbindph12(iph2);
1960 if (isakmp_send(iph2->ph1, iph2->sendbuf) < 0){
1963 isakmp_pindex(&iph2->ph1->index, iph2->msgid));
1964 EVT_PUSH(iph2->src, iph2->dst, EVTT_PEER_NO_RESPONSE, NULL);
1971 isakmp_pindex(&iph2->ph1->index, iph2->msgid));
1973 iph2->retry_counter--;
1975 iph2->scr = sched_new(iph2->ph1->rmconf->retry_interval,
1976 isakmp_ph2resend_stub, iph2);
2081 isakmp_ph2expire(iph2)
2082 struct ph2handle *iph2;
2086 SCHED_KILL(iph2->sce);
2088 src = racoon_strdup(saddrwop2str(iph2->src));
2089 dst = racoon_strdup(saddrwop2str(iph2->dst));
2098 iph2->status = PHASE2ST_EXPIRED;
2100 iph2->sce = sched_new(1, isakmp_ph2delete_stub, iph2);
2115 isakmp_ph2delete(iph2)
2116 struct ph2handle *iph2;
2120 SCHED_KILL(iph2->sce);
2122 src = racoon_strdup(saddrwop2str(iph2->src));
2123 dst = racoon_strdup(saddrwop2str(iph2->dst));
2132 unbindph12(iph2);
2133 remph2(iph2);
2134 delph2(iph2);
2148 isakmp_post_acquire(iph2)
2149 struct ph2handle *iph2;
2157 rmconf = getrmconf(iph2->dst);
2161 saddrwop2str(iph2->dst));
2170 saddrwop2str(iph2->dst));
2180 if (!extract_port(iph2->src) && !extract_port(iph2->dst)) {
2181 if ((iph1 = getph1byaddrwop(iph2->src, iph2->dst)) != NULL) {
2182 set_port(iph2->src, extract_port(iph1->local));
2183 set_port(iph2->dst, extract_port(iph1->remote));
2186 iph1 = getph1byaddr(iph2->src, iph2->dst, 0);
2189 iph1 = getph1byaddr(iph2->src, iph2->dst, 0);
2196 iph2->retry_checkph1 = lcconf->retry_checkph1;
2197 sc = sched_new(1, isakmp_chkph1there_stub, iph2);
2201 saddrwop2str(iph2->dst));
2204 if (isakmp_ph1begin_i(rmconf, iph2->dst, iph2->src) < 0) {
2215 iph2->retry_checkph1 = lcconf->retry_checkph1;
2216 sched_new(1, isakmp_chkph1there_stub, iph2);
2217 plog(LLV_INFO, LOCATION, iph2->dst,
2231 if (isakmp_ph2begin_i(iph1, iph2))
2241 isakmp_post_getspi(iph2)
2242 struct ph2handle *iph2;
2249 if (iph2->ph1->status == PHASE1ST_EXPIRED) {
2250 plog(LLV_ERROR, LOCATION, iph2->ph1->remote,
2260 [iph2->side]
2261 [iph2->status])(iph2, NULL) != 0)
2267 s_isakmp_state(ISAKMP_ETYPE_QUICK, iph2->side, iph2->status),
2283 isakmp_chkph1there(iph2)
2284 struct ph2handle *iph2;
2288 iph2->retry_checkph1--;
2289 if (iph2->retry_checkph1 < 0) {
2290 plog(LLV_ERROR, LOCATION, iph2->dst,
2293 sadbsecas2str(iph2->dst, iph2->src,
2294 iph2->satype, 0, 0));
2299 pk_sendeacquire(iph2);
2301 unbindph12(iph2);
2302 remph2(iph2);
2303 delph2(iph2);
2314 if (!extract_port(iph2->src) && !extract_port(iph2->dst)) {
2316 if( (iph1 = getph1byaddrwop(iph2->src, iph2->dst)) != NULL){
2321 iph1 = getph1byaddr(iph2->src, iph2->dst, 0);
2326 iph1 = getph1byaddr(iph2->src, iph2->dst, 0);
2339 plog(LLV_DEBUG2, LOCATION, NULL, "src: %s\n", saddr2str(iph2->src));
2340 plog(LLV_DEBUG2, LOCATION, NULL, "dst: %s\n", saddr2str(iph2->dst));
2341 set_port(iph2->src, extract_port(iph1->local));
2342 set_port(iph2->dst, extract_port(iph1->remote));
2344 plog(LLV_DEBUG2, LOCATION, NULL, "src: %s\n", saddr2str(iph2->src));
2345 plog(LLV_DEBUG2, LOCATION, NULL, "dst: %s\n", saddr2str(iph2->dst));
2348 (void)isakmp_ph2begin_i(iph1, iph2);
2355 sched_new(1, isakmp_chkph1there_stub, iph2);
2642 set_isakmp_header2(vbuf, iph2, nptype)
2644 struct ph2handle *iph2;
2647 return set_isakmp_header (vbuf, iph2->ph1, nptype, ISAKMP_ETYPE_QUICK, iph2->flags, iph2->msgid);
2915 nostate2(iph2, msg)
2916 struct ph2handle *iph2;
2919 plog(LLV_ERROR, LOCATION, iph2->ph1->remote, "wrong state %u.\n",
2920 iph2->status);
3198 struct ph2handle *iph2;
3270 iph2 = getph2bysaidx(src, dst, proto_id, sa->sadb_sa_spi);
3275 if (iph2 == NULL) {
3286 if (iph2->ph1 != NULL && iph2->ph1 != iph1){
3292 if (iph2->status == PHASE2ST_ESTABLISHED ||
3293 iph2->status == PHASE2ST_EXPIRED) {
3312 if (iph2 != NULL) {
3313 delete_spd(iph2, 0);
3314 unbindph12(iph2);
3315 remph2(iph2);
3316 delph2(iph2);
3340 delete_spd(iph2, created)
3341 struct ph2handle *iph2;
3352 if (iph2 == NULL)
3357 if (! iph2->generated_spidx )
3360 src = iph2->src;
3361 dst = iph2->dst;
3367 iph2->spidx_gen = (caddr_t )&spidx;
3370 iph2->src = dst;
3371 iph2->dst = src;
3385 if (iph2->id != NULL
3386 && (_XIDT(iph2->id) == IPSECDOI_ID_IPV4_ADDR
3387 || _XIDT(iph2->id) == IPSECDOI_ID_IPV6_ADDR
3388 || _XIDT(iph2->id) == IPSECDOI_ID_IPV4_ADDR_SUBNET
3389 || _XIDT(iph2->id) == IPSECDOI_ID_IPV6_ADDR_SUBNET)) {
3391 error = ipsecdoi_id2sockaddr(iph2->id,
3404 if (_XIDT(iph2->id) == IPSECDOI_ID_IPV6_ADDR) {
3407 iph2->src)) != 0)
3412 if (_XIDT(iph2->id) == IPSECDOI_ID_IPV4_ADDR
3413 || _XIDT(iph2->id) == IPSECDOI_ID_IPV6_ADDR)
3414 idi2type = _XIDT(iph2->id);
3429 memcpy(&spidx.dst, iph2->src, sysdep_sa_len(iph2->src));
3448 if (iph2->id_p != NULL
3449 && (_XIDT(iph2->id_p) == IPSECDOI_ID_IPV4_ADDR
3450 || _XIDT(iph2->id_p) == IPSECDOI_ID_IPV6_ADDR
3451 || _XIDT(iph2->id_p) == IPSECDOI_ID_IPV4_ADDR_SUBNET
3452 || _XIDT(iph2->id_p) == IPSECDOI_ID_IPV6_ADDR_SUBNET)) {
3454 error = ipsecdoi_id2sockaddr(iph2->id_p,
3465 if (_XIDT(iph2->id_p) == IPSECDOI_ID_IPV6_ADDR) {
3468 iph2->dst);
3475 if (_XIDT(iph2->id_p) == idi2type
3477 iph2->src_id =
3479 if (iph2->src_id == NULL) {
3484 iph2->dst_id =
3486 if (iph2->dst_id == NULL) {
3501 memcpy(&spidx.src, iph2iph2->dst));
3561 if (pk_sendspddelete(iph2) < 0) {
3571 if (tunnel_mode_prop(iph2->approval)) {
3573 if (pk_sendspddelete(iph2) < 0) {
3584 iph2->src = src;
3585 iph2->dst = dst;
3594 if (pk_sendspddelete(iph2) < 0) {
3602 iph2->spidx_gen=NULL;