17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5f4b3ec61Sdh155122 * Common Development and Distribution License (the "License"). 6f4b3ec61Sdh155122 * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22bd670b35SErik Nordmark * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _INET_IPSECESP_H 277c478bd9Sstevel@tonic-gate #define _INET_IPSECESP_H 287c478bd9Sstevel@tonic-gate 29f4b3ec61Sdh155122 #include <inet/ip.h> 30f4b3ec61Sdh155122 #include <inet/ipdrop.h> 31f4b3ec61Sdh155122 327c478bd9Sstevel@tonic-gate #ifdef __cplusplus 337c478bd9Sstevel@tonic-gate extern "C" { 347c478bd9Sstevel@tonic-gate #endif 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #ifdef _KERNEL 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate /* Named Dispatch Parameter Management Structure */ 39f4b3ec61Sdh155122 typedef struct ipsecespparam_s { 407c478bd9Sstevel@tonic-gate uint_t ipsecesp_param_min; 417c478bd9Sstevel@tonic-gate uint_t ipsecesp_param_max; 427c478bd9Sstevel@tonic-gate uint_t ipsecesp_param_value; 437c478bd9Sstevel@tonic-gate char *ipsecesp_param_name; 447c478bd9Sstevel@tonic-gate } ipsecespparam_t; 457c478bd9Sstevel@tonic-gate 46f4b3ec61Sdh155122 /* 47f4b3ec61Sdh155122 * IPSECESP stack instances 48f4b3ec61Sdh155122 */ 49f4b3ec61Sdh155122 struct ipsecesp_stack { 50f4b3ec61Sdh155122 netstack_t *ipsecesp_netstack; /* Common netstack */ 51f4b3ec61Sdh155122 52f4b3ec61Sdh155122 caddr_t ipsecesp_g_nd; 53f4b3ec61Sdh155122 struct ipsecespparam_s *ipsecesp_params; 54f4b3ec61Sdh155122 kmutex_t ipsecesp_param_lock; /* Protects params */ 55f4b3ec61Sdh155122 56f4b3ec61Sdh155122 /* Packet dropper for ESP drops. */ 57f4b3ec61Sdh155122 ipdropper_t esp_dropper; 58f4b3ec61Sdh155122 59f4b3ec61Sdh155122 kstat_t *esp_ksp; 60f4b3ec61Sdh155122 struct esp_kstats_s *esp_kstats; 61f4b3ec61Sdh155122 62f4b3ec61Sdh155122 /* 63f4b3ec61Sdh155122 * Keysock instance of ESP. There can be only one per stack instance. 64*75d94465SJosef 'Jeff' Sipek * Use atomic_cas_ptr() on this because I don't set it until 65*75d94465SJosef 'Jeff' Sipek * KEYSOCK_HELLO comes down. 66f4b3ec61Sdh155122 * Paired up with the esp_pfkey_q is the esp_event, which will age SAs. 67f4b3ec61Sdh155122 */ 68f4b3ec61Sdh155122 queue_t *esp_pfkey_q; 69f4b3ec61Sdh155122 timeout_id_t esp_event; 70f4b3ec61Sdh155122 71f4b3ec61Sdh155122 sadbp_t esp_sadb; 72f4b3ec61Sdh155122 }; 73f4b3ec61Sdh155122 typedef struct ipsecesp_stack ipsecesp_stack_t; 74f4b3ec61Sdh155122 75437220cdSdanmcd /* Define *this* NDD variable here because we use it outside ESP proper. */ 76437220cdSdanmcd #define ipsecesp_nat_keepalive_interval \ 77437220cdSdanmcd ipsecesp_params[14].ipsecesp_param_value 78f4b3ec61Sdh155122 797c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate /* 827c478bd9Sstevel@tonic-gate * For now, only provide "aligned" version of header. 837c478bd9Sstevel@tonic-gate * If aligned version is needed, we'll go with the naming conventions then. 847c478bd9Sstevel@tonic-gate */ 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate typedef struct esph { 877c478bd9Sstevel@tonic-gate uint32_t esph_spi; 887c478bd9Sstevel@tonic-gate uint32_t esph_replay; 897c478bd9Sstevel@tonic-gate } esph_t; 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate /* No need for "old" ESP, just point a uint32_t *. */ 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate #ifdef __cplusplus 947c478bd9Sstevel@tonic-gate } 957c478bd9Sstevel@tonic-gate #endif 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate #endif /* _INET_IPSECESP_H */ 98