• Home
  • Raw
  • Download

Lines Matching refs:p

106 static int verify_newsa_info(struct xfrm_usersa_info *p,  in verify_newsa_info()  argument
112 switch (p->family) { in verify_newsa_info()
129 switch (p->id.proto) { in verify_newsa_info()
189 switch (p->mode) { in verify_newsa_info()
210 struct xfrm_algo *p, *ualg; in attach_one_algo() local
223 p = kmemdup(ualg, xfrm_alg_len(ualg), GFP_KERNEL); in attach_one_algo()
224 if (!p) in attach_one_algo()
227 strcpy(p->alg_name, algo->name); in attach_one_algo()
228 *algpp = p; in attach_one_algo()
235 struct xfrm_algo_aead *p, *ualg; in attach_aead() local
248 p = kmemdup(ualg, aead_len(ualg), GFP_KERNEL); in attach_aead()
249 if (!p) in attach_aead()
252 strcpy(p->alg_name, algo->name); in attach_aead()
253 *algpp = p; in attach_aead()
268 static void copy_from_user_state(struct xfrm_state *x, struct xfrm_usersa_info *p) in copy_from_user_state() argument
270 memcpy(&x->id, &p->id, sizeof(x->id)); in copy_from_user_state()
271 memcpy(&x->sel, &p->sel, sizeof(x->sel)); in copy_from_user_state()
272 memcpy(&x->lft, &p->lft, sizeof(x->lft)); in copy_from_user_state()
273 x->props.mode = p->mode; in copy_from_user_state()
274 x->props.replay_window = p->replay_window; in copy_from_user_state()
275 x->props.reqid = p->reqid; in copy_from_user_state()
276 x->props.family = p->family; in copy_from_user_state()
277 memcpy(&x->props.saddr, &p->saddr, sizeof(x->props.saddr)); in copy_from_user_state()
278 x->props.flags = p->flags; in copy_from_user_state()
280 if (!x->sel.family && !(p->flags & XFRM_STATE_AF_UNSPEC)) in copy_from_user_state()
281 x->sel.family = p->family; in copy_from_user_state()
320 struct xfrm_usersa_info *p, in xfrm_state_construct() argument
330 copy_from_user_state(x, p); in xfrm_state_construct()
370 x->km.seq = p->seq; in xfrm_state_construct()
396 struct xfrm_usersa_info *p = nlmsg_data(nlh); in xfrm_add_sa() local
404 err = verify_newsa_info(p, attrs); in xfrm_add_sa()
408 x = xfrm_state_construct(net, p, attrs, &err); in xfrm_add_sa()
437 struct xfrm_usersa_id *p, in xfrm_user_state_lookup() argument
444 if (xfrm_id_proto_match(p->proto, IPSEC_PROTO_ANY)) { in xfrm_user_state_lookup()
446 x = xfrm_state_lookup(net, &p->daddr, p->spi, p->proto, p->family); in xfrm_user_state_lookup()
457 x = xfrm_state_lookup_byaddr(net, &p->daddr, saddr, in xfrm_user_state_lookup()
458 p->proto, p->family); in xfrm_user_state_lookup()
474 struct xfrm_usersa_id *p = nlmsg_data(nlh); in xfrm_del_sa() local
479 x = xfrm_user_state_lookup(net, p, attrs, &err); in xfrm_del_sa()
507 static void copy_to_user_state(struct xfrm_state *x, struct xfrm_usersa_info *p) in copy_to_user_state() argument
509 memcpy(&p->id, &x->id, sizeof(p->id)); in copy_to_user_state()
510 memcpy(&p->sel, &x->sel, sizeof(p->sel)); in copy_to_user_state()
511 memcpy(&p->lft, &x->lft, sizeof(p->lft)); in copy_to_user_state()
512 memcpy(&p->curlft, &x->curlft, sizeof(p->curlft)); in copy_to_user_state()
513 memcpy(&p->stats, &x->stats, sizeof(p->stats)); in copy_to_user_state()
514 memcpy(&p->saddr, &x->props.saddr, sizeof(p->saddr)); in copy_to_user_state()
515 p->mode = x->props.mode; in copy_to_user_state()
516 p->replay_window = x->props.replay_window; in copy_to_user_state()
517 p->reqid = x->props.reqid; in copy_to_user_state()
518 p->family = x->props.family; in copy_to_user_state()
519 p->flags = x->props.flags; in copy_to_user_state()
520 p->seq = x->km.seq; in copy_to_user_state()
553 struct xfrm_usersa_info *p, in copy_to_user_state_extra() argument
556 copy_to_user_state(x, p); in copy_to_user_state_extra()
590 struct xfrm_usersa_info *p; in dump_one_state() local
595 XFRM_MSG_NEWSA, sizeof(*p), sp->nlmsg_flags); in dump_one_state()
599 p = nlmsg_data(nlh); in dump_one_state()
601 err = copy_to_user_state_extra(x, p, skb); in dump_one_state()
785 struct xfrm_usersa_id *p = nlmsg_data(nlh); in xfrm_get_sa() local
790 x = xfrm_user_state_lookup(net, p, attrs, &err); in xfrm_get_sa()
805 static int verify_userspi_info(struct xfrm_userspi_info *p) in verify_userspi_info() argument
807 switch (p->info.id.proto) { in verify_userspi_info()
814 if (p->max >= 0x10000) in verify_userspi_info()
822 if (p->min > p->max) in verify_userspi_info()
833 struct xfrm_userspi_info *p; in xfrm_alloc_userspi() local
839 p = nlmsg_data(nlh); in xfrm_alloc_userspi()
840 err = verify_userspi_info(p); in xfrm_alloc_userspi()
844 family = p->info.family; in xfrm_alloc_userspi()
845 daddr = &p->info.id.daddr; in xfrm_alloc_userspi()
848 if (p->info.seq) { in xfrm_alloc_userspi()
849 x = xfrm_find_acq_byseq(net, p->info.seq); in xfrm_alloc_userspi()
857 x = xfrm_find_acq(net, p->info.mode, p->info.reqid, in xfrm_alloc_userspi()
858 p->info.id.proto, daddr, in xfrm_alloc_userspi()
859 &p->info.saddr, 1, in xfrm_alloc_userspi()
865 err = xfrm_alloc_spi(x, p->min, p->max); in xfrm_alloc_userspi()
914 static int verify_newpolicy_info(struct xfrm_userpolicy_info *p) in verify_newpolicy_info() argument
916 switch (p->share) { in verify_newpolicy_info()
927 switch (p->action) { in verify_newpolicy_info()
936 switch (p->sel.family) { in verify_newpolicy_info()
951 return verify_policy_dir(p->dir); in verify_newpolicy_info()
1064 static void copy_from_user_policy(struct xfrm_policy *xp, struct xfrm_userpolicy_info *p) in copy_from_user_policy() argument
1066 xp->priority = p->priority; in copy_from_user_policy()
1067 xp->index = p->index; in copy_from_user_policy()
1068 memcpy(&xp->selector, &p->sel, sizeof(xp->selector)); in copy_from_user_policy()
1069 memcpy(&xp->lft, &p->lft, sizeof(xp->lft)); in copy_from_user_policy()
1070 xp->action = p->action; in copy_from_user_policy()
1071 xp->flags = p->flags; in copy_from_user_policy()
1072 xp->family = p->sel.family; in copy_from_user_policy()
1076 static void copy_to_user_policy(struct xfrm_policy *xp, struct xfrm_userpolicy_info *p, int dir) in copy_to_user_policy() argument
1078 memcpy(&p->sel, &xp->selector, sizeof(p->sel)); in copy_to_user_policy()
1079 memcpy(&p->lft, &xp->lft, sizeof(p->lft)); in copy_to_user_policy()
1080 memcpy(&p->curlft, &xp->curlft, sizeof(p->curlft)); in copy_to_user_policy()
1081 p->priority = xp->priority; in copy_to_user_policy()
1082 p->index = xp->index; in copy_to_user_policy()
1083 p->sel.family = xp->family; in copy_to_user_policy()
1084 p->dir = dir; in copy_to_user_policy()
1085 p->action = xp->action; in copy_to_user_policy()
1086 p->flags = xp->flags; in copy_to_user_policy()
1087 p->share = XFRM_SHARE_ANY; /* XXX xp->share */ in copy_to_user_policy()
1090 static struct xfrm_policy *xfrm_policy_construct(struct net *net, struct xfrm_userpolicy_info *p, s… in xfrm_policy_construct() argument
1100 copy_from_user_policy(xp, p); in xfrm_policy_construct()
1123 struct xfrm_userpolicy_info *p = nlmsg_data(nlh); in xfrm_add_policy() local
1132 err = verify_newpolicy_info(p); in xfrm_add_policy()
1139 xp = xfrm_policy_construct(net, p, attrs, &err); in xfrm_add_policy()
1148 err = xfrm_policy_insert(p->dir, xp, excl); in xfrm_add_policy()
1160 km_policy_notify(xp, p->dir, &c); in xfrm_add_policy()
1239 struct xfrm_userpolicy_info *p; in dump_one_policy() local
1245 XFRM_MSG_NEWPOLICY, sizeof(*p), sp->nlmsg_flags); in dump_one_policy()
1249 p = nlmsg_data(nlh); in dump_one_policy()
1250 copy_to_user_policy(xp, p, dir); in dump_one_policy()
1327 struct xfrm_userpolicy_id *p; in xfrm_get_policy() local
1333 p = nlmsg_data(nlh); in xfrm_get_policy()
1340 err = verify_policy_dir(p->dir); in xfrm_get_policy()
1344 if (p->index) in xfrm_get_policy()
1345 xp = xfrm_policy_byid(net, type, p->dir, p->index, delete, &err); in xfrm_get_policy()
1362 xp = xfrm_policy_bysel_ctx(net, type, p->dir, &p->sel, ctx, in xfrm_get_policy()
1372 resp_skb = xfrm_policy_netlink(skb, xp, p->dir, nlh->nlmsg_seq); in xfrm_get_policy()
1390 c.data.byid = p->index; in xfrm_get_policy()
1394 km_policy_notify(xp, p->dir, &c); in xfrm_get_policy()
1407 struct xfrm_usersa_flush *p = nlmsg_data(nlh); in xfrm_flush_sa() local
1414 err = xfrm_state_flush(net, p->proto, &audit_info); in xfrm_flush_sa()
1417 c.data.proto = p->proto; in xfrm_flush_sa()
1479 struct xfrm_aevent_id *p = nlmsg_data(nlh); in xfrm_get_ae() local
1480 struct xfrm_usersa_id *id = &p->sa_id; in xfrm_get_ae()
1498 c.data.aevent = p->flags; in xfrm_get_ae()
1517 struct xfrm_aevent_id *p = nlmsg_data(nlh); in xfrm_new_ae() local
1528 x = xfrm_state_lookup(net, &p->sa_id.daddr, p->sa_id.spi, p->sa_id.proto, p->sa_id.family); in xfrm_new_ae()
1584 struct xfrm_userpolicy_info *p = &up->pol; in xfrm_add_pol_expire() local
1592 if (p->index) in xfrm_add_pol_expire()
1593 xp = xfrm_policy_byid(net, type, p->dir, p->index, 0, &err); in xfrm_add_pol_expire()
1610 xp = xfrm_policy_bysel_ctx(net, type, p->dir, &p->sel, ctx, 0, &err); in xfrm_add_pol_expire()
1628 xfrm_policy_delete(xp, p->dir); in xfrm_add_pol_expire()
1635 km_policy_expired(xp, p->dir, up->hard, current->pid); in xfrm_add_pol_expire()
1649 struct xfrm_usersa_info *p = &ue->state; in xfrm_add_sa_expire() local
1651 x = xfrm_state_lookup(net, &p->id.daddr, p->id.spi, p->id.proto, p->family); in xfrm_add_sa_expire()
2092 struct xfrm_usersa_flush *p; in xfrm_notify_sa_flush() local
2101 nlh = nlmsg_put(skb, c->pid, c->seq, XFRM_MSG_FLUSHSA, sizeof(*p), 0); in xfrm_notify_sa_flush()
2107 p = nlmsg_data(nlh); in xfrm_notify_sa_flush()
2108 p->proto = c->data.proto; in xfrm_notify_sa_flush()
2143 struct xfrm_usersa_info *p; in xfrm_notify_sa() local
2150 headlen = sizeof(*p); in xfrm_notify_sa()
2165 p = nlmsg_data(nlh); in xfrm_notify_sa()
2175 attr = nla_reserve(skb, XFRMA_SA, sizeof(*p)); in xfrm_notify_sa()
2179 p = nla_data(attr); in xfrm_notify_sa()
2182 if (copy_to_user_state_extra(x, p, skb)) in xfrm_notify_sa()
2287 struct xfrm_userpolicy_info *p = (struct xfrm_userpolicy_info *)data; in xfrm_compile_policy() local
2288 struct xfrm_user_tmpl *ut = (struct xfrm_user_tmpl *) (p + 1); in xfrm_compile_policy()
2314 if (len < sizeof(*p) || in xfrm_compile_policy()
2315 verify_newpolicy_info(p)) in xfrm_compile_policy()
2318 nr = ((len - sizeof(*p)) / sizeof(*ut)); in xfrm_compile_policy()
2319 if (validate_tmpl(nr, ut, p->sel.family)) in xfrm_compile_policy()
2322 if (p->dir > XFRM_POLICY_OUT) in xfrm_compile_policy()
2331 copy_from_user_policy(xp, p); in xfrm_compile_policy()
2335 *dir = p->dir; in xfrm_compile_policy()
2394 struct xfrm_userpolicy_info *p; in xfrm_notify_policy() local
2401 headlen = sizeof(*p); in xfrm_notify_policy()
2417 p = nlmsg_data(nlh); in xfrm_notify_policy()
2429 attr = nla_reserve(skb, XFRMA_POLICY, sizeof(*p)); in xfrm_notify_policy()
2433 p = nla_data(attr); in xfrm_notify_policy()
2436 copy_to_user_policy(xp, p, dir); in xfrm_notify_policy()