diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-08-24 03:13:10 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-22 18:08:38 -0400 |
commit | 2770834c9f44afd1bfa13914c7285470775af657 (patch) | |
tree | 40191fdc632e572bc7878f57dc8fb385109a3aa8 /net/ipv6/xfrm6_state.c | |
parent | 64d9fdda8e1bdf416b2d9203c3ad9c249ea301be (diff) |
[XFRM]: Pull xfrm_state_bydst hash table knowledge out of afinfo.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/xfrm6_state.c')
-rw-r--r-- | net/ipv6/xfrm6_state.c | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/net/ipv6/xfrm6_state.c b/net/ipv6/xfrm6_state.c index 6269584e610e..40fcaab7e028 100644 --- a/net/ipv6/xfrm6_state.c +++ b/net/ipv6/xfrm6_state.c | |||
@@ -101,61 +101,6 @@ __xfrm6_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto) | |||
101 | return NULL; | 101 | return NULL; |
102 | } | 102 | } |
103 | 103 | ||
104 | static struct xfrm_state * | ||
105 | __xfrm6_find_acq(u8 mode, u32 reqid, u8 proto, | ||
106 | xfrm_address_t *daddr, xfrm_address_t *saddr, | ||
107 | int create) | ||
108 | { | ||
109 | struct xfrm_state *x, *x0; | ||
110 | unsigned h = __xfrm6_dst_hash(daddr); | ||
111 | |||
112 | x0 = NULL; | ||
113 | |||
114 | list_for_each_entry(x, xfrm6_state_afinfo.state_bydst+h, bydst) { | ||
115 | if (x->props.family == AF_INET6 && | ||
116 | ipv6_addr_equal((struct in6_addr *)daddr, (struct in6_addr *)x->id.daddr.a6) && | ||
117 | mode == x->props.mode && | ||
118 | proto == x->id.proto && | ||
119 | ipv6_addr_equal((struct in6_addr *)saddr, (struct in6_addr *)x->props.saddr.a6) && | ||
120 | reqid == x->props.reqid && | ||
121 | x->km.state == XFRM_STATE_ACQ && | ||
122 | !x->id.spi) { | ||
123 | x0 = x; | ||
124 | break; | ||
125 | } | ||
126 | } | ||
127 | if (!x0 && create && (x0 = xfrm_state_alloc()) != NULL) { | ||
128 | ipv6_addr_copy((struct in6_addr *)x0->sel.daddr.a6, | ||
129 | (struct in6_addr *)daddr); | ||
130 | ipv6_addr_copy((struct in6_addr *)x0->sel.saddr.a6, | ||
131 | (struct in6_addr *)saddr); | ||
132 | x0->sel.prefixlen_d = 128; | ||
133 | x0->sel.prefixlen_s = 128; | ||
134 | ipv6_addr_copy((struct in6_addr *)x0->props.saddr.a6, | ||
135 | (struct in6_addr *)saddr); | ||
136 | x0->km.state = XFRM_STATE_ACQ; | ||
137 | ipv6_addr_copy((struct in6_addr *)x0->id.daddr.a6, | ||
138 | (struct in6_addr *)daddr); | ||
139 | x0->id.proto = proto; | ||
140 | x0->props.family = AF_INET6; | ||
141 | x0->props.mode = mode; | ||
142 | x0->props.reqid = reqid; | ||
143 | x0->lft.hard_add_expires_seconds = XFRM_ACQ_EXPIRES; | ||
144 | xfrm_state_hold(x0); | ||
145 | x0->timer.expires = jiffies + XFRM_ACQ_EXPIRES*HZ; | ||
146 | add_timer(&x0->timer); | ||
147 | xfrm_state_hold(x0); | ||
148 | list_add_tail(&x0->bydst, xfrm6_state_afinfo.state_bydst+h); | ||
149 | h = __xfrm6_src_hash(saddr); | ||
150 | xfrm_state_hold(x0); | ||
151 | list_add_tail(&x0->bysrc, xfrm6_state_afinfo.state_bysrc+h); | ||
152 | wake_up(&km_waitq); | ||
153 | } | ||
154 | if (x0) | ||
155 | xfrm_state_hold(x0); | ||
156 | return x0; | ||
157 | } | ||
158 | |||
159 | static int | 104 | static int |
160 | __xfrm6_state_sort(struct xfrm_state **dst, struct xfrm_state **src, int n) | 105 | __xfrm6_state_sort(struct xfrm_state **dst, struct xfrm_state **src, int n) |
161 | { | 106 | { |
@@ -280,7 +225,6 @@ static struct xfrm_state_afinfo xfrm6_state_afinfo = { | |||
280 | .init_tempsel = __xfrm6_init_tempsel, | 225 | .init_tempsel = __xfrm6_init_tempsel, |
281 | .state_lookup = __xfrm6_state_lookup, | 226 | .state_lookup = __xfrm6_state_lookup, |
282 | .state_lookup_byaddr = __xfrm6_state_lookup_byaddr, | 227 | .state_lookup_byaddr = __xfrm6_state_lookup_byaddr, |
283 | .find_acq = __xfrm6_find_acq, | ||
284 | .tmpl_sort = __xfrm6_tmpl_sort, | 228 | .tmpl_sort = __xfrm6_tmpl_sort, |
285 | .state_sort = __xfrm6_state_sort, | 229 | .state_sort = __xfrm6_state_sort, |
286 | }; | 230 | }; |