Lines Matching refs:newsp
1567 struct secpolicy *newsp = NULL;
1570 newsp = keydb_newsecpolicy();
1571 if (!newsp)
1572 return newsp;
1574 newsp->refcnt = 1;
1575 newsp->req = NULL;
1577 return newsp;
1591 struct secpolicy *newsp;
1606 if ((newsp = key_newsp()) == NULL) {
1611 newsp->spidx.dir = xpl0->sadb_x_policy_dir;
1612 newsp->policy = xpl0->sadb_x_policy_type;
1621 newsp->req = NULL;
1628 struct ipsecrequest **p_isr = &newsp->req;
1634 key_freesp(newsp, KEY_SADB_UNLOCKED);
1648 key_freesp(newsp, KEY_SADB_UNLOCKED);
1658 key_freesp(newsp, KEY_SADB_UNLOCKED);
1676 key_freesp(newsp, KEY_SADB_UNLOCKED);
1691 key_freesp(newsp, KEY_SADB_UNLOCKED);
1721 key_freesp(newsp, KEY_SADB_UNLOCKED);
1737 key_freesp(newsp, KEY_SADB_UNLOCKED);
1754 key_freesp(newsp, KEY_SADB_UNLOCKED);
1769 key_freesp(newsp, KEY_SADB_UNLOCKED);
1777 (*p_isr)->sp = newsp;
1786 key_freesp(newsp, KEY_SADB_UNLOCKED);
1798 key_freesp(newsp, KEY_SADB_UNLOCKED);
1804 return newsp;
1988 struct secpolicy *newsp;
2067 newsp = key_getsp(&spidx);
2069 if (newsp) {
2070 newsp->state = IPSEC_SPSTATE_DEAD;
2071 key_freesp(newsp, KEY_SADB_LOCKED);
2074 if (newsp != NULL) {
2075 key_freesp(newsp, KEY_SADB_LOCKED);
2083 if ((newsp = key_msg2sp(xpl0, PFKEY_EXTLEN(xpl0), &error)) == NULL) {
2087 if ((newsp->id = key_getnewspid()) == 0) {
2088 keydb_delsecpolicy(newsp);
2099 &newsp->spidx);
2104 keydb_delsecpolicy(newsp);
2109 keydb_delsecpolicy(newsp);
2117 if (newsp->req && newsp->req->saidx.src.ss_family) {
2120 if (sa->sa_family != newsp->req->saidx.src.ss_family) {
2121 if (newsp->req->saidx.mode != IPSEC_MODE_TUNNEL || newsp->req->saidx.proto != IPPROTO_ESP
2122 || sa->sa_family != AF_INET6 || newsp->req->saidx.src.ss_family != AF_INET) {
2123 keydb_delsecpolicy(newsp);
2128 if (newsp->req && newsp->req->saidx.dst.ss_family) {
2131 if (sa->sa_family != newsp->req->saidx.dst.ss_family) {
2132 if (newsp->req->saidx.mode != IPSEC_MODE_TUNNEL || newsp->req->saidx.proto != IPPROTO_ESP
2133 || sa->sa_family != AF_INET6 || newsp->req->saidx.dst.ss_family != AF_INET) {
2134 keydb_delsecpolicy(newsp);
2142 newsp->created = tv.tv_sec;
2143 newsp->lastused = tv.tv_sec;
2144 newsp->lifetime = lft ? lft->sadb_lifetime_addtime : 0;
2145 newsp->validtime = lft ? lft->sadb_lifetime_usetime : 0;
2147 newsp->refcnt = 1; /* do not reclaim until I say I do */
2148 newsp->state = IPSEC_SPSTATE_ALIVE;
2154 if (newsp->policy == IPSEC_POLICY_GENERATE)
2155 LIST_INSERT_TAIL(&sptree[newsp->spidx.dir], newsp, secpolicy, chain);
2159 LIST_FOREACH(tmpsp, &sptree[newsp->spidx.dir], chain)
2163 LIST_INSERT_BEFORE(tmpsp, newsp, chain);
2165 LIST_INSERT_TAIL(&sptree[newsp->spidx.dir], newsp, secpolicy, chain);
2225 xpl->sadb_x_policy_id = newsp->id;