aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2007-08-22 17:00:40 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:48:24 -0400
commit35a7aa08bf7863dbfdb0eb69122d8aeaedd52748 (patch)
tree50f9bbc59d77a5d55ecff851d27ae1af80f10491
parentfab448991df4ecca6c244e23982c70f7e715b864 (diff)
[XFRM] netlink: Rename attribute array from xfrma[] to attrs[]
Increases readability a lot. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/xfrm/xfrm_user.c188
1 files changed, 94 insertions, 94 deletions
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 8c323b187e6a..7319c7f8060d 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -38,9 +38,9 @@ static inline int alg_len(struct xfrm_algo *alg)
38 return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); 38 return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
39} 39}
40 40
41static int verify_one_alg(struct rtattr **xfrma, enum xfrm_attr_type_t type) 41static int verify_one_alg(struct rtattr **attrs, enum xfrm_attr_type_t type)
42{ 42{
43 struct rtattr *rt = xfrma[type]; 43 struct rtattr *rt = attrs[type];
44 struct xfrm_algo *algp; 44 struct xfrm_algo *algp;
45 45
46 if (!rt) 46 if (!rt)
@@ -75,18 +75,18 @@ static int verify_one_alg(struct rtattr **xfrma, enum xfrm_attr_type_t type)
75 return 0; 75 return 0;
76} 76}
77 77
78static void verify_one_addr(struct rtattr **xfrma, enum xfrm_attr_type_t type, 78static void verify_one_addr(struct rtattr **attrs, enum xfrm_attr_type_t type,
79 xfrm_address_t **addrp) 79 xfrm_address_t **addrp)
80{ 80{
81 struct rtattr *rt = xfrma[type]; 81 struct rtattr *rt = attrs[type];
82 82
83 if (rt && addrp) 83 if (rt && addrp)
84 *addrp = RTA_DATA(rt); 84 *addrp = RTA_DATA(rt);
85} 85}
86 86
87static inline int verify_sec_ctx_len(struct rtattr **xfrma) 87static inline int verify_sec_ctx_len(struct rtattr **attrs)
88{ 88{
89 struct rtattr *rt = xfrma[XFRMA_SEC_CTX]; 89 struct rtattr *rt = attrs[XFRMA_SEC_CTX];
90 struct xfrm_user_sec_ctx *uctx; 90 struct xfrm_user_sec_ctx *uctx;
91 91
92 if (!rt) 92 if (!rt)
@@ -101,7 +101,7 @@ static inline int verify_sec_ctx_len(struct rtattr **xfrma)
101 101
102 102
103static int verify_newsa_info(struct xfrm_usersa_info *p, 103static int verify_newsa_info(struct xfrm_usersa_info *p,
104 struct rtattr **xfrma) 104 struct rtattr **attrs)
105{ 105{
106 int err; 106 int err;
107 107
@@ -125,35 +125,35 @@ static int verify_newsa_info(struct xfrm_usersa_info *p,
125 err = -EINVAL; 125 err = -EINVAL;
126 switch (p->id.proto) { 126 switch (p->id.proto) {
127 case IPPROTO_AH: 127 case IPPROTO_AH:
128 if (!xfrma[XFRMA_ALG_AUTH] || 128 if (!attrs[XFRMA_ALG_AUTH] ||
129 xfrma[XFRMA_ALG_CRYPT] || 129 attrs[XFRMA_ALG_CRYPT] ||
130 xfrma[XFRMA_ALG_COMP]) 130 attrs[XFRMA_ALG_COMP])
131 goto out; 131 goto out;
132 break; 132 break;
133 133
134 case IPPROTO_ESP: 134 case IPPROTO_ESP:
135 if ((!xfrma[XFRMA_ALG_AUTH] && 135 if ((!attrs[XFRMA_ALG_AUTH] &&
136 !xfrma[XFRMA_ALG_CRYPT]) || 136 !attrs[XFRMA_ALG_CRYPT]) ||
137 xfrma[XFRMA_ALG_COMP]) 137 attrs[XFRMA_ALG_COMP])
138 goto out; 138 goto out;
139 break; 139 break;
140 140
141 case IPPROTO_COMP: 141 case IPPROTO_COMP:
142 if (!xfrma[XFRMA_ALG_COMP] || 142 if (!attrs[XFRMA_ALG_COMP] ||
143 xfrma[XFRMA_ALG_AUTH] || 143 attrs[XFRMA_ALG_AUTH] ||
144 xfrma[XFRMA_ALG_CRYPT]) 144 attrs[XFRMA_ALG_CRYPT])
145 goto out; 145 goto out;
146 break; 146 break;
147 147
148#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 148#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
149 case IPPROTO_DSTOPTS: 149 case IPPROTO_DSTOPTS:
150 case IPPROTO_ROUTING: 150 case IPPROTO_ROUTING:
151 if (xfrma[XFRMA_ALG_COMP] || 151 if (attrs[XFRMA_ALG_COMP] ||
152 xfrma[XFRMA_ALG_AUTH] || 152 attrs[XFRMA_ALG_AUTH] ||
153 xfrma[XFRMA_ALG_CRYPT] || 153 attrs[XFRMA_ALG_CRYPT] ||
154 xfrma[XFRMA_ENCAP] || 154 attrs[XFRMA_ENCAP] ||
155 xfrma[XFRMA_SEC_CTX] || 155 attrs[XFRMA_SEC_CTX] ||
156 !xfrma[XFRMA_COADDR]) 156 !attrs[XFRMA_COADDR])
157 goto out; 157 goto out;
158 break; 158 break;
159#endif 159#endif
@@ -162,13 +162,13 @@ static int verify_newsa_info(struct xfrm_usersa_info *p,
162 goto out; 162 goto out;
163 } 163 }
164 164
165 if ((err = verify_one_alg(xfrma, XFRMA_ALG_AUTH))) 165 if ((err = verify_one_alg(attrs, XFRMA_ALG_AUTH)))
166 goto out; 166 goto out;
167 if ((err = verify_one_alg(xfrma, XFRMA_ALG_CRYPT))) 167 if ((err = verify_one_alg(attrs, XFRMA_ALG_CRYPT)))
168 goto out; 168 goto out;
169 if ((err = verify_one_alg(xfrma, XFRMA_ALG_COMP))) 169 if ((err = verify_one_alg(attrs, XFRMA_ALG_COMP)))
170 goto out; 170 goto out;
171 if ((err = verify_sec_ctx_len(xfrma))) 171 if ((err = verify_sec_ctx_len(attrs)))
172 goto out; 172 goto out;
173 173
174 err = -EINVAL; 174 err = -EINVAL;
@@ -298,12 +298,12 @@ static void copy_from_user_state(struct xfrm_state *x, struct xfrm_usersa_info *
298 * somehow made shareable and move it to xfrm_state.c - JHS 298 * somehow made shareable and move it to xfrm_state.c - JHS
299 * 299 *
300*/ 300*/
301static void xfrm_update_ae_params(struct xfrm_state *x, struct rtattr **xfrma) 301static void xfrm_update_ae_params(struct xfrm_state *x, struct rtattr **attrs)
302{ 302{
303 struct rtattr *rp = xfrma[XFRMA_REPLAY_VAL]; 303 struct rtattr *rp = attrs[XFRMA_REPLAY_VAL];
304 struct rtattr *lt = xfrma[XFRMA_LTIME_VAL]; 304 struct rtattr *lt = attrs[XFRMA_LTIME_VAL];
305 struct rtattr *et = xfrma[XFRMA_ETIMER_THRESH]; 305 struct rtattr *et = attrs[XFRMA_ETIMER_THRESH];
306 struct rtattr *rt = xfrma[XFRMA_REPLAY_THRESH]; 306 struct rtattr *rt = attrs[XFRMA_REPLAY_THRESH];
307 307
308 if (rp) { 308 if (rp) {
309 struct xfrm_replay_state *replay; 309 struct xfrm_replay_state *replay;
@@ -329,7 +329,7 @@ static void xfrm_update_ae_params(struct xfrm_state *x, struct rtattr **xfrma)
329} 329}
330 330
331static struct xfrm_state *xfrm_state_construct(struct xfrm_usersa_info *p, 331static struct xfrm_state *xfrm_state_construct(struct xfrm_usersa_info *p,
332 struct rtattr **xfrma, 332 struct rtattr **attrs,
333 int *errp) 333 int *errp)
334{ 334{
335 struct xfrm_state *x = xfrm_state_alloc(); 335 struct xfrm_state *x = xfrm_state_alloc();
@@ -342,25 +342,25 @@ static struct xfrm_state *xfrm_state_construct(struct xfrm_usersa_info *p,
342 342
343 if ((err = attach_one_algo(&x->aalg, &x->props.aalgo, 343 if ((err = attach_one_algo(&x->aalg, &x->props.aalgo,
344 xfrm_aalg_get_byname, 344 xfrm_aalg_get_byname,
345 xfrma[XFRMA_ALG_AUTH]))) 345 attrs[XFRMA_ALG_AUTH])))
346 goto error; 346 goto error;
347 if ((err = attach_one_algo(&x->ealg, &x->props.ealgo, 347 if ((err = attach_one_algo(&x->ealg, &x->props.ealgo,
348 xfrm_ealg_get_byname, 348 xfrm_ealg_get_byname,
349 xfrma[XFRMA_ALG_CRYPT]))) 349 attrs[XFRMA_ALG_CRYPT])))
350 goto error; 350 goto error;
351 if ((err = attach_one_algo(&x->calg, &x->props.calgo, 351 if ((err = attach_one_algo(&x->calg, &x->props.calgo,
352 xfrm_calg_get_byname, 352 xfrm_calg_get_byname,
353 xfrma[XFRMA_ALG_COMP]))) 353 attrs[XFRMA_ALG_COMP])))
354 goto error; 354 goto error;
355 if ((err = attach_encap_tmpl(&x->encap, xfrma[XFRMA_ENCAP]))) 355 if ((err = attach_encap_tmpl(&x->encap, attrs[XFRMA_ENCAP])))
356 goto error; 356 goto error;
357 if ((err = attach_one_addr(&x->coaddr, xfrma[XFRMA_COADDR]))) 357 if ((err = attach_one_addr(&x->coaddr, attrs[XFRMA_COADDR])))
358 goto error; 358 goto error;
359 err = xfrm_init_state(x); 359 err = xfrm_init_state(x);
360 if (err) 360 if (err)
361 goto error; 361 goto error;
362 362
363 if ((err = attach_sec_ctx(x, xfrma[XFRMA_SEC_CTX]))) 363 if ((err = attach_sec_ctx(x, attrs[XFRMA_SEC_CTX])))
364 goto error; 364 goto error;
365 365
366 x->km.seq = p->seq; 366 x->km.seq = p->seq;
@@ -373,7 +373,7 @@ static struct xfrm_state *xfrm_state_construct(struct xfrm_usersa_info *p,
373 373
374 /* override default values from above */ 374 /* override default values from above */
375 375
376 xfrm_update_ae_params(x, (struct rtattr **)xfrma); 376 xfrm_update_ae_params(x, (struct rtattr **)attrs);
377 377
378 return x; 378 return x;
379 379
@@ -386,18 +386,18 @@ error_no_put:
386} 386}
387 387
388static int xfrm_add_sa(struct sk_buff *skb, struct nlmsghdr *nlh, 388static int xfrm_add_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
389 struct rtattr **xfrma) 389 struct rtattr **attrs)
390{ 390{
391 struct xfrm_usersa_info *p = nlmsg_data(nlh); 391 struct xfrm_usersa_info *p = nlmsg_data(nlh);
392 struct xfrm_state *x; 392 struct xfrm_state *x;
393 int err; 393 int err;
394 struct km_event c; 394 struct km_event c;
395 395
396 err = verify_newsa_info(p, xfrma); 396 err = verify_newsa_info(p, attrs);
397 if (err) 397 if (err)
398 return err; 398 return err;
399 399
400 x = xfrm_state_construct(p, xfrma, &err); 400 x = xfrm_state_construct(p, attrs, &err);
401 if (!x) 401 if (!x)
402 return err; 402 return err;
403 403
@@ -427,7 +427,7 @@ out:
427} 427}
428 428
429static struct xfrm_state *xfrm_user_state_lookup(struct xfrm_usersa_id *p, 429static struct xfrm_state *xfrm_user_state_lookup(struct xfrm_usersa_id *p,
430 struct rtattr **xfrma, 430 struct rtattr **attrs,
431 int *errp) 431 int *errp)
432{ 432{
433 struct xfrm_state *x = NULL; 433 struct xfrm_state *x = NULL;
@@ -439,7 +439,7 @@ static struct xfrm_state *xfrm_user_state_lookup(struct xfrm_usersa_id *p,
439 } else { 439 } else {
440 xfrm_address_t *saddr = NULL; 440 xfrm_address_t *saddr = NULL;
441 441
442 verify_one_addr(xfrma, XFRMA_SRCADDR, &saddr); 442 verify_one_addr(attrs, XFRMA_SRCADDR, &saddr);
443 if (!saddr) { 443 if (!saddr) {
444 err = -EINVAL; 444 err = -EINVAL;
445 goto out; 445 goto out;
@@ -457,14 +457,14 @@ static struct xfrm_state *xfrm_user_state_lookup(struct xfrm_usersa_id *p,
457} 457}
458 458
459static int xfrm_del_sa(struct sk_buff *skb, struct nlmsghdr *nlh, 459static int xfrm_del_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
460 struct rtattr **xfrma) 460 struct rtattr **attrs)
461{ 461{
462 struct xfrm_state *x; 462 struct xfrm_state *x;
463 int err = -ESRCH; 463 int err = -ESRCH;
464 struct km_event c; 464 struct km_event c;
465 struct xfrm_usersa_id *p = nlmsg_data(nlh); 465 struct xfrm_usersa_id *p = nlmsg_data(nlh);
466 466
467 x = xfrm_user_state_lookup(p, xfrma, &err); 467 x = xfrm_user_state_lookup(p, attrs, &err);
468 if (x == NULL) 468 if (x == NULL)
469 return err; 469 return err;
470 470
@@ -669,7 +669,7 @@ nla_put_failure:
669} 669}
670 670
671static int xfrm_get_spdinfo(struct sk_buff *skb, struct nlmsghdr *nlh, 671static int xfrm_get_spdinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
672 struct rtattr **xfrma) 672 struct rtattr **attrs)
673{ 673{
674 struct sk_buff *r_skb; 674 struct sk_buff *r_skb;
675 u32 *flags = nlmsg_data(nlh); 675 u32 *flags = nlmsg_data(nlh);
@@ -722,7 +722,7 @@ nla_put_failure:
722} 722}
723 723
724static int xfrm_get_sadinfo(struct sk_buff *skb, struct nlmsghdr *nlh, 724static int xfrm_get_sadinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
725 struct rtattr **xfrma) 725 struct rtattr **attrs)
726{ 726{
727 struct sk_buff *r_skb; 727 struct sk_buff *r_skb;
728 u32 *flags = nlmsg_data(nlh); 728 u32 *flags = nlmsg_data(nlh);
@@ -740,14 +740,14 @@ static int xfrm_get_sadinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
740} 740}
741 741
742static int xfrm_get_sa(struct sk_buff *skb, struct nlmsghdr *nlh, 742static int xfrm_get_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
743 struct rtattr **xfrma) 743 struct rtattr **attrs)
744{ 744{
745 struct xfrm_usersa_id *p = nlmsg_data(nlh); 745 struct xfrm_usersa_id *p = nlmsg_data(nlh);
746 struct xfrm_state *x; 746 struct xfrm_state *x;
747 struct sk_buff *resp_skb; 747 struct sk_buff *resp_skb;
748 int err = -ESRCH; 748 int err = -ESRCH;
749 749
750 x = xfrm_user_state_lookup(p, xfrma, &err); 750 x = xfrm_user_state_lookup(p, attrs, &err);
751 if (x == NULL) 751 if (x == NULL)
752 goto out_noput; 752 goto out_noput;
753 753
@@ -786,7 +786,7 @@ static int verify_userspi_info(struct xfrm_userspi_info *p)
786} 786}
787 787
788static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh, 788static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh,
789 struct rtattr **xfrma) 789 struct rtattr **attrs)
790{ 790{
791 struct xfrm_state *x; 791 struct xfrm_state *x;
792 struct xfrm_userspi_info *p; 792 struct xfrm_userspi_info *p;
@@ -915,9 +915,9 @@ static int verify_newpolicy_info(struct xfrm_userpolicy_info *p)
915 return verify_policy_dir(p->dir); 915 return verify_policy_dir(p->dir);
916} 916}
917 917
918static int copy_from_user_sec_ctx(struct xfrm_policy *pol, struct rtattr **xfrma) 918static int copy_from_user_sec_ctx(struct xfrm_policy *pol, struct rtattr **attrs)
919{ 919{
920 struct rtattr *rt = xfrma[XFRMA_SEC_CTX]; 920 struct rtattr *rt = attrs[XFRMA_SEC_CTX];
921 struct xfrm_user_sec_ctx *uctx; 921 struct xfrm_user_sec_ctx *uctx;
922 922
923 if (!rt) 923 if (!rt)
@@ -983,9 +983,9 @@ static int validate_tmpl(int nr, struct xfrm_user_tmpl *ut, u16 family)
983 return 0; 983 return 0;
984} 984}
985 985
986static int copy_from_user_tmpl(struct xfrm_policy *pol, struct rtattr **xfrma) 986static int copy_from_user_tmpl(struct xfrm_policy *pol, struct rtattr **attrs)
987{ 987{
988 struct rtattr *rt = xfrma[XFRMA_TMPL]; 988 struct rtattr *rt = attrs[XFRMA_TMPL];
989 989
990 if (!rt) { 990 if (!rt) {
991 pol->xfrm_nr = 0; 991 pol->xfrm_nr = 0;
@@ -1003,9 +1003,9 @@ static int copy_from_user_tmpl(struct xfrm_policy *pol, struct rtattr **xfrma)
1003 return 0; 1003 return 0;
1004} 1004}
1005 1005
1006static int copy_from_user_policy_type(u8 *tp, struct rtattr **xfrma) 1006static int copy_from_user_policy_type(u8 *tp, struct rtattr **attrs)
1007{ 1007{
1008 struct rtattr *rt = xfrma[XFRMA_POLICY_TYPE]; 1008 struct rtattr *rt = attrs[XFRMA_POLICY_TYPE];
1009 struct xfrm_userpolicy_type *upt; 1009 struct xfrm_userpolicy_type *upt;
1010 u8 type = XFRM_POLICY_TYPE_MAIN; 1010 u8 type = XFRM_POLICY_TYPE_MAIN;
1011 int err; 1011 int err;
@@ -1049,7 +1049,7 @@ static void copy_to_user_policy(struct xfrm_policy *xp, struct xfrm_userpolicy_i
1049 p->share = XFRM_SHARE_ANY; /* XXX xp->share */ 1049 p->share = XFRM_SHARE_ANY; /* XXX xp->share */
1050} 1050}
1051 1051
1052static struct xfrm_policy *xfrm_policy_construct(struct xfrm_userpolicy_info *p, struct rtattr **xfrma, int *errp) 1052static struct xfrm_policy *xfrm_policy_construct(struct xfrm_userpolicy_info *p, struct rtattr **attrs, int *errp)
1053{ 1053{
1054 struct xfrm_policy *xp = xfrm_policy_alloc(GFP_KERNEL); 1054 struct xfrm_policy *xp = xfrm_policy_alloc(GFP_KERNEL);
1055 int err; 1055 int err;
@@ -1061,12 +1061,12 @@ static struct xfrm_policy *xfrm_policy_construct(struct xfrm_userpolicy_info *p,
1061 1061
1062 copy_from_user_policy(xp, p); 1062 copy_from_user_policy(xp, p);
1063 1063
1064 err = copy_from_user_policy_type(&xp->type, xfrma); 1064 err = copy_from_user_policy_type(&xp->type, attrs);
1065 if (err) 1065 if (err)
1066 goto error; 1066 goto error;
1067 1067
1068 if (!(err = copy_from_user_tmpl(xp, xfrma))) 1068 if (!(err = copy_from_user_tmpl(xp, attrs)))
1069 err = copy_from_user_sec_ctx(xp, xfrma); 1069 err = copy_from_user_sec_ctx(xp, attrs);
1070 if (err) 1070 if (err)
1071 goto error; 1071 goto error;
1072 1072
@@ -1078,7 +1078,7 @@ static struct xfrm_policy *xfrm_policy_construct(struct xfrm_userpolicy_info *p,
1078} 1078}
1079 1079
1080static int xfrm_add_policy(struct sk_buff *skb, struct nlmsghdr *nlh, 1080static int xfrm_add_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1081 struct rtattr **xfrma) 1081 struct rtattr **attrs)
1082{ 1082{
1083 struct xfrm_userpolicy_info *p = nlmsg_data(nlh); 1083 struct xfrm_userpolicy_info *p = nlmsg_data(nlh);
1084 struct xfrm_policy *xp; 1084 struct xfrm_policy *xp;
@@ -1089,11 +1089,11 @@ static int xfrm_add_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1089 err = verify_newpolicy_info(p); 1089 err = verify_newpolicy_info(p);
1090 if (err) 1090 if (err)
1091 return err; 1091 return err;
1092 err = verify_sec_ctx_len(xfrma); 1092 err = verify_sec_ctx_len(attrs);
1093 if (err) 1093 if (err)
1094 return err; 1094 return err;
1095 1095
1096 xp = xfrm_policy_construct(p, xfrma, &err); 1096 xp = xfrm_policy_construct(p, attrs, &err);
1097 if (!xp) 1097 if (!xp)
1098 return err; 1098 return err;
1099 1099
@@ -1271,7 +1271,7 @@ static struct sk_buff *xfrm_policy_netlink(struct sk_buff *in_skb,
1271} 1271}
1272 1272
1273static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, 1273static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1274 struct rtattr **xfrma) 1274 struct rtattr **attrs)
1275{ 1275{
1276 struct xfrm_policy *xp; 1276 struct xfrm_policy *xp;
1277 struct xfrm_userpolicy_id *p; 1277 struct xfrm_userpolicy_id *p;
@@ -1283,7 +1283,7 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1283 p = nlmsg_data(nlh); 1283 p = nlmsg_data(nlh);
1284 delete = nlh->nlmsg_type == XFRM_MSG_DELPOLICY; 1284 delete = nlh->nlmsg_type == XFRM_MSG_DELPOLICY;
1285 1285
1286 err = copy_from_user_policy_type(&type, xfrma); 1286 err = copy_from_user_policy_type(&type, attrs);
1287 if (err) 1287 if (err)
1288 return err; 1288 return err;
1289 1289
@@ -1294,10 +1294,10 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1294 if (p->index) 1294 if (p->index)
1295 xp = xfrm_policy_byid(type, p->dir, p->index, delete, &err); 1295 xp = xfrm_policy_byid(type, p->dir, p->index, delete, &err);
1296 else { 1296 else {
1297 struct rtattr *rt = xfrma[XFRMA_SEC_CTX]; 1297 struct rtattr *rt = attrs[XFRMA_SEC_CTX];
1298 struct xfrm_policy tmp; 1298 struct xfrm_policy tmp;
1299 1299
1300 err = verify_sec_ctx_len(xfrma); 1300 err = verify_sec_ctx_len(attrs);
1301 if (err) 1301 if (err)
1302 return err; 1302 return err;
1303 1303
@@ -1345,7 +1345,7 @@ out:
1345} 1345}
1346 1346
1347static int xfrm_flush_sa(struct sk_buff *skb, struct nlmsghdr *nlh, 1347static int xfrm_flush_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
1348 struct rtattr **xfrma) 1348 struct rtattr **attrs)
1349{ 1349{
1350 struct km_event c; 1350 struct km_event c;
1351 struct xfrm_usersa_flush *p = nlmsg_data(nlh); 1351 struct xfrm_usersa_flush *p = nlmsg_data(nlh);
@@ -1411,7 +1411,7 @@ nla_put_failure:
1411} 1411}
1412 1412
1413static int xfrm_get_ae(struct sk_buff *skb, struct nlmsghdr *nlh, 1413static int xfrm_get_ae(struct sk_buff *skb, struct nlmsghdr *nlh,
1414 struct rtattr **xfrma) 1414 struct rtattr **attrs)
1415{ 1415{
1416 struct xfrm_state *x; 1416 struct xfrm_state *x;
1417 struct sk_buff *r_skb; 1417 struct sk_buff *r_skb;
@@ -1449,14 +1449,14 @@ static int xfrm_get_ae(struct sk_buff *skb, struct nlmsghdr *nlh,
1449} 1449}
1450 1450
1451static int xfrm_new_ae(struct sk_buff *skb, struct nlmsghdr *nlh, 1451static int xfrm_new_ae(struct sk_buff *skb, struct nlmsghdr *nlh,
1452 struct rtattr **xfrma) 1452 struct rtattr **attrs)
1453{ 1453{
1454 struct xfrm_state *x; 1454 struct xfrm_state *x;
1455 struct km_event c; 1455 struct km_event c;
1456 int err = - EINVAL; 1456 int err = - EINVAL;
1457 struct xfrm_aevent_id *p = nlmsg_data(nlh); 1457 struct xfrm_aevent_id *p = nlmsg_data(nlh);
1458 struct rtattr *rp = xfrma[XFRMA_REPLAY_VAL]; 1458 struct rtattr *rp = attrs[XFRMA_REPLAY_VAL];
1459 struct rtattr *lt = xfrma[XFRMA_LTIME_VAL]; 1459 struct rtattr *lt = attrs[XFRMA_LTIME_VAL];
1460 1460
1461 if (!lt && !rp) 1461 if (!lt && !rp)
1462 return err; 1462 return err;
@@ -1473,7 +1473,7 @@ static int xfrm_new_ae(struct sk_buff *skb, struct nlmsghdr *nlh,
1473 goto out; 1473 goto out;
1474 1474
1475 spin_lock_bh(&x->lock); 1475 spin_lock_bh(&x->lock);
1476 xfrm_update_ae_params(x, xfrma); 1476 xfrm_update_ae_params(x, attrs);
1477 spin_unlock_bh(&x->lock); 1477 spin_unlock_bh(&x->lock);
1478 1478
1479 c.event = nlh->nlmsg_type; 1479 c.event = nlh->nlmsg_type;
@@ -1488,14 +1488,14 @@ out:
1488} 1488}
1489 1489
1490static int xfrm_flush_policy(struct sk_buff *skb, struct nlmsghdr *nlh, 1490static int xfrm_flush_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1491 struct rtattr **xfrma) 1491 struct rtattr **attrs)
1492{ 1492{
1493 struct km_event c; 1493 struct km_event c;
1494 u8 type = XFRM_POLICY_TYPE_MAIN; 1494 u8 type = XFRM_POLICY_TYPE_MAIN;
1495 int err; 1495 int err;
1496 struct xfrm_audit audit_info; 1496 struct xfrm_audit audit_info;
1497 1497
1498 err = copy_from_user_policy_type(&type, xfrma); 1498 err = copy_from_user_policy_type(&type, attrs);
1499 if (err) 1499 if (err)
1500 return err; 1500 return err;
1501 1501
@@ -1513,7 +1513,7 @@ static int xfrm_flush_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1513} 1513}
1514 1514
1515static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh, 1515static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
1516 struct rtattr **xfrma) 1516 struct rtattr **attrs)
1517{ 1517{
1518 struct xfrm_policy *xp; 1518 struct xfrm_policy *xp;
1519 struct xfrm_user_polexpire *up = nlmsg_data(nlh); 1519 struct xfrm_user_polexpire *up = nlmsg_data(nlh);
@@ -1521,17 +1521,17 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
1521 u8 type = XFRM_POLICY_TYPE_MAIN; 1521 u8 type = XFRM_POLICY_TYPE_MAIN;
1522 int err = -ENOENT; 1522 int err = -ENOENT;
1523 1523
1524 err = copy_from_user_policy_type(&type, xfrma); 1524 err = copy_from_user_policy_type(&type, attrs);
1525 if (err) 1525 if (err)
1526 return err; 1526 return err;
1527 1527
1528 if (p->index) 1528 if (p->index)
1529 xp = xfrm_policy_byid(type, p->dir, p->index, 0, &err); 1529 xp = xfrm_policy_byid(type, p->dir, p->index, 0, &err);
1530 else { 1530 else {
1531 struct rtattr *rt = xfrma[XFRMA_SEC_CTX]; 1531 struct rtattr *rt = attrs[XFRMA_SEC_CTX];
1532 struct xfrm_policy tmp; 1532 struct xfrm_policy tmp;
1533 1533
1534 err = verify_sec_ctx_len(xfrma); 1534 err = verify_sec_ctx_len(attrs);
1535 if (err) 1535 if (err)
1536 return err; 1536 return err;
1537 1537
@@ -1574,7 +1574,7 @@ out:
1574} 1574}
1575 1575
1576static int xfrm_add_sa_expire(struct sk_buff *skb, struct nlmsghdr *nlh, 1576static int xfrm_add_sa_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
1577 struct rtattr **xfrma) 1577 struct rtattr **attrs)
1578{ 1578{
1579 struct xfrm_state *x; 1579 struct xfrm_state *x;
1580 int err; 1580 int err;
@@ -1606,12 +1606,12 @@ out:
1606} 1606}
1607 1607
1608static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh, 1608static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh,
1609 struct rtattr **xfrma) 1609 struct rtattr **attrs)
1610{ 1610{
1611 struct xfrm_policy *xp; 1611 struct xfrm_policy *xp;
1612 struct xfrm_user_tmpl *ut; 1612 struct xfrm_user_tmpl *ut;
1613 int i; 1613 int i;
1614 struct rtattr *rt = xfrma[XFRMA_TMPL]; 1614 struct rtattr *rt = attrs[XFRMA_TMPL];
1615 1615
1616 struct xfrm_user_acquire *ua = nlmsg_data(nlh); 1616 struct xfrm_user_acquire *ua = nlmsg_data(nlh);
1617 struct xfrm_state *x = xfrm_state_alloc(); 1617 struct xfrm_state *x = xfrm_state_alloc();
@@ -1628,7 +1628,7 @@ static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh,
1628 } 1628 }
1629 1629
1630 /* build an XP */ 1630 /* build an XP */
1631 xp = xfrm_policy_construct(&ua->policy, (struct rtattr **) xfrma, &err); 1631 xp = xfrm_policy_construct(&ua->policy, (struct rtattr **) attrs, &err);
1632 if (!xp) { 1632 if (!xp) {
1633 kfree(x); 1633 kfree(x);
1634 return err; 1634 return err;
@@ -1661,9 +1661,9 @@ static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh,
1661 1661
1662#ifdef CONFIG_XFRM_MIGRATE 1662#ifdef CONFIG_XFRM_MIGRATE
1663static int copy_from_user_migrate(struct xfrm_migrate *ma, 1663static int copy_from_user_migrate(struct xfrm_migrate *ma,
1664 struct rtattr **xfrma, int *num) 1664 struct rtattr **attrs, int *num)
1665{ 1665{
1666 struct rtattr *rt = xfrma[XFRMA_MIGRATE]; 1666 struct rtattr *rt = attrs[XFRMA_MIGRATE];
1667 struct xfrm_user_migrate *um; 1667 struct xfrm_user_migrate *um;
1668 int i, num_migrate; 1668 int i, num_migrate;
1669 1669
@@ -1692,7 +1692,7 @@ static int copy_from_user_migrate(struct xfrm_migrate *ma,
1692} 1692}
1693 1693
1694static int xfrm_do_migrate(struct sk_buff *skb, struct nlmsghdr *nlh, 1694static int xfrm_do_migrate(struct sk_buff *skb, struct nlmsghdr *nlh,
1695 struct rtattr **xfrma) 1695 struct rtattr **attrs)
1696{ 1696{
1697 struct xfrm_userpolicy_id *pi = nlmsg_data(nlh); 1697 struct xfrm_userpolicy_id *pi = nlmsg_data(nlh);
1698 struct xfrm_migrate m[XFRM_MAX_DEPTH]; 1698 struct xfrm_migrate m[XFRM_MAX_DEPTH];
@@ -1700,15 +1700,15 @@ static int xfrm_do_migrate(struct sk_buff *skb, struct nlmsghdr *nlh,
1700 int err; 1700 int err;
1701 int n = 0; 1701 int n = 0;
1702 1702
1703 if (xfrma[XFRMA_MIGRATE] == NULL) 1703 if (attrs[XFRMA_MIGRATE] == NULL)
1704 return -EINVAL; 1704 return -EINVAL;
1705 1705
1706 err = copy_from_user_policy_type(&type, (struct rtattr **)xfrma); 1706 err = copy_from_user_policy_type(&type, (struct rtattr **)attrs);
1707 if (err) 1707 if (err)
1708 return err; 1708 return err;
1709 1709
1710 err = copy_from_user_migrate((struct xfrm_migrate *)m, 1710 err = copy_from_user_migrate((struct xfrm_migrate *)m,
1711 (struct rtattr **)xfrma, &n); 1711 (struct rtattr **)attrs, &n);
1712 if (err) 1712 if (err)
1713 return err; 1713 return err;
1714 1714
@@ -1721,7 +1721,7 @@ static int xfrm_do_migrate(struct sk_buff *skb, struct nlmsghdr *nlh,
1721} 1721}
1722#else 1722#else
1723static int xfrm_do_migrate(struct sk_buff *skb, struct nlmsghdr *nlh, 1723static int xfrm_do_migrate(struct sk_buff *skb, struct nlmsghdr *nlh,
1724 struct rtattr **xfrma) 1724 struct rtattr **attrs)
1725{ 1725{
1726 return -ENOPROTOOPT; 1726 return -ENOPROTOOPT;
1727} 1727}
@@ -1882,7 +1882,7 @@ static struct xfrm_link {
1882 1882
1883static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) 1883static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
1884{ 1884{
1885 struct nlattr *xfrma[XFRMA_MAX+1]; 1885 struct nlattr *attrs[XFRMA_MAX+1];
1886 struct xfrm_link *link; 1886 struct xfrm_link *link;
1887 int type, err; 1887 int type, err;
1888 1888
@@ -1906,7 +1906,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
1906 return netlink_dump_start(xfrm_nl, skb, nlh, link->dump, NULL); 1906 return netlink_dump_start(xfrm_nl, skb, nlh, link->dump, NULL);
1907 } 1907 }
1908 1908
1909 err = nlmsg_parse(nlh, xfrm_msg_min[type], xfrma, XFRMA_MAX, 1909 err = nlmsg_parse(nlh, xfrm_msg_min[type], attrs, XFRMA_MAX,
1910 xfrma_policy); 1910 xfrma_policy);
1911 if (err < 0) 1911 if (err < 0)
1912 return err; 1912 return err;
@@ -1914,7 +1914,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
1914 if (link->doit == NULL) 1914 if (link->doit == NULL)
1915 return -EINVAL; 1915 return -EINVAL;
1916 1916
1917 return link->doit(skb, nlh, (struct rtattr **) xfrma); 1917 return link->doit(skb, nlh, (struct rtattr **) attrs);
1918} 1918}
1919 1919
1920static void xfrm_netlink_rcv(struct sock *sk, int len) 1920static void xfrm_netlink_rcv(struct sock *sk, int len)