diff options
author | Patrick McHardy <kaber@trash.net> | 2011-01-14 08:12:37 -0500 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2011-01-14 08:12:37 -0500 |
commit | 0134e89c7bcc9fde1da962c82a120691e185619f (patch) | |
tree | 3e03335cf001019a2687d161e956de4f73379984 /net/xfrm | |
parent | c7066f70d9610df0b9406cc635fc09e86136e714 (diff) | |
parent | 6faee60a4e82075853a437831768cc9e2e563e4e (diff) |
Merge branch 'master' of git://1984.lsi.us.es/net-next-2.6
Conflicts:
net/ipv4/route.c
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net/xfrm')
-rw-r--r-- | net/xfrm/xfrm_hash.c | 2 | ||||
-rw-r--r-- | net/xfrm/xfrm_policy.c | 20 | ||||
-rw-r--r-- | net/xfrm/xfrm_state.c | 2 | ||||
-rw-r--r-- | net/xfrm/xfrm_user.c | 19 |
4 files changed, 36 insertions, 7 deletions
diff --git a/net/xfrm/xfrm_hash.c b/net/xfrm/xfrm_hash.c index a2023ec52329..1e98bc0fe0a5 100644 --- a/net/xfrm/xfrm_hash.c +++ b/net/xfrm/xfrm_hash.c | |||
@@ -19,7 +19,7 @@ struct hlist_head *xfrm_hash_alloc(unsigned int sz) | |||
19 | if (sz <= PAGE_SIZE) | 19 | if (sz <= PAGE_SIZE) |
20 | n = kzalloc(sz, GFP_KERNEL); | 20 | n = kzalloc(sz, GFP_KERNEL); |
21 | else if (hashdist) | 21 | else if (hashdist) |
22 | n = __vmalloc(sz, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL); | 22 | n = vzalloc(sz); |
23 | else | 23 | else |
24 | n = (struct hlist_head *) | 24 | n = (struct hlist_head *) |
25 | __get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, | 25 | __get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 044e77898512..8b3ef404c794 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1433,7 +1433,7 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy, | |||
1433 | } | 1433 | } |
1434 | 1434 | ||
1435 | xdst->route = dst; | 1435 | xdst->route = dst; |
1436 | memcpy(&dst1->metrics, &dst->metrics, sizeof(dst->metrics)); | 1436 | dst_copy_metrics(dst1, dst); |
1437 | 1437 | ||
1438 | if (xfrm[i]->props.mode != XFRM_MODE_TRANSPORT) { | 1438 | if (xfrm[i]->props.mode != XFRM_MODE_TRANSPORT) { |
1439 | family = xfrm[i]->props.family; | 1439 | family = xfrm[i]->props.family; |
@@ -2271,7 +2271,7 @@ static void xfrm_init_pmtu(struct dst_entry *dst) | |||
2271 | if (pmtu > route_mtu_cached) | 2271 | if (pmtu > route_mtu_cached) |
2272 | pmtu = route_mtu_cached; | 2272 | pmtu = route_mtu_cached; |
2273 | 2273 | ||
2274 | dst->metrics[RTAX_MTU-1] = pmtu; | 2274 | dst_metric_set(dst, RTAX_MTU, pmtu); |
2275 | } while ((dst = dst->next)); | 2275 | } while ((dst = dst->next)); |
2276 | } | 2276 | } |
2277 | 2277 | ||
@@ -2349,7 +2349,7 @@ static int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *first, | |||
2349 | mtu = xfrm_state_mtu(dst->xfrm, mtu); | 2349 | mtu = xfrm_state_mtu(dst->xfrm, mtu); |
2350 | if (mtu > last->route_mtu_cached) | 2350 | if (mtu > last->route_mtu_cached) |
2351 | mtu = last->route_mtu_cached; | 2351 | mtu = last->route_mtu_cached; |
2352 | dst->metrics[RTAX_MTU-1] = mtu; | 2352 | dst_metric_set(dst, RTAX_MTU, mtu); |
2353 | 2353 | ||
2354 | if (last == first) | 2354 | if (last == first) |
2355 | break; | 2355 | break; |
@@ -2361,6 +2361,16 @@ static int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *first, | |||
2361 | return 1; | 2361 | return 1; |
2362 | } | 2362 | } |
2363 | 2363 | ||
2364 | static unsigned int xfrm_default_advmss(const struct dst_entry *dst) | ||
2365 | { | ||
2366 | return dst_metric_advmss(dst->path); | ||
2367 | } | ||
2368 | |||
2369 | static unsigned int xfrm_default_mtu(const struct dst_entry *dst) | ||
2370 | { | ||
2371 | return dst_mtu(dst->path); | ||
2372 | } | ||
2373 | |||
2364 | int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo) | 2374 | int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo) |
2365 | { | 2375 | { |
2366 | struct net *net; | 2376 | struct net *net; |
@@ -2378,6 +2388,10 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo) | |||
2378 | dst_ops->kmem_cachep = xfrm_dst_cache; | 2388 | dst_ops->kmem_cachep = xfrm_dst_cache; |
2379 | if (likely(dst_ops->check == NULL)) | 2389 | if (likely(dst_ops->check == NULL)) |
2380 | dst_ops->check = xfrm_dst_check; | 2390 | dst_ops->check = xfrm_dst_check; |
2391 | if (likely(dst_ops->default_advmss == NULL)) | ||
2392 | dst_ops->default_advmss = xfrm_default_advmss; | ||
2393 | if (likely(dst_ops->default_mtu == NULL)) | ||
2394 | dst_ops->default_mtu = xfrm_default_mtu; | ||
2381 | if (likely(dst_ops->negative_advice == NULL)) | 2395 | if (likely(dst_ops->negative_advice == NULL)) |
2382 | dst_ops->negative_advice = xfrm_negative_advice; | 2396 | dst_ops->negative_advice = xfrm_negative_advice; |
2383 | if (likely(dst_ops->link_failure == NULL)) | 2397 | if (likely(dst_ops->link_failure == NULL)) |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index eb96ce52f178..220ebc05c7af 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -1268,7 +1268,7 @@ struct xfrm_state * xfrm_state_migrate(struct xfrm_state *x, | |||
1268 | 1268 | ||
1269 | return xc; | 1269 | return xc; |
1270 | error: | 1270 | error: |
1271 | kfree(xc); | 1271 | xfrm_state_put(xc); |
1272 | return NULL; | 1272 | return NULL; |
1273 | } | 1273 | } |
1274 | EXPORT_SYMBOL(xfrm_state_migrate); | 1274 | EXPORT_SYMBOL(xfrm_state_migrate); |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 8bae6b22c846..8eb889510916 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -148,7 +148,8 @@ static int verify_newsa_info(struct xfrm_usersa_info *p, | |||
148 | !attrs[XFRMA_ALG_AUTH_TRUNC]) || | 148 | !attrs[XFRMA_ALG_AUTH_TRUNC]) || |
149 | attrs[XFRMA_ALG_AEAD] || | 149 | attrs[XFRMA_ALG_AEAD] || |
150 | attrs[XFRMA_ALG_CRYPT] || | 150 | attrs[XFRMA_ALG_CRYPT] || |
151 | attrs[XFRMA_ALG_COMP]) | 151 | attrs[XFRMA_ALG_COMP] || |
152 | attrs[XFRMA_TFCPAD]) | ||
152 | goto out; | 153 | goto out; |
153 | break; | 154 | break; |
154 | 155 | ||
@@ -165,6 +166,9 @@ static int verify_newsa_info(struct xfrm_usersa_info *p, | |||
165 | attrs[XFRMA_ALG_CRYPT]) && | 166 | attrs[XFRMA_ALG_CRYPT]) && |
166 | attrs[XFRMA_ALG_AEAD]) | 167 | attrs[XFRMA_ALG_AEAD]) |
167 | goto out; | 168 | goto out; |
169 | if (attrs[XFRMA_TFCPAD] && | ||
170 | p->mode != XFRM_MODE_TUNNEL) | ||
171 | goto out; | ||
168 | break; | 172 | break; |
169 | 173 | ||
170 | case IPPROTO_COMP: | 174 | case IPPROTO_COMP: |
@@ -172,7 +176,8 @@ static int verify_newsa_info(struct xfrm_usersa_info *p, | |||
172 | attrs[XFRMA_ALG_AEAD] || | 176 | attrs[XFRMA_ALG_AEAD] || |
173 | attrs[XFRMA_ALG_AUTH] || | 177 | attrs[XFRMA_ALG_AUTH] || |
174 | attrs[XFRMA_ALG_AUTH_TRUNC] || | 178 | attrs[XFRMA_ALG_AUTH_TRUNC] || |
175 | attrs[XFRMA_ALG_CRYPT]) | 179 | attrs[XFRMA_ALG_CRYPT] || |
180 | attrs[XFRMA_TFCPAD]) | ||
176 | goto out; | 181 | goto out; |
177 | break; | 182 | break; |
178 | 183 | ||
@@ -186,6 +191,7 @@ static int verify_newsa_info(struct xfrm_usersa_info *p, | |||
186 | attrs[XFRMA_ALG_CRYPT] || | 191 | attrs[XFRMA_ALG_CRYPT] || |
187 | attrs[XFRMA_ENCAP] || | 192 | attrs[XFRMA_ENCAP] || |
188 | attrs[XFRMA_SEC_CTX] || | 193 | attrs[XFRMA_SEC_CTX] || |
194 | attrs[XFRMA_TFCPAD] || | ||
189 | !attrs[XFRMA_COADDR]) | 195 | !attrs[XFRMA_COADDR]) |
190 | goto out; | 196 | goto out; |
191 | break; | 197 | break; |
@@ -439,6 +445,9 @@ static struct xfrm_state *xfrm_state_construct(struct net *net, | |||
439 | goto error; | 445 | goto error; |
440 | } | 446 | } |
441 | 447 | ||
448 | if (attrs[XFRMA_TFCPAD]) | ||
449 | x->tfcpad = nla_get_u32(attrs[XFRMA_TFCPAD]); | ||
450 | |||
442 | if (attrs[XFRMA_COADDR]) { | 451 | if (attrs[XFRMA_COADDR]) { |
443 | x->coaddr = kmemdup(nla_data(attrs[XFRMA_COADDR]), | 452 | x->coaddr = kmemdup(nla_data(attrs[XFRMA_COADDR]), |
444 | sizeof(*x->coaddr), GFP_KERNEL); | 453 | sizeof(*x->coaddr), GFP_KERNEL); |
@@ -688,6 +697,9 @@ static int copy_to_user_state_extra(struct xfrm_state *x, | |||
688 | if (x->encap) | 697 | if (x->encap) |
689 | NLA_PUT(skb, XFRMA_ENCAP, sizeof(*x->encap), x->encap); | 698 | NLA_PUT(skb, XFRMA_ENCAP, sizeof(*x->encap), x->encap); |
690 | 699 | ||
700 | if (x->tfcpad) | ||
701 | NLA_PUT_U32(skb, XFRMA_TFCPAD, x->tfcpad); | ||
702 | |||
691 | if (xfrm_mark_put(skb, &x->mark)) | 703 | if (xfrm_mark_put(skb, &x->mark)) |
692 | goto nla_put_failure; | 704 | goto nla_put_failure; |
693 | 705 | ||
@@ -2122,6 +2134,7 @@ static const struct nla_policy xfrma_policy[XFRMA_MAX+1] = { | |||
2122 | [XFRMA_MIGRATE] = { .len = sizeof(struct xfrm_user_migrate) }, | 2134 | [XFRMA_MIGRATE] = { .len = sizeof(struct xfrm_user_migrate) }, |
2123 | [XFRMA_KMADDRESS] = { .len = sizeof(struct xfrm_user_kmaddress) }, | 2135 | [XFRMA_KMADDRESS] = { .len = sizeof(struct xfrm_user_kmaddress) }, |
2124 | [XFRMA_MARK] = { .len = sizeof(struct xfrm_mark) }, | 2136 | [XFRMA_MARK] = { .len = sizeof(struct xfrm_mark) }, |
2137 | [XFRMA_TFCPAD] = { .type = NLA_U32 }, | ||
2125 | }; | 2138 | }; |
2126 | 2139 | ||
2127 | static struct xfrm_link { | 2140 | static struct xfrm_link { |
@@ -2301,6 +2314,8 @@ static inline size_t xfrm_sa_len(struct xfrm_state *x) | |||
2301 | l += nla_total_size(sizeof(*x->calg)); | 2314 | l += nla_total_size(sizeof(*x->calg)); |
2302 | if (x->encap) | 2315 | if (x->encap) |
2303 | l += nla_total_size(sizeof(*x->encap)); | 2316 | l += nla_total_size(sizeof(*x->encap)); |
2317 | if (x->tfcpad) | ||
2318 | l += nla_total_size(sizeof(x->tfcpad)); | ||
2304 | if (x->security) | 2319 | if (x->security) |
2305 | l += nla_total_size(sizeof(struct xfrm_user_sec_ctx) + | 2320 | l += nla_total_size(sizeof(struct xfrm_user_sec_ctx) + |
2306 | x->security->ctx_len); | 2321 | x->security->ctx_len); |