Lines Matching defs:sav
248 void ipsec_send_natt_keepalive(struct secasvar *sav);
1818 /* this won't work with multiple input threads - isr->sav would change
1824 * isr->sav has been removed.
1828 if (isr->sav != NULL
1829 && isr->sav->flags == SADB_X_EXT_NONE
1830 && isr->sav->alg_auth != SADB_AALG_NONE)
2145 ipsec4_encapsulate(m, sav)
2147 struct secasvar *sav;
2155 if (((struct sockaddr *)&sav->sah->saidx.src)->sa_family
2156 != ((struct sockaddr *)&sav->sah->saidx.dst)->sa_family
2157 || ((struct sockaddr *)&sav->sah->saidx.src)->sa_family != AF_INET) {
2163 if (key_ismyaddr((struct sockaddr *)&sav->sah->saidx.dst)) {
2251 bcopy(&((struct sockaddr_in *)&sav->sah->saidx.src)->sin_addr,
2253 bcopy(&((struct sockaddr_in *)&sav->sah->saidx.dst)->sin_addr,
2265 ipsec6_encapsulate(m, sav)
2267 struct secasvar *sav;
2274 if (((struct sockaddr *)&sav->sah->saidx.src)->sa_family
2275 != ((struct sockaddr *)&sav->sah->saidx.dst)->sa_family
2276 || ((struct sockaddr *)&sav->sah->saidx.src)->sa_family != AF_INET6) {
2282 if (key_ismyaddr((struct sockaddr *)&sav->sah->saidx.dst)) {
2331 bcopy(&((struct sockaddr_in6 *)&sav->sah->saidx.src)->sin6_addr,
2333 bcopy(&((struct sockaddr_in6 *)&sav->sah->saidx.dst)->sin6_addr,
2343 ipsec64_encapsulate(m, sav)
2345 struct secasvar *sav;
2353 if (((struct sockaddr *)&sav->sah->saidx.src)->sa_family
2354 != ((struct sockaddr *)&sav->sah->saidx.dst)->sa_family
2355 || ((struct sockaddr *)&sav->sah->saidx.src)->sa_family != AF_INET) {
2361 if (key_ismyaddr((struct sockaddr *)&sav->sah->saidx.dst)) {
2420 bcopy(&((struct sockaddr_in *)&sav->sah->saidx.src)->sin_addr,
2422 bcopy(&((struct sockaddr_in *)&sav->sah->saidx.dst)->sin_addr,
2440 ipsec_chkreplay(seq, sav)
2442 struct secasvar *sav;
2452 if (sav == NULL)
2456 replay = sav->replay;
2513 ipsec_updatereplay(seq, sav)
2515 struct secasvar *sav;
2524 if (sav == NULL)
2528 replay = sav->replay;
2598 if ((sav->flags & SADB_X_EXT_CYCSEQ) == 0) {
2604 replay->overflow, ipsec_logsastr(sav)));
2697 ipsec_logsastr(sav)
2698 struct secasvar *sav;
2702 struct secasindex *saidx = &sav->sah->saidx;
2705 if (((struct sockaddr *)&sav->sah->saidx.src)->sa_family
2706 != ((struct sockaddr *)&sav->sah->saidx.dst)->sa_family)
2710 snprintf(buf, sizeof(buf), "SA(SPI=%u ", (u_int32_t)ntohl(sav->spi));
2778 struct secasvar *sav = NULL;
2866 if ((error = key_checkrequest(isr, &saidx, &sav)) != 0) {
2879 if (sav == NULL) {
2896 if (sav->state != SADB_SASTATE_MATURE
2897 && sav->state != SADB_SASTATE_DYING) {
2913 if (((struct sockaddr *)&sav->sah->saidx.src)->sa_family != AF_INET) {
2916 (u_int32_t)ntohl(sav->spi)));
2926 error = ipsec4_encapsulate(state->m, sav);
2933 state->ro = &sav->sah->sa_route;
2969 if ((error = esp4_output(state->m, sav)) != 0) {
2981 if ((error = ah4_output(state->m, sav)) != 0) {
2987 if ((error = ipcomp4_output(state->m, sav)) != 0) {
3010 if (sav)
3011 key_freesav(sav, KEY_SADB_UNLOCKED);
3015 if (sav)
3016 key_freesav(sav, KEY_SADB_UNLOCKED);
3043 struct secasvar *sav = NULL;
3103 if (key_checkrequest(isr, &saidx, &sav) == ENOENT) {
3129 if (sav == NULL) {
3143 if (sav->state != SADB_SASTATE_MATURE
3144 && sav->state != SADB_SASTATE_DYING) {
3153 error = esp6_output(state->m, nexthdrp, mprev->m_next, sav);
3160 error = ah6_output(state->m, nexthdrp, mprev->m_next, sav);
3163 error = ipcomp6_output(state->m, nexthdrp, mprev->m_next, sav);
3193 if (sav)
3194 key_freesav(sav, KEY_SADB_UNLOCKED);
3198 if (sav)
3199 key_freesav(sav, KEY_SADB_UNLOCKED);
3218 struct secasvar *sav = NULL;
3289 if (key_checkrequest(isr, &saidx, &sav) == ENOENT) {
3303 if (sav == NULL) {
3317 if (sav->state != SADB_SASTATE_MATURE
3318 && sav->state != SADB_SASTATE_DYING) {
3335 if (((struct sockaddr *)&sav->sah->saidx.src)->sa_family == AF_INET6) {
3336 error = ipsec6_encapsulate(state->m, sav);
3342 } else if (((struct sockaddr *)&sav->sah->saidx.src)->sa_family == AF_INET) {
3355 (u_int32_t)ntohl(sav->spi)));
3360 error = ipsec64_encapsulate(state->m, sav);
3368 ro4 = &sav->sah->sa_route;
3396 if ((error = esp4_output(state->m, sav)) != 0) {
3409 if ((error = ah4_output(state->m, sav)) != 0) {
3415 if ((error = ipcomp4_output(state->m, sav)) != 0) {
3442 (u_int32_t)ntohl(sav->spi)));
3448 state->ro = &sav->sah->sa_route;
3488 error = esp6_output(state->m, &ip6->ip6_nxt, state->m->m_next, sav);
3495 error = ah6_output(state->m, &ip6->ip6_nxt, state->m->m_next, sav);
3524 if (sav)
3525 key_freesav(sav, KEY_SADB_UNLOCKED);
3529 if (sav)
3530 key_freesav(sav, KEY_SADB_UNLOCKED);
3623 ipsec4_tunnel_validate(m, off, nxt0, sav, ifamily)
3627 struct secasvar *sav;
3649 if (sav->sah->saidx.mode == IPSEC_MODE_TRANSPORT)
3661 sin = (struct sockaddr_in *)&sav->sah->saidx.dst;
3730 ipsec6_tunnel_validate(m, off, nxt0, sav)
3734 struct secasvar *sav;
3753 if (sav->sah->saidx.mode == IPSEC_MODE_TRANSPORT)
3758 sin6 = (struct sockaddr_in6 *)&sav->sah->saidx.dst;
4081 struct secasvar *sav)
4090 if ((esp_udp_encap_port & 0xFFFF) == 0 || sav->remote_ike_port == 0) return;
4111 ip->ip_src = ((struct sockaddr_in*)&sav->sah->saidx.src)->sin_addr;
4112 ip->ip_dst = ((struct sockaddr_in*)&sav->sah->saidx.dst)->sin_addr;
4114 uh->uh_dport = htons(sav->remote_ike_port);
4119 error = ip_output(m, NULL, &sav->sah->sa_route, IP_NOIPSEC, NULL, NULL);
4121 sav->natt_last_activity = natt_now;