Print this page
5042 stop using deprecated atomic functions
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/inet/ipsecah.h
+++ new/usr/src/uts/common/inet/ipsecah.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 26 #ifndef _INET_IPSECAH_H
27 27 #define _INET_IPSECAH_H
28 28
29 29 #include <inet/ip.h>
30 30 #include <inet/ipdrop.h>
31 31
32 32 #ifdef __cplusplus
33 33 extern "C" {
34 34 #endif
35 35
36 36 #include <sys/note.h>
37 37
38 38 #ifdef _KERNEL
39 39 /* Named Dispatch Parameter Management Structure */
40 40 typedef struct ipsecahparam_s {
41 41 uint_t ipsecah_param_min;
42 42 uint_t ipsecah_param_max;
43 43 uint_t ipsecah_param_value;
44 44 char *ipsecah_param_name;
45 45 } ipsecahparam_t;
46 46
47 47 /*
48 48 * Stats. This may eventually become a full-blown SNMP MIB once that spec
49 49 * stabilizes.
50 50 */
51 51 typedef struct ah_kstats_s
52 52 {
53 53 kstat_named_t ah_stat_num_aalgs;
54 54 kstat_named_t ah_stat_good_auth;
55 55 kstat_named_t ah_stat_bad_auth;
56 56 kstat_named_t ah_stat_replay_failures;
57 57 kstat_named_t ah_stat_replay_early_failures;
58 58 kstat_named_t ah_stat_keysock_in;
59 59 kstat_named_t ah_stat_out_requests;
60 60 kstat_named_t ah_stat_acquire_requests;
61 61 kstat_named_t ah_stat_bytes_expired;
62 62 kstat_named_t ah_stat_out_discards;
63 63 kstat_named_t ah_stat_crypto_sync;
64 64 kstat_named_t ah_stat_crypto_async;
65 65 kstat_named_t ah_stat_crypto_failures;
66 66 } ah_kstats_t;
67 67
68 68 /*
69 69 * ahstack->ah_kstats is equal to ahstack->ah_ksp->ks_data if
70 70 * kstat_create_netstack for ahstack->ah_ksp succeeds, but when it
71 71 * fails, it will be NULL. Note this is done for all stack instances,
72 72 * so it *could* fail. hence a non-NULL checking is done for
73 73 * AH_BUMP_STAT and AH_DEBUMP_STAT
74 74 */
75 75 #define AH_BUMP_STAT(ahstack, x) \
76 76 do { \
77 77 if (ahstack->ah_kstats != NULL) \
78 78 (ahstack->ah_kstats->ah_stat_ ## x).value.ui64++; \
79 79 _NOTE(CONSTCOND) \
80 80 } while (0)
81 81 #define AH_DEBUMP_STAT(ahstack, x) \
82 82 do { \
83 83 if (ahstack->ah_kstats != NULL) \
84 84 (ahstack->ah_kstats->ah_stat_ ## x).value.ui64--; \
85 85 _NOTE(CONSTCOND) \
86 86 } while (0)
87 87
88 88 /*
89 89 * IPSECAH stack instances
90 90 */
91 91 struct ipsecah_stack {
92 92 netstack_t *ipsecah_netstack; /* Common netstack */
93 93
94 94 caddr_t ipsecah_g_nd;
95 95 ipsecahparam_t *ipsecah_params;
96 96 kmutex_t ipsecah_param_lock; /* Protects params */
97 97
↓ open down ↓ |
97 lines elided |
↑ open up ↑ |
98 98 sadbp_t ah_sadb;
99 99
100 100 /* Packet dropper for AH drops. */
101 101 ipdropper_t ah_dropper;
102 102
103 103 kstat_t *ah_ksp;
104 104 ah_kstats_t *ah_kstats;
105 105
106 106 /*
107 107 * Keysock instance of AH. There can be only one per stack instance.
108 - * Use casptr() on this because I don't set it until KEYSOCK_HELLO
109 - * comes down.
108 + * Use atomic_cas_ptr() on this because I don't set it until
109 + * KEYSOCK_HELLO comes down.
110 110 * Paired up with the ah_pfkey_q is the ah_event, which will age SAs.
111 111 */
112 112 queue_t *ah_pfkey_q;
113 113 timeout_id_t ah_event;
114 114 };
115 115 typedef struct ipsecah_stack ipsecah_stack_t;
116 116
117 117 #endif /* _KERNEL */
118 118
119 119 /*
120 120 * For now, only provide "aligned" version of header.
121 121 * If aligned version is needed, we'll go with the naming conventions then.
122 122 */
123 123
124 124 typedef struct ah {
125 125 uint8_t ah_nexthdr;
126 126 uint8_t ah_length;
127 127 uint16_t ah_reserved;
128 128 uint32_t ah_spi;
129 129 uint32_t ah_replay;
130 130 } ah_t;
131 131
132 132 #define AH_BASELEN 12
133 133 #define AH_TOTAL_LEN(ah) (((ah)->ah_length << 2) + AH_BASELEN - \
134 134 sizeof ((ah)->ah_replay))
135 135
136 136 /* "Old" AH, without replay. For 1827-29 compatibility. */
137 137
138 138 typedef struct ahold {
139 139 uint8_t ah_nexthdr;
140 140 uint8_t ah_length;
141 141 uint16_t ah_reserved;
142 142 uint32_t ah_spi;
143 143 } ahold_t;
144 144
145 145 #define AHOLD_BASELEN 8
146 146 #define AHOLD_TOTAL_LEN(ah) (((ah)->ah_length << 2) + AH_BASELEN)
147 147
148 148 #ifdef __cplusplus
149 149 }
150 150 #endif
151 151
152 152 #endif /* _INET_IPSECAH_H */
↓ open down ↓ |
33 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX