Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sctp: remove deprecated SCTP_GET_*_OLD stuffs

SCTP_GET_*_OLD stuffs are schedlued to be removed.

Cc: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: WANG Cong <amwang@redhat.com>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>

authored by

Amerigo Wang and committed by
Vlad Yasevich
a242b41d 37051f73

-345
-12
Documentation/feature-removal-schedule.txt
··· 302 302 303 303 --------------------------- 304 304 305 - What: SCTP_GET_PEER_ADDRS_NUM_OLD, SCTP_GET_PEER_ADDRS_OLD, 306 - SCTP_GET_LOCAL_ADDRS_NUM_OLD, SCTP_GET_LOCAL_ADDRS_OLD 307 - When: June 2009 308 - Why: A newer version of the options have been introduced in 2005 that 309 - removes the limitions of the old API. The sctp library has been 310 - converted to use these new options at the same time. Any user 311 - space app that directly uses the old options should convert to using 312 - the new options. 313 - Who: Vlad Yasevich <vladislav.yasevich@hp.com> 314 - 315 - --------------------------- 316 - 317 305 What: Ability for non root users to shm_get hugetlb pages based on mlock 318 306 resource limits 319 307 When: 2.6.31
-8
include/net/sctp/user.h
··· 131 131 #define SCTP_SOCKOPT_BINDX_REM SCTP_SOCKOPT_BINDX_REM 132 132 SCTP_SOCKOPT_PEELOFF, /* peel off association. */ 133 133 #define SCTP_SOCKOPT_PEELOFF SCTP_SOCKOPT_PEELOFF 134 - SCTP_GET_PEER_ADDRS_NUM_OLD, /* Get number of peer addresss. */ 135 - #define SCTP_GET_PEER_ADDRS_NUM_OLD SCTP_GET_PEER_ADDRS_NUM_OLD 136 - SCTP_GET_PEER_ADDRS_OLD, /* Get all peer addresss. */ 137 - #define SCTP_GET_PEER_ADDRS_OLD SCTP_GET_PEER_ADDRS_OLD 138 - SCTP_GET_LOCAL_ADDRS_NUM_OLD, /* Get number of local addresss. */ 139 - #define SCTP_GET_LOCAL_ADDRS_NUM_OLD SCTP_GET_LOCAL_ADDRS_NUM_OLD 140 - SCTP_GET_LOCAL_ADDRS_OLD, /* Get all local addresss. */ 141 - #define SCTP_GET_LOCAL_ADDRS_OLD SCTP_GET_LOCAL_ADDRS_OLD 142 134 SCTP_SOCKOPT_CONNECTX_OLD, /* CONNECTX old requests. */ 143 135 #define SCTP_SOCKOPT_CONNECTX_OLD SCTP_SOCKOPT_CONNECTX_OLD 144 136 SCTP_GET_PEER_ADDRS, /* Get all peer addresss. */
-325
net/sctp/socket.c
··· 4348 4348 return 0; 4349 4349 } 4350 4350 4351 - static int sctp_getsockopt_peer_addrs_num_old(struct sock *sk, int len, 4352 - char __user *optval, 4353 - int __user *optlen) 4354 - { 4355 - sctp_assoc_t id; 4356 - struct sctp_association *asoc; 4357 - struct list_head *pos; 4358 - int cnt = 0; 4359 - 4360 - if (len < sizeof(sctp_assoc_t)) 4361 - return -EINVAL; 4362 - 4363 - if (copy_from_user(&id, optval, sizeof(sctp_assoc_t))) 4364 - return -EFAULT; 4365 - 4366 - printk(KERN_WARNING "SCTP: Use of SCTP_GET_PEER_ADDRS_NUM_OLD " 4367 - "socket option deprecated\n"); 4368 - /* For UDP-style sockets, id specifies the association to query. */ 4369 - asoc = sctp_id2assoc(sk, id); 4370 - if (!asoc) 4371 - return -EINVAL; 4372 - 4373 - list_for_each(pos, &asoc->peer.transport_addr_list) { 4374 - cnt ++; 4375 - } 4376 - 4377 - return cnt; 4378 - } 4379 - 4380 - /* 4381 - * Old API for getting list of peer addresses. Does not work for 32-bit 4382 - * programs running on a 64-bit kernel 4383 - */ 4384 - static int sctp_getsockopt_peer_addrs_old(struct sock *sk, int len, 4385 - char __user *optval, 4386 - int __user *optlen) 4387 - { 4388 - struct sctp_association *asoc; 4389 - int cnt = 0; 4390 - struct sctp_getaddrs_old getaddrs; 4391 - struct sctp_transport *from; 4392 - void __user *to; 4393 - union sctp_addr temp; 4394 - struct sctp_sock *sp = sctp_sk(sk); 4395 - int addrlen; 4396 - 4397 - if (len < sizeof(struct sctp_getaddrs_old)) 4398 - return -EINVAL; 4399 - 4400 - len = sizeof(struct sctp_getaddrs_old); 4401 - 4402 - if (copy_from_user(&getaddrs, optval, len)) 4403 - return -EFAULT; 4404 - 4405 - if (getaddrs.addr_num <= 0) return -EINVAL; 4406 - 4407 - printk(KERN_WARNING "SCTP: Use of SCTP_GET_PEER_ADDRS_OLD " 4408 - "socket option deprecated\n"); 4409 - 4410 - /* For UDP-style sockets, id specifies the association to query. */ 4411 - asoc = sctp_id2assoc(sk, getaddrs.assoc_id); 4412 - if (!asoc) 4413 - return -EINVAL; 4414 - 4415 - to = (void __user *)getaddrs.addrs; 4416 - list_for_each_entry(from, &asoc->peer.transport_addr_list, 4417 - transports) { 4418 - memcpy(&temp, &from->ipaddr, sizeof(temp)); 4419 - sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); 4420 - addrlen = sctp_get_af_specific(sk->sk_family)->sockaddr_len; 4421 - if (copy_to_user(to, &temp, addrlen)) 4422 - return -EFAULT; 4423 - to += addrlen ; 4424 - cnt ++; 4425 - if (cnt >= getaddrs.addr_num) break; 4426 - } 4427 - getaddrs.addr_num = cnt; 4428 - if (put_user(len, optlen)) 4429 - return -EFAULT; 4430 - if (copy_to_user(optval, &getaddrs, len)) 4431 - return -EFAULT; 4432 - 4433 - return 0; 4434 - } 4435 4351 4436 4352 static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, 4437 4353 char __user *optval, int __user *optlen) ··· 4400 4484 return 0; 4401 4485 } 4402 4486 4403 - static int sctp_getsockopt_local_addrs_num_old(struct sock *sk, int len, 4404 - char __user *optval, 4405 - int __user *optlen) 4406 - { 4407 - sctp_assoc_t id; 4408 - struct sctp_bind_addr *bp; 4409 - struct sctp_association *asoc; 4410 - struct sctp_sockaddr_entry *addr; 4411 - int cnt = 0; 4412 - 4413 - if (len < sizeof(sctp_assoc_t)) 4414 - return -EINVAL; 4415 - 4416 - if (copy_from_user(&id, optval, sizeof(sctp_assoc_t))) 4417 - return -EFAULT; 4418 - 4419 - printk(KERN_WARNING "SCTP: Use of SCTP_GET_LOCAL_ADDRS_NUM_OLD " 4420 - "socket option deprecated\n"); 4421 - 4422 - /* 4423 - * For UDP-style sockets, id specifies the association to query. 4424 - * If the id field is set to the value '0' then the locally bound 4425 - * addresses are returned without regard to any particular 4426 - * association. 4427 - */ 4428 - if (0 == id) { 4429 - bp = &sctp_sk(sk)->ep->base.bind_addr; 4430 - } else { 4431 - asoc = sctp_id2assoc(sk, id); 4432 - if (!asoc) 4433 - return -EINVAL; 4434 - bp = &asoc->base.bind_addr; 4435 - } 4436 - 4437 - /* If the endpoint is bound to 0.0.0.0 or ::0, count the valid 4438 - * addresses from the global local address list. 4439 - */ 4440 - if (sctp_list_single_entry(&bp->address_list)) { 4441 - addr = list_entry(bp->address_list.next, 4442 - struct sctp_sockaddr_entry, list); 4443 - if (sctp_is_any(sk, &addr->a)) { 4444 - rcu_read_lock(); 4445 - list_for_each_entry_rcu(addr, 4446 - &sctp_local_addr_list, list) { 4447 - if (!addr->valid) 4448 - continue; 4449 - 4450 - if ((PF_INET == sk->sk_family) && 4451 - (AF_INET6 == addr->a.sa.sa_family)) 4452 - continue; 4453 - 4454 - if ((PF_INET6 == sk->sk_family) && 4455 - inet_v6_ipv6only(sk) && 4456 - (AF_INET == addr->a.sa.sa_family)) 4457 - continue; 4458 - 4459 - cnt++; 4460 - } 4461 - rcu_read_unlock(); 4462 - } else { 4463 - cnt = 1; 4464 - } 4465 - goto done; 4466 - } 4467 - 4468 - /* Protection on the bound address list is not needed, 4469 - * since in the socket option context we hold the socket lock, 4470 - * so there is no way that the bound address list can change. 4471 - */ 4472 - list_for_each_entry(addr, &bp->address_list, list) { 4473 - cnt ++; 4474 - } 4475 - done: 4476 - return cnt; 4477 - } 4478 - 4479 - /* Helper function that copies local addresses to user and returns the number 4480 - * of addresses copied. 4481 - */ 4482 - static int sctp_copy_laddrs_old(struct sock *sk, __u16 port, 4483 - int max_addrs, void *to, 4484 - int *bytes_copied) 4485 - { 4486 - struct sctp_sockaddr_entry *addr; 4487 - union sctp_addr temp; 4488 - int cnt = 0; 4489 - int addrlen; 4490 - 4491 - rcu_read_lock(); 4492 - list_for_each_entry_rcu(addr, &sctp_local_addr_list, list) { 4493 - if (!addr->valid) 4494 - continue; 4495 - 4496 - if ((PF_INET == sk->sk_family) && 4497 - (AF_INET6 == addr->a.sa.sa_family)) 4498 - continue; 4499 - if ((PF_INET6 == sk->sk_family) && 4500 - inet_v6_ipv6only(sk) && 4501 - (AF_INET == addr->a.sa.sa_family)) 4502 - continue; 4503 - memcpy(&temp, &addr->a, sizeof(temp)); 4504 - if (!temp.v4.sin_port) 4505 - temp.v4.sin_port = htons(port); 4506 - 4507 - sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk), 4508 - &temp); 4509 - addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; 4510 - memcpy(to, &temp, addrlen); 4511 - 4512 - to += addrlen; 4513 - *bytes_copied += addrlen; 4514 - cnt ++; 4515 - if (cnt >= max_addrs) break; 4516 - } 4517 - rcu_read_unlock(); 4518 - 4519 - return cnt; 4520 - } 4521 - 4522 4487 static int sctp_copy_laddrs(struct sock *sk, __u16 port, void *to, 4523 4488 size_t space_left, int *bytes_copied) 4524 4489 { ··· 4443 4646 return cnt; 4444 4647 } 4445 4648 4446 - /* Old API for getting list of local addresses. Does not work for 32-bit 4447 - * programs running on a 64-bit kernel 4448 - */ 4449 - static int sctp_getsockopt_local_addrs_old(struct sock *sk, int len, 4450 - char __user *optval, int __user *optlen) 4451 - { 4452 - struct sctp_bind_addr *bp; 4453 - struct sctp_association *asoc; 4454 - int cnt = 0; 4455 - struct sctp_getaddrs_old getaddrs; 4456 - struct sctp_sockaddr_entry *addr; 4457 - void __user *to; 4458 - union sctp_addr temp; 4459 - struct sctp_sock *sp = sctp_sk(sk); 4460 - int addrlen; 4461 - int err = 0; 4462 - void *addrs; 4463 - void *buf; 4464 - int bytes_copied = 0; 4465 - 4466 - if (len < sizeof(struct sctp_getaddrs_old)) 4467 - return -EINVAL; 4468 - 4469 - len = sizeof(struct sctp_getaddrs_old); 4470 - if (copy_from_user(&getaddrs, optval, len)) 4471 - return -EFAULT; 4472 - 4473 - if (getaddrs.addr_num <= 0 || 4474 - getaddrs.addr_num >= (INT_MAX / sizeof(union sctp_addr))) 4475 - return -EINVAL; 4476 - 4477 - printk(KERN_WARNING "SCTP: Use of SCTP_GET_LOCAL_ADDRS_OLD " 4478 - "socket option deprecated\n"); 4479 - 4480 - /* 4481 - * For UDP-style sockets, id specifies the association to query. 4482 - * If the id field is set to the value '0' then the locally bound 4483 - * addresses are returned without regard to any particular 4484 - * association. 4485 - */ 4486 - if (0 == getaddrs.assoc_id) { 4487 - bp = &sctp_sk(sk)->ep->base.bind_addr; 4488 - } else { 4489 - asoc = sctp_id2assoc(sk, getaddrs.assoc_id); 4490 - if (!asoc) 4491 - return -EINVAL; 4492 - bp = &asoc->base.bind_addr; 4493 - } 4494 - 4495 - to = getaddrs.addrs; 4496 - 4497 - /* Allocate space for a local instance of packed array to hold all 4498 - * the data. We store addresses here first and then put write them 4499 - * to the user in one shot. 4500 - */ 4501 - addrs = kmalloc(sizeof(union sctp_addr) * getaddrs.addr_num, 4502 - GFP_KERNEL); 4503 - if (!addrs) 4504 - return -ENOMEM; 4505 - 4506 - /* If the endpoint is bound to 0.0.0.0 or ::0, get the valid 4507 - * addresses from the global local address list. 4508 - */ 4509 - if (sctp_list_single_entry(&bp->address_list)) { 4510 - addr = list_entry(bp->address_list.next, 4511 - struct sctp_sockaddr_entry, list); 4512 - if (sctp_is_any(sk, &addr->a)) { 4513 - cnt = sctp_copy_laddrs_old(sk, bp->port, 4514 - getaddrs.addr_num, 4515 - addrs, &bytes_copied); 4516 - goto copy_getaddrs; 4517 - } 4518 - } 4519 - 4520 - buf = addrs; 4521 - /* Protection on the bound address list is not needed since 4522 - * in the socket option context we hold a socket lock and 4523 - * thus the bound address list can't change. 4524 - */ 4525 - list_for_each_entry(addr, &bp->address_list, list) { 4526 - memcpy(&temp, &addr->a, sizeof(temp)); 4527 - sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); 4528 - addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; 4529 - memcpy(buf, &temp, addrlen); 4530 - buf += addrlen; 4531 - bytes_copied += addrlen; 4532 - cnt ++; 4533 - if (cnt >= getaddrs.addr_num) break; 4534 - } 4535 - 4536 - copy_getaddrs: 4537 - /* copy the entire address list into the user provided space */ 4538 - if (copy_to_user(to, addrs, bytes_copied)) { 4539 - err = -EFAULT; 4540 - goto error; 4541 - } 4542 - 4543 - /* copy the leading structure back to user */ 4544 - getaddrs.addr_num = cnt; 4545 - if (copy_to_user(optval, &getaddrs, len)) 4546 - err = -EFAULT; 4547 - 4548 - error: 4549 - kfree(addrs); 4550 - return err; 4551 - } 4552 4649 4553 4650 static int sctp_getsockopt_local_addrs(struct sock *sk, int len, 4554 4651 char __user *optval, int __user *optlen) ··· 5292 5601 break; 5293 5602 case SCTP_INITMSG: 5294 5603 retval = sctp_getsockopt_initmsg(sk, len, optval, optlen); 5295 - break; 5296 - case SCTP_GET_PEER_ADDRS_NUM_OLD: 5297 - retval = sctp_getsockopt_peer_addrs_num_old(sk, len, optval, 5298 - optlen); 5299 - break; 5300 - case SCTP_GET_LOCAL_ADDRS_NUM_OLD: 5301 - retval = sctp_getsockopt_local_addrs_num_old(sk, len, optval, 5302 - optlen); 5303 - break; 5304 - case SCTP_GET_PEER_ADDRS_OLD: 5305 - retval = sctp_getsockopt_peer_addrs_old(sk, len, optval, 5306 - optlen); 5307 - break; 5308 - case SCTP_GET_LOCAL_ADDRS_OLD: 5309 - retval = sctp_getsockopt_local_addrs_old(sk, len, optval, 5310 - optlen); 5311 5604 break; 5312 5605 case SCTP_GET_PEER_ADDRS: 5313 5606 retval = sctp_getsockopt_peer_addrs(sk, len, optval,