aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm/xfrm_user.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/xfrm/xfrm_user.c')
-rw-r--r--net/xfrm/xfrm_user.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 2c74db0c9233..c9bb7210eb69 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -443,7 +443,7 @@ error_no_put:
443static int xfrm_add_sa(struct sk_buff *skb, struct nlmsghdr *nlh, 443static int xfrm_add_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
444 struct rtattr **xfrma) 444 struct rtattr **xfrma)
445{ 445{
446 struct xfrm_usersa_info *p = NLMSG_DATA(nlh); 446 struct xfrm_usersa_info *p = nlmsg_data(nlh);
447 struct xfrm_state *x; 447 struct xfrm_state *x;
448 int err; 448 int err;
449 struct km_event c; 449 struct km_event c;
@@ -520,7 +520,7 @@ static int xfrm_del_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
520 struct xfrm_state *x; 520 struct xfrm_state *x;
521 int err = -ESRCH; 521 int err = -ESRCH;
522 struct km_event c; 522 struct km_event c;
523 struct xfrm_usersa_id *p = NLMSG_DATA(nlh); 523 struct xfrm_usersa_id *p = nlmsg_data(nlh);
524 524
525 x = xfrm_user_state_lookup(p, xfrma, &err); 525 x = xfrm_user_state_lookup(p, xfrma, &err);
526 if (x == NULL) 526 if (x == NULL)
@@ -592,7 +592,7 @@ static int dump_one_state(struct xfrm_state *x, int count, void *ptr)
592 if (nlh == NULL) 592 if (nlh == NULL)
593 return -EMSGSIZE; 593 return -EMSGSIZE;
594 594
595 p = NLMSG_DATA(nlh); 595 p = nlmsg_data(nlh);
596 copy_to_user_state(x, p); 596 copy_to_user_state(x, p);
597 597
598 if (x->aalg) 598 if (x->aalg)
@@ -715,7 +715,7 @@ static int xfrm_get_spdinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
715 struct rtattr **xfrma) 715 struct rtattr **xfrma)
716{ 716{
717 struct sk_buff *r_skb; 717 struct sk_buff *r_skb;
718 u32 *flags = NLMSG_DATA(nlh); 718 u32 *flags = nlmsg_data(nlh);
719 u32 spid = NETLINK_CB(skb).pid; 719 u32 spid = NETLINK_CB(skb).pid;
720 u32 seq = nlh->nlmsg_seq; 720 u32 seq = nlh->nlmsg_seq;
721 int len = NLMSG_LENGTH(sizeof(u32)); 721 int len = NLMSG_LENGTH(sizeof(u32));
@@ -765,7 +765,7 @@ static int xfrm_get_sadinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
765 struct rtattr **xfrma) 765 struct rtattr **xfrma)
766{ 766{
767 struct sk_buff *r_skb; 767 struct sk_buff *r_skb;
768 u32 *flags = NLMSG_DATA(nlh); 768 u32 *flags = nlmsg_data(nlh);
769 u32 spid = NETLINK_CB(skb).pid; 769 u32 spid = NETLINK_CB(skb).pid;
770 u32 seq = nlh->nlmsg_seq; 770 u32 seq = nlh->nlmsg_seq;
771 int len = NLMSG_LENGTH(sizeof(u32)); 771 int len = NLMSG_LENGTH(sizeof(u32));
@@ -787,7 +787,7 @@ static int xfrm_get_sadinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
787static int xfrm_get_sa(struct sk_buff *skb, struct nlmsghdr *nlh, 787static int xfrm_get_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
788 struct rtattr **xfrma) 788 struct rtattr **xfrma)
789{ 789{
790 struct xfrm_usersa_id *p = NLMSG_DATA(nlh); 790 struct xfrm_usersa_id *p = nlmsg_data(nlh);
791 struct xfrm_state *x; 791 struct xfrm_state *x;
792 struct sk_buff *resp_skb; 792 struct sk_buff *resp_skb;
793 int err = -ESRCH; 793 int err = -ESRCH;
@@ -841,7 +841,7 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh,
841 int family; 841 int family;
842 int err; 842 int err;
843 843
844 p = NLMSG_DATA(nlh); 844 p = nlmsg_data(nlh);
845 err = verify_userspi_info(p); 845 err = verify_userspi_info(p);
846 if (err) 846 if (err)
847 goto out_noput; 847 goto out_noput;
@@ -1130,7 +1130,7 @@ static struct xfrm_policy *xfrm_policy_construct(struct xfrm_userpolicy_info *p,
1130static int xfrm_add_policy(struct sk_buff *skb, struct nlmsghdr *nlh, 1130static int xfrm_add_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1131 struct rtattr **xfrma) 1131 struct rtattr **xfrma)
1132{ 1132{
1133 struct xfrm_userpolicy_info *p = NLMSG_DATA(nlh); 1133 struct xfrm_userpolicy_info *p = nlmsg_data(nlh);
1134 struct xfrm_policy *xp; 1134 struct xfrm_policy *xp;
1135 struct km_event c; 1135 struct km_event c;
1136 int err; 1136 int err;
@@ -1277,8 +1277,8 @@ static int dump_one_policy(struct xfrm_policy *xp, int dir, int count, void *ptr
1277 XFRM_MSG_NEWPOLICY, sizeof(*p), sp->nlmsg_flags); 1277 XFRM_MSG_NEWPOLICY, sizeof(*p), sp->nlmsg_flags);
1278 if (nlh == NULL) 1278 if (nlh == NULL)
1279 return -EMSGSIZE; 1279 return -EMSGSIZE;
1280 p = NLMSG_DATA(nlh);
1281 1280
1281 p = nlmsg_data(nlh);
1282 copy_to_user_policy(xp, p, dir); 1282 copy_to_user_policy(xp, p, dir);
1283 if (copy_to_user_tmpl(xp, skb) < 0) 1283 if (copy_to_user_tmpl(xp, skb) < 0)
1284 goto nlmsg_failure; 1284 goto nlmsg_failure;
@@ -1351,7 +1351,7 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1351 struct km_event c; 1351 struct km_event c;
1352 int delete; 1352 int delete;
1353 1353
1354 p = NLMSG_DATA(nlh); 1354 p = nlmsg_data(nlh);
1355 delete = nlh->nlmsg_type == XFRM_MSG_DELPOLICY; 1355 delete = nlh->nlmsg_type == XFRM_MSG_DELPOLICY;
1356 1356
1357 err = copy_from_user_policy_type(&type, xfrma); 1357 err = copy_from_user_policy_type(&type, xfrma);
@@ -1420,7 +1420,7 @@ static int xfrm_flush_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
1420 struct rtattr **xfrma) 1420 struct rtattr **xfrma)
1421{ 1421{
1422 struct km_event c; 1422 struct km_event c;
1423 struct xfrm_usersa_flush *p = NLMSG_DATA(nlh); 1423 struct xfrm_usersa_flush *p = nlmsg_data(nlh);
1424 struct xfrm_audit audit_info; 1424 struct xfrm_audit audit_info;
1425 int err; 1425 int err;
1426 1426
@@ -1448,8 +1448,8 @@ static int build_aevent(struct sk_buff *skb, struct xfrm_state *x, struct km_eve
1448 nlh = nlmsg_put(skb, c->pid, c->seq, XFRM_MSG_NEWAE, sizeof(*id), 0); 1448 nlh = nlmsg_put(skb, c->pid, c->seq, XFRM_MSG_NEWAE, sizeof(*id), 0);
1449 if (nlh == NULL) 1449 if (nlh == NULL)
1450 return -EMSGSIZE; 1450 return -EMSGSIZE;
1451 id = NLMSG_DATA(nlh);
1452 1451
1452 id = nlmsg_data(nlh);
1453 memcpy(&id->sa_id.daddr, &x->id.daddr,sizeof(x->id.daddr)); 1453 memcpy(&id->sa_id.daddr, &x->id.daddr,sizeof(x->id.daddr));
1454 id->sa_id.spi = x->id.spi; 1454 id->sa_id.spi = x->id.spi;
1455 id->sa_id.family = x->props.family; 1455 id->sa_id.family = x->props.family;
@@ -1490,7 +1490,7 @@ static int xfrm_get_ae(struct sk_buff *skb, struct nlmsghdr *nlh,
1490 struct sk_buff *r_skb; 1490 struct sk_buff *r_skb;
1491 int err; 1491 int err;
1492 struct km_event c; 1492 struct km_event c;
1493 struct xfrm_aevent_id *p = NLMSG_DATA(nlh); 1493 struct xfrm_aevent_id *p = nlmsg_data(nlh);
1494 int len = NLMSG_LENGTH(sizeof(struct xfrm_aevent_id)); 1494 int len = NLMSG_LENGTH(sizeof(struct xfrm_aevent_id));
1495 struct xfrm_usersa_id *id = &p->sa_id; 1495 struct xfrm_usersa_id *id = &p->sa_id;
1496 1496
@@ -1538,7 +1538,7 @@ static int xfrm_new_ae(struct sk_buff *skb, struct nlmsghdr *nlh,
1538 struct xfrm_state *x; 1538 struct xfrm_state *x;
1539 struct km_event c; 1539 struct km_event c;
1540 int err = - EINVAL; 1540 int err = - EINVAL;
1541 struct xfrm_aevent_id *p = NLMSG_DATA(nlh); 1541 struct xfrm_aevent_id *p = nlmsg_data(nlh);
1542 struct rtattr *rp = xfrma[XFRMA_REPLAY_VAL-1]; 1542 struct rtattr *rp = xfrma[XFRMA_REPLAY_VAL-1];
1543 struct rtattr *lt = xfrma[XFRMA_LTIME_VAL-1]; 1543 struct rtattr *lt = xfrma[XFRMA_LTIME_VAL-1];
1544 1544
@@ -1602,7 +1602,7 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
1602 struct rtattr **xfrma) 1602 struct rtattr **xfrma)
1603{ 1603{
1604 struct xfrm_policy *xp; 1604 struct xfrm_policy *xp;
1605 struct xfrm_user_polexpire *up = NLMSG_DATA(nlh); 1605 struct xfrm_user_polexpire *up = nlmsg_data(nlh);
1606 struct xfrm_userpolicy_info *p = &up->pol; 1606 struct xfrm_userpolicy_info *p = &up->pol;
1607 u8 type = XFRM_POLICY_TYPE_MAIN; 1607 u8 type = XFRM_POLICY_TYPE_MAIN;
1608 int err = -ENOENT; 1608 int err = -ENOENT;
@@ -1664,7 +1664,7 @@ static int xfrm_add_sa_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
1664{ 1664{
1665 struct xfrm_state *x; 1665 struct xfrm_state *x;
1666 int err; 1666 int err;
1667 struct xfrm_user_expire *ue = NLMSG_DATA(nlh); 1667 struct xfrm_user_expire *ue = nlmsg_data(nlh);
1668 struct xfrm_usersa_info *p = &ue->state; 1668 struct xfrm_usersa_info *p = &ue->state;
1669 1669
1670 x = xfrm_state_lookup(&p->id.daddr, p->id.spi, p->id.proto, p->family); 1670 x = xfrm_state_lookup(&p->id.daddr, p->id.spi, p->id.proto, p->family);
@@ -1699,7 +1699,7 @@ static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh,
1699 int i; 1699 int i;
1700 struct rtattr *rt = xfrma[XFRMA_TMPL-1]; 1700 struct rtattr *rt = xfrma[XFRMA_TMPL-1];
1701 1701
1702 struct xfrm_user_acquire *ua = NLMSG_DATA(nlh); 1702 struct xfrm_user_acquire *ua = nlmsg_data(nlh);
1703 struct xfrm_state *x = xfrm_state_alloc(); 1703 struct xfrm_state *x = xfrm_state_alloc();
1704 int err = -ENOMEM; 1704 int err = -ENOMEM;
1705 1705
@@ -1794,7 +1794,7 @@ static int copy_from_user_migrate(struct xfrm_migrate *ma,
1794static int xfrm_do_migrate(struct sk_buff *skb, struct nlmsghdr *nlh, 1794static int xfrm_do_migrate(struct sk_buff *skb, struct nlmsghdr *nlh,
1795 struct rtattr **xfrma) 1795 struct rtattr **xfrma)
1796{ 1796{
1797 struct xfrm_userpolicy_id *pi = NLMSG_DATA(nlh); 1797 struct xfrm_userpolicy_id *pi = nlmsg_data(nlh);
1798 struct xfrm_migrate m[XFRM_MAX_DEPTH]; 1798 struct xfrm_migrate m[XFRM_MAX_DEPTH];
1799 u8 type; 1799 u8 type;
1800 int err; 1800 int err;
@@ -1863,8 +1863,8 @@ static int build_migrate(struct sk_buff *skb, struct xfrm_migrate *m,
1863 nlh = nlmsg_put(skb, 0, 0, XFRM_MSG_MIGRATE, sizeof(*pol_id), 0); 1863 nlh = nlmsg_put(skb, 0, 0, XFRM_MSG_MIGRATE, sizeof(*pol_id), 0);
1864 if (nlh == NULL) 1864 if (nlh == NULL)
1865 return -EMSGSIZE; 1865 return -EMSGSIZE;
1866 pol_id = NLMSG_DATA(nlh);
1867 1866
1867 pol_id = nlmsg_data(nlh);
1868 /* copy data from selector, dir, and type to the pol_id */ 1868 /* copy data from selector, dir, and type to the pol_id */
1869 memset(pol_id, 0, sizeof(*pol_id)); 1869 memset(pol_id, 0, sizeof(*pol_id));
1870 memcpy(&pol_id->sel, sel, sizeof(pol_id->sel)); 1870 memcpy(&pol_id->sel, sel, sizeof(pol_id->sel));
@@ -2041,8 +2041,8 @@ static int build_expire(struct sk_buff *skb, struct xfrm_state *x, struct km_eve
2041 nlh = nlmsg_put(skb, c->pid, 0, XFRM_MSG_EXPIRE, sizeof(*ue), 0); 2041 nlh = nlmsg_put(skb, c->pid, 0, XFRM_MSG_EXPIRE, sizeof(*ue), 0);
2042 if (nlh == NULL) 2042 if (nlh == NULL)
2043 return -EMSGSIZE; 2043 return -EMSGSIZE;
2044 ue = NLMSG_DATA(nlh);
2045 2044
2045 ue = nlmsg_data(nlh);
2046 copy_to_user_state(x, &ue->state); 2046 copy_to_user_state(x, &ue->state);
2047 ue->hard = (c->data.hard != 0) ? 1 : 0; 2047 ue->hard = (c->data.hard != 0) ? 1 : 0;
2048 2048
@@ -2100,7 +2100,7 @@ static int xfrm_notify_sa_flush(struct km_event *c)
2100 return -EMSGSIZE; 2100 return -EMSGSIZE;
2101 } 2101 }
2102 2102
2103 p = NLMSG_DATA(nlh); 2103 p = nlmsg_data(nlh);
2104 p->proto = c->data.proto; 2104 p->proto = c->data.proto;
2105 2105
2106 nlmsg_end(skb, nlh); 2106 nlmsg_end(skb, nlh);
@@ -2148,9 +2148,9 @@ static int xfrm_notify_sa(struct xfrm_state *x, struct km_event *c)
2148 if (nlh == NULL) 2148 if (nlh == NULL)
2149 goto nlmsg_failure; 2149 goto nlmsg_failure;
2150 2150
2151 p = NLMSG_DATA(nlh); 2151 p = nlmsg_data(nlh);
2152 if (c->event == XFRM_MSG_DELSA) { 2152 if (c->event == XFRM_MSG_DELSA) {
2153 id = NLMSG_DATA(nlh); 2153 id = nlmsg_data(nlh);
2154 memcpy(&id->daddr, &x->id.daddr, sizeof(id->daddr)); 2154 memcpy(&id->daddr, &x->id.daddr, sizeof(id->daddr));
2155 id->spi = x->id.spi; 2155 id->spi = x->id.spi;
2156 id->family = x->props.family; 2156 id->family = x->props.family;
@@ -2218,8 +2218,8 @@ static int build_acquire(struct sk_buff *skb, struct xfrm_state *x,
2218 nlh = nlmsg_put(skb, 0, 0, XFRM_MSG_ACQUIRE, sizeof(*ua), 0); 2218 nlh = nlmsg_put(skb, 0, 0, XFRM_MSG_ACQUIRE, sizeof(*ua), 0);
2219 if (nlh == NULL) 2219 if (nlh == NULL)
2220 return -EMSGSIZE; 2220 return -EMSGSIZE;
2221 ua = NLMSG_DATA(nlh);
2222 2221
2222 ua = nlmsg_data(nlh);
2223 memcpy(&ua->id, &x->id, sizeof(ua->id)); 2223 memcpy(&ua->id, &x->id, sizeof(ua->id));
2224 memcpy(&ua->saddr, &x->props.saddr, sizeof(ua->saddr)); 2224 memcpy(&ua->saddr, &x->props.saddr, sizeof(ua->saddr));
2225 memcpy(&ua->sel, &x->sel, sizeof(ua->sel)); 2225 memcpy(&ua->sel, &x->sel, sizeof(ua->sel));
@@ -2335,8 +2335,8 @@ static int build_polexpire(struct sk_buff *skb, struct xfrm_policy *xp,
2335 nlh = nlmsg_put(skb, c->pid, 0, XFRM_MSG_POLEXPIRE, sizeof(*upe), 0); 2335 nlh = nlmsg_put(skb, c->pid, 0, XFRM_MSG_POLEXPIRE, sizeof(*upe), 0);
2336 if (nlh == NULL) 2336 if (nlh == NULL)
2337 return -EMSGSIZE; 2337 return -EMSGSIZE;
2338 upe = NLMSG_DATA(nlh);
2339 2338
2339 upe = nlmsg_data(nlh);
2340 copy_to_user_policy(xp, &upe->pol, dir); 2340 copy_to_user_policy(xp, &upe->pol, dir);
2341 if (copy_to_user_tmpl(xp, skb) < 0) 2341 if (copy_to_user_tmpl(xp, skb) < 0)
2342 goto nlmsg_failure; 2342 goto nlmsg_failure;
@@ -2402,9 +2402,9 @@ static int xfrm_notify_policy(struct xfrm_policy *xp, int dir, struct km_event *
2402 if (nlh == NULL) 2402 if (nlh == NULL)
2403 goto nlmsg_failure; 2403 goto nlmsg_failure;
2404 2404
2405 p = NLMSG_DATA(nlh); 2405 p = nlmsg_data(nlh);
2406 if (c->event == XFRM_MSG_DELPOLICY) { 2406 if (c->event == XFRM_MSG_DELPOLICY) {
2407 id = NLMSG_DATA(nlh); 2407 id = nlmsg_data(nlh);
2408 memset(id, 0, sizeof(*id)); 2408 memset(id, 0, sizeof(*id));
2409 id->dir = dir; 2409 id->dir = dir;
2410 if (c->data.byid) 2410 if (c->data.byid)
@@ -2491,8 +2491,8 @@ static int build_report(struct sk_buff *skb, u8 proto,
2491 nlh = nlmsg_put(skb, 0, 0, XFRM_MSG_REPORT, sizeof(*ur), 0); 2491 nlh = nlmsg_put(skb, 0, 0, XFRM_MSG_REPORT, sizeof(*ur), 0);
2492 if (nlh == NULL) 2492 if (nlh == NULL)
2493 return -EMSGSIZE; 2493 return -EMSGSIZE;
2494 ur = NLMSG_DATA(nlh);
2495 2494
2495 ur = nlmsg_data(nlh);
2496 ur->proto = proto; 2496 ur->proto = proto;
2497 memcpy(&ur->sel, sel, sizeof(ur->sel)); 2497 memcpy(&ur->sel, sel, sizeof(ur->sel));
2498 2498