diff options
Diffstat (limited to 'net/sctp/socket.c')
| -rw-r--r-- | net/sctp/socket.c | 371 |
1 files changed, 24 insertions, 347 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 3a95fcb17a9e..89ab66e54740 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
| @@ -394,7 +394,7 @@ SCTP_STATIC int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len) | |||
| 394 | 394 | ||
| 395 | /* Refresh ephemeral port. */ | 395 | /* Refresh ephemeral port. */ |
| 396 | if (!bp->port) | 396 | if (!bp->port) |
| 397 | bp->port = inet_sk(sk)->num; | 397 | bp->port = inet_sk(sk)->inet_num; |
| 398 | 398 | ||
| 399 | /* Add the address to the bind address list. | 399 | /* Add the address to the bind address list. |
| 400 | * Use GFP_ATOMIC since BHs will be disabled. | 400 | * Use GFP_ATOMIC since BHs will be disabled. |
| @@ -403,7 +403,7 @@ SCTP_STATIC int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len) | |||
| 403 | 403 | ||
| 404 | /* Copy back into socket for getsockname() use. */ | 404 | /* Copy back into socket for getsockname() use. */ |
| 405 | if (!ret) { | 405 | if (!ret) { |
| 406 | inet_sk(sk)->sport = htons(inet_sk(sk)->num); | 406 | inet_sk(sk)->inet_sport = htons(inet_sk(sk)->inet_num); |
| 407 | af->to_sk_saddr(addr, sk); | 407 | af->to_sk_saddr(addr, sk); |
| 408 | } | 408 | } |
| 409 | 409 | ||
| @@ -1117,7 +1117,7 @@ static int __sctp_connect(struct sock* sk, | |||
| 1117 | } | 1117 | } |
| 1118 | 1118 | ||
| 1119 | /* Initialize sk's dport and daddr for getpeername() */ | 1119 | /* Initialize sk's dport and daddr for getpeername() */ |
| 1120 | inet_sk(sk)->dport = htons(asoc->peer.port); | 1120 | inet_sk(sk)->inet_dport = htons(asoc->peer.port); |
| 1121 | af = sctp_get_af_specific(sa_addr->sa.sa_family); | 1121 | af = sctp_get_af_specific(sa_addr->sa.sa_family); |
| 1122 | af->to_sk_daddr(sa_addr, sk); | 1122 | af->to_sk_daddr(sa_addr, sk); |
| 1123 | sk->sk_err = 0; | 1123 | sk->sk_err = 0; |
| @@ -1968,7 +1968,7 @@ SCTP_STATIC int sctp_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
| 1968 | if (err) | 1968 | if (err) |
| 1969 | goto out_free; | 1969 | goto out_free; |
| 1970 | 1970 | ||
| 1971 | sock_recv_timestamp(msg, sk, skb); | 1971 | sock_recv_ts_and_drops(msg, sk, skb); |
| 1972 | if (sctp_ulpevent_is_notification(event)) { | 1972 | if (sctp_ulpevent_is_notification(event)) { |
| 1973 | msg->msg_flags |= MSG_NOTIFICATION; | 1973 | msg->msg_flags |= MSG_NOTIFICATION; |
| 1974 | sp->pf->event_msgname(event, msg->msg_name, addr_len); | 1974 | sp->pf->event_msgname(event, msg->msg_name, addr_len); |
| @@ -2086,6 +2086,9 @@ static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval, | |||
| 2086 | return -EINVAL; | 2086 | return -EINVAL; |
| 2087 | if (copy_from_user(&sp->autoclose, optval, optlen)) | 2087 | if (copy_from_user(&sp->autoclose, optval, optlen)) |
| 2088 | return -EFAULT; | 2088 | return -EFAULT; |
| 2089 | /* make sure it won't exceed MAX_SCHEDULE_TIMEOUT */ | ||
| 2090 | if (sp->autoclose > (MAX_SCHEDULE_TIMEOUT / HZ) ) | ||
| 2091 | sp->autoclose = (__u32)(MAX_SCHEDULE_TIMEOUT / HZ) ; | ||
| 2089 | 2092 | ||
| 2090 | return 0; | 2093 | return 0; |
| 2091 | } | 2094 | } |
| @@ -2311,11 +2314,10 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params, | |||
| 2311 | } | 2314 | } |
| 2312 | } | 2315 | } |
| 2313 | 2316 | ||
| 2314 | /* Note that unless the spp_flag is set to SPP_PMTUD_ENABLE the value | 2317 | /* Note that a value of zero indicates the current setting should be |
| 2315 | * of this field is ignored. Note also that a value of zero | 2318 | left unchanged. |
| 2316 | * indicates the current setting should be left unchanged. | ||
| 2317 | */ | 2319 | */ |
| 2318 | if ((params->spp_flags & SPP_PMTUD_ENABLE) && params->spp_pathmaxrxt) { | 2320 | if (params->spp_pathmaxrxt) { |
| 2319 | if (trans) { | 2321 | if (trans) { |
| 2320 | trans->pathmaxrxt = params->spp_pathmaxrxt; | 2322 | trans->pathmaxrxt = params->spp_pathmaxrxt; |
| 2321 | } else if (asoc) { | 2323 | } else if (asoc) { |
| @@ -2354,8 +2356,8 @@ static int sctp_setsockopt_peer_addr_params(struct sock *sk, | |||
| 2354 | pmtud_change == SPP_PMTUD || | 2356 | pmtud_change == SPP_PMTUD || |
| 2355 | sackdelay_change == SPP_SACKDELAY || | 2357 | sackdelay_change == SPP_SACKDELAY || |
| 2356 | params.spp_sackdelay > 500 || | 2358 | params.spp_sackdelay > 500 || |
| 2357 | (params.spp_pathmtu | 2359 | (params.spp_pathmtu && |
| 2358 | && params.spp_pathmtu < SCTP_DEFAULT_MINSEGMENT)) | 2360 | params.spp_pathmtu < SCTP_DEFAULT_MINSEGMENT)) |
| 2359 | return -EINVAL; | 2361 | return -EINVAL; |
| 2360 | 2362 | ||
| 2361 | /* If an address other than INADDR_ANY is specified, and | 2363 | /* If an address other than INADDR_ANY is specified, and |
| @@ -4349,90 +4351,6 @@ static int sctp_getsockopt_initmsg(struct sock *sk, int len, char __user *optval | |||
| 4349 | return 0; | 4351 | return 0; |
| 4350 | } | 4352 | } |
| 4351 | 4353 | ||
| 4352 | static int sctp_getsockopt_peer_addrs_num_old(struct sock *sk, int len, | ||
| 4353 | char __user *optval, | ||
| 4354 | int __user *optlen) | ||
| 4355 | { | ||
| 4356 | sctp_assoc_t id; | ||
| 4357 | struct sctp_association *asoc; | ||
| 4358 | struct list_head *pos; | ||
| 4359 | int cnt = 0; | ||
| 4360 | |||
| 4361 | if (len < sizeof(sctp_assoc_t)) | ||
| 4362 | return -EINVAL; | ||
| 4363 | |||
| 4364 | if (copy_from_user(&id, optval, sizeof(sctp_assoc_t))) | ||
| 4365 | return -EFAULT; | ||
| 4366 | |||
| 4367 | printk(KERN_WARNING "SCTP: Use of SCTP_GET_PEER_ADDRS_NUM_OLD " | ||
| 4368 | "socket option deprecated\n"); | ||
| 4369 | /* For UDP-style sockets, id specifies the association to query. */ | ||
| 4370 | asoc = sctp_id2assoc(sk, id); | ||
| 4371 | if (!asoc) | ||
| 4372 | return -EINVAL; | ||
| 4373 | |||
| 4374 | list_for_each(pos, &asoc->peer.transport_addr_list) { | ||
| 4375 | cnt ++; | ||
| 4376 | } | ||
| 4377 | |||
| 4378 | return cnt; | ||
| 4379 | } | ||
| 4380 | |||
| 4381 | /* | ||
| 4382 | * Old API for getting list of peer addresses. Does not work for 32-bit | ||
| 4383 | * programs running on a 64-bit kernel | ||
| 4384 | */ | ||
| 4385 | static int sctp_getsockopt_peer_addrs_old(struct sock *sk, int len, | ||
| 4386 | char __user *optval, | ||
| 4387 | int __user *optlen) | ||
| 4388 | { | ||
| 4389 | struct sctp_association *asoc; | ||
| 4390 | int cnt = 0; | ||
| 4391 | struct sctp_getaddrs_old getaddrs; | ||
| 4392 | struct sctp_transport *from; | ||
| 4393 | void __user *to; | ||
| 4394 | union sctp_addr temp; | ||
| 4395 | struct sctp_sock *sp = sctp_sk(sk); | ||
| 4396 | int addrlen; | ||
| 4397 | |||
| 4398 | if (len < sizeof(struct sctp_getaddrs_old)) | ||
| 4399 | return -EINVAL; | ||
| 4400 | |||
| 4401 | len = sizeof(struct sctp_getaddrs_old); | ||
| 4402 | |||
| 4403 | if (copy_from_user(&getaddrs, optval, len)) | ||
| 4404 | return -EFAULT; | ||
| 4405 | |||
| 4406 | if (getaddrs.addr_num <= 0) return -EINVAL; | ||
| 4407 | |||
| 4408 | printk(KERN_WARNING "SCTP: Use of SCTP_GET_PEER_ADDRS_OLD " | ||
| 4409 | "socket option deprecated\n"); | ||
| 4410 | |||
| 4411 | /* For UDP-style sockets, id specifies the association to query. */ | ||
| 4412 | asoc = sctp_id2assoc(sk, getaddrs.assoc_id); | ||
| 4413 | if (!asoc) | ||
| 4414 | return -EINVAL; | ||
| 4415 | |||
| 4416 | to = (void __user *)getaddrs.addrs; | ||
| 4417 | list_for_each_entry(from, &asoc->peer.transport_addr_list, | ||
| 4418 | transports) { | ||
| 4419 | memcpy(&temp, &from->ipaddr, sizeof(temp)); | ||
| 4420 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); | ||
| 4421 | addrlen = sctp_get_af_specific(sk->sk_family)->sockaddr_len; | ||
| 4422 | if (copy_to_user(to, &temp, addrlen)) | ||
| 4423 | return -EFAULT; | ||
| 4424 | to += addrlen ; | ||
| 4425 | cnt ++; | ||
| 4426 | if (cnt >= getaddrs.addr_num) break; | ||
| 4427 | } | ||
| 4428 | getaddrs.addr_num = cnt; | ||
| 4429 | if (put_user(len, optlen)) | ||
| 4430 | return -EFAULT; | ||
| 4431 | if (copy_to_user(optval, &getaddrs, len)) | ||
| 4432 | return -EFAULT; | ||
| 4433 | |||
| 4434 | return 0; | ||
| 4435 | } | ||
| 4436 | 4354 | ||
| 4437 | static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, | 4355 | static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, |
| 4438 | char __user *optval, int __user *optlen) | 4356 | char __user *optval, int __user *optlen) |
| @@ -4485,125 +4403,6 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, | |||
| 4485 | return 0; | 4403 | return 0; |
| 4486 | } | 4404 | } |
| 4487 | 4405 | ||
| 4488 | static int sctp_getsockopt_local_addrs_num_old(struct sock *sk, int len, | ||
| 4489 | char __user *optval, | ||
| 4490 | int __user *optlen) | ||
| 4491 | { | ||
| 4492 | sctp_assoc_t id; | ||
| 4493 | struct sctp_bind_addr *bp; | ||
| 4494 | struct sctp_association *asoc; | ||
| 4495 | struct sctp_sockaddr_entry *addr; | ||
| 4496 | int cnt = 0; | ||
| 4497 | |||
| 4498 | if (len < sizeof(sctp_assoc_t)) | ||
| 4499 | return -EINVAL; | ||
| 4500 | |||
| 4501 | if (copy_from_user(&id, optval, sizeof(sctp_assoc_t))) | ||
| 4502 | return -EFAULT; | ||
| 4503 | |||
| 4504 | printk(KERN_WARNING "SCTP: Use of SCTP_GET_LOCAL_ADDRS_NUM_OLD " | ||
| 4505 | "socket option deprecated\n"); | ||
| 4506 | |||
| 4507 | /* | ||
| 4508 | * For UDP-style sockets, id specifies the association to query. | ||
| 4509 | * If the id field is set to the value '0' then the locally bound | ||
| 4510 | * addresses are returned without regard to any particular | ||
| 4511 | * association. | ||
| 4512 | */ | ||
| 4513 | if (0 == id) { | ||
| 4514 | bp = &sctp_sk(sk)->ep->base.bind_addr; | ||
| 4515 | } else { | ||
| 4516 | asoc = sctp_id2assoc(sk, id); | ||
| 4517 | if (!asoc) | ||
| 4518 | return -EINVAL; | ||
| 4519 | bp = &asoc->base.bind_addr; | ||
| 4520 | } | ||
| 4521 | |||
| 4522 | /* If the endpoint is bound to 0.0.0.0 or ::0, count the valid | ||
| 4523 | * addresses from the global local address list. | ||
| 4524 | */ | ||
| 4525 | if (sctp_list_single_entry(&bp->address_list)) { | ||
| 4526 | addr = list_entry(bp->address_list.next, | ||
| 4527 | struct sctp_sockaddr_entry, list); | ||
| 4528 | if (sctp_is_any(sk, &addr->a)) { | ||
| 4529 | rcu_read_lock(); | ||
| 4530 | list_for_each_entry_rcu(addr, | ||
| 4531 | &sctp_local_addr_list, list) { | ||
| 4532 | if (!addr->valid) | ||
| 4533 | continue; | ||
| 4534 | |||
| 4535 | if ((PF_INET == sk->sk_family) && | ||
| 4536 | (AF_INET6 == addr->a.sa.sa_family)) | ||
| 4537 | continue; | ||
| 4538 | |||
| 4539 | if ((PF_INET6 == sk->sk_family) && | ||
| 4540 | inet_v6_ipv6only(sk) && | ||
| 4541 | (AF_INET == addr->a.sa.sa_family)) | ||
| 4542 | continue; | ||
| 4543 | |||
| 4544 | cnt++; | ||
| 4545 | } | ||
| 4546 | rcu_read_unlock(); | ||
| 4547 | } else { | ||
| 4548 | cnt = 1; | ||
| 4549 | } | ||
| 4550 | goto done; | ||
| 4551 | } | ||
| 4552 | |||
| 4553 | /* Protection on the bound address list is not needed, | ||
| 4554 | * since in the socket option context we hold the socket lock, | ||
| 4555 | * so there is no way that the bound address list can change. | ||
| 4556 | */ | ||
| 4557 | list_for_each_entry(addr, &bp->address_list, list) { | ||
| 4558 | cnt ++; | ||
| 4559 | } | ||
| 4560 | done: | ||
| 4561 | return cnt; | ||
| 4562 | } | ||
| 4563 | |||
| 4564 | /* Helper function that copies local addresses to user and returns the number | ||
| 4565 | * of addresses copied. | ||
| 4566 | */ | ||
| 4567 | static int sctp_copy_laddrs_old(struct sock *sk, __u16 port, | ||
| 4568 | int max_addrs, void *to, | ||
| 4569 | int *bytes_copied) | ||
| 4570 | { | ||
| 4571 | struct sctp_sockaddr_entry *addr; | ||
| 4572 | union sctp_addr temp; | ||
| 4573 | int cnt = 0; | ||
| 4574 | int addrlen; | ||
| 4575 | |||
| 4576 | rcu_read_lock(); | ||
| 4577 | list_for_each_entry_rcu(addr, &sctp_local_addr_list, list) { | ||
| 4578 | if (!addr->valid) | ||
| 4579 | continue; | ||
| 4580 | |||
| 4581 | if ((PF_INET == sk->sk_family) && | ||
| 4582 | (AF_INET6 == addr->a.sa.sa_family)) | ||
| 4583 | continue; | ||
| 4584 | if ((PF_INET6 == sk->sk_family) && | ||
| 4585 | inet_v6_ipv6only(sk) && | ||
| 4586 | (AF_INET == addr->a.sa.sa_family)) | ||
| 4587 | continue; | ||
| 4588 | memcpy(&temp, &addr->a, sizeof(temp)); | ||
| 4589 | if (!temp.v4.sin_port) | ||
| 4590 | temp.v4.sin_port = htons(port); | ||
| 4591 | |||
| 4592 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk), | ||
| 4593 | &temp); | ||
| 4594 | addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; | ||
| 4595 | memcpy(to, &temp, addrlen); | ||
| 4596 | |||
| 4597 | to += addrlen; | ||
| 4598 | *bytes_copied += addrlen; | ||
| 4599 | cnt ++; | ||
| 4600 | if (cnt >= max_addrs) break; | ||
| 4601 | } | ||
| 4602 | rcu_read_unlock(); | ||
| 4603 | |||
| 4604 | return cnt; | ||
| 4605 | } | ||
| 4606 | |||
| 4607 | static int sctp_copy_laddrs(struct sock *sk, __u16 port, void *to, | 4406 | static int sctp_copy_laddrs(struct sock *sk, __u16 port, void *to, |
| 4608 | size_t space_left, int *bytes_copied) | 4407 | size_t space_left, int *bytes_copied) |
| 4609 | { | 4408 | { |
| @@ -4647,112 +4446,6 @@ static int sctp_copy_laddrs(struct sock *sk, __u16 port, void *to, | |||
| 4647 | return cnt; | 4446 | return cnt; |
| 4648 | } | 4447 | } |
| 4649 | 4448 | ||
| 4650 | /* Old API for getting list of local addresses. Does not work for 32-bit | ||
| 4651 | * programs running on a 64-bit kernel | ||
| 4652 | */ | ||
| 4653 | static int sctp_getsockopt_local_addrs_old(struct sock *sk, int len, | ||
| 4654 | char __user *optval, int __user *optlen) | ||
| 4655 | { | ||
| 4656 | struct sctp_bind_addr *bp; | ||
| 4657 | struct sctp_association *asoc; | ||
| 4658 | int cnt = 0; | ||
| 4659 | struct sctp_getaddrs_old getaddrs; | ||
| 4660 | struct sctp_sockaddr_entry *addr; | ||
| 4661 | void __user *to; | ||
| 4662 | union sctp_addr temp; | ||
| 4663 | struct sctp_sock *sp = sctp_sk(sk); | ||
| 4664 | int addrlen; | ||
| 4665 | int err = 0; | ||
| 4666 | void *addrs; | ||
| 4667 | void *buf; | ||
| 4668 | int bytes_copied = 0; | ||
| 4669 | |||
| 4670 | if (len < sizeof(struct sctp_getaddrs_old)) | ||
| 4671 | return -EINVAL; | ||
| 4672 | |||
| 4673 | len = sizeof(struct sctp_getaddrs_old); | ||
| 4674 | if (copy_from_user(&getaddrs, optval, len)) | ||
| 4675 | return -EFAULT; | ||
| 4676 | |||
| 4677 | if (getaddrs.addr_num <= 0 || | ||
| 4678 | getaddrs.addr_num >= (INT_MAX / sizeof(union sctp_addr))) | ||
| 4679 | return -EINVAL; | ||
| 4680 | |||
| 4681 | printk(KERN_WARNING "SCTP: Use of SCTP_GET_LOCAL_ADDRS_OLD " | ||
| 4682 | "socket option deprecated\n"); | ||
| 4683 | |||
| 4684 | /* | ||
| 4685 | * For UDP-style sockets, id specifies the association to query. | ||
| 4686 | * If the id field is set to the value '0' then the locally bound | ||
| 4687 | * addresses are returned without regard to any particular | ||
| 4688 | * association. | ||
| 4689 | */ | ||
| 4690 | if (0 == getaddrs.assoc_id) { | ||
| 4691 | bp = &sctp_sk(sk)->ep->base.bind_addr; | ||
| 4692 | } else { | ||
| 4693 | asoc = sctp_id2assoc(sk, getaddrs.assoc_id); | ||
| 4694 | if (!asoc) | ||
| 4695 | return -EINVAL; | ||
| 4696 | bp = &asoc->base.bind_addr; | ||
| 4697 | } | ||
| 4698 | |||
| 4699 | to = getaddrs.addrs; | ||
| 4700 | |||
| 4701 | /* Allocate space for a local instance of packed array to hold all | ||
| 4702 | * the data. We store addresses here first and then put write them | ||
| 4703 | * to the user in one shot. | ||
| 4704 | */ | ||
| 4705 | addrs = kmalloc(sizeof(union sctp_addr) * getaddrs.addr_num, | ||
| 4706 | GFP_KERNEL); | ||
| 4707 | if (!addrs) | ||
| 4708 | return -ENOMEM; | ||
| 4709 | |||
| 4710 | /* If the endpoint is bound to 0.0.0.0 or ::0, get the valid | ||
| 4711 | * addresses from the global local address list. | ||
| 4712 | */ | ||
| 4713 | if (sctp_list_single_entry(&bp->address_list)) { | ||
| 4714 | addr = list_entry(bp->address_list.next, | ||
| 4715 | struct sctp_sockaddr_entry, list); | ||
| 4716 | if (sctp_is_any(sk, &addr->a)) { | ||
| 4717 | cnt = sctp_copy_laddrs_old(sk, bp->port, | ||
| 4718 | getaddrs.addr_num, | ||
| 4719 | addrs, &bytes_copied); | ||
| 4720 | goto copy_getaddrs; | ||
| 4721 | } | ||
| 4722 | } | ||
| 4723 | |||
| 4724 | buf = addrs; | ||
| 4725 | /* Protection on the bound address list is not needed since | ||
| 4726 | * in the socket option context we hold a socket lock and | ||
| 4727 | * thus the bound address list can't change. | ||
| 4728 | */ | ||
| 4729 | list_for_each_entry(addr, &bp->address_list, list) { | ||
| 4730 | memcpy(&temp, &addr->a, sizeof(temp)); | ||
| 4731 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); | ||
| 4732 | addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; | ||
| 4733 | memcpy(buf, &temp, addrlen); | ||
| 4734 | buf += addrlen; | ||
| 4735 | bytes_copied += addrlen; | ||
| 4736 | cnt ++; | ||
| 4737 | if (cnt >= getaddrs.addr_num) break; | ||
| 4738 | } | ||
| 4739 | |||
| 4740 | copy_getaddrs: | ||
| 4741 | /* copy the entire address list into the user provided space */ | ||
| 4742 | if (copy_to_user(to, addrs, bytes_copied)) { | ||
| 4743 | err = -EFAULT; | ||
| 4744 | goto error; | ||
| 4745 | } | ||
| 4746 | |||
| 4747 | /* copy the leading structure back to user */ | ||
| 4748 | getaddrs.addr_num = cnt; | ||
| 4749 | if (copy_to_user(optval, &getaddrs, len)) | ||
| 4750 | err = -EFAULT; | ||
| 4751 | |||
| 4752 | error: | ||
| 4753 | kfree(addrs); | ||
| 4754 | return err; | ||
| 4755 | } | ||
| 4756 | 4449 | ||
| 4757 | static int sctp_getsockopt_local_addrs(struct sock *sk, int len, | 4450 | static int sctp_getsockopt_local_addrs(struct sock *sk, int len, |
| 4758 | char __user *optval, int __user *optlen) | 4451 | char __user *optval, int __user *optlen) |
| @@ -5603,22 +5296,6 @@ SCTP_STATIC int sctp_getsockopt(struct sock *sk, int level, int optname, | |||
| 5603 | case SCTP_INITMSG: | 5296 | case SCTP_INITMSG: |
| 5604 | retval = sctp_getsockopt_initmsg(sk, len, optval, optlen); | 5297 | retval = sctp_getsockopt_initmsg(sk, len, optval, optlen); |
| 5605 | break; | 5298 | break; |
| 5606 | case SCTP_GET_PEER_ADDRS_NUM_OLD: | ||
| 5607 | retval = sctp_getsockopt_peer_addrs_num_old(sk, len, optval, | ||
| 5608 | optlen); | ||
| 5609 | break; | ||
| 5610 | case SCTP_GET_LOCAL_ADDRS_NUM_OLD: | ||
| 5611 | retval = sctp_getsockopt_local_addrs_num_old(sk, len, optval, | ||
| 5612 | optlen); | ||
| 5613 | break; | ||
| 5614 | case SCTP_GET_PEER_ADDRS_OLD: | ||
| 5615 | retval = sctp_getsockopt_peer_addrs_old(sk, len, optval, | ||
| 5616 | optlen); | ||
| 5617 | break; | ||
| 5618 | case SCTP_GET_LOCAL_ADDRS_OLD: | ||
| 5619 | retval = sctp_getsockopt_local_addrs_old(sk, len, optval, | ||
| 5620 | optlen); | ||
| 5621 | break; | ||
| 5622 | case SCTP_GET_PEER_ADDRS: | 5299 | case SCTP_GET_PEER_ADDRS: |
| 5623 | retval = sctp_getsockopt_peer_addrs(sk, len, optval, | 5300 | retval = sctp_getsockopt_peer_addrs(sk, len, optval, |
| 5624 | optlen); | 5301 | optlen); |
| @@ -5861,7 +5538,7 @@ pp_not_found: | |||
| 5861 | */ | 5538 | */ |
| 5862 | success: | 5539 | success: |
| 5863 | if (!sctp_sk(sk)->bind_hash) { | 5540 | if (!sctp_sk(sk)->bind_hash) { |
| 5864 | inet_sk(sk)->num = snum; | 5541 | inet_sk(sk)->inet_num = snum; |
| 5865 | sk_add_bind_node(sk, &pp->owner); | 5542 | sk_add_bind_node(sk, &pp->owner); |
| 5866 | sctp_sk(sk)->bind_hash = pp; | 5543 | sctp_sk(sk)->bind_hash = pp; |
| 5867 | } | 5544 | } |
| @@ -5933,7 +5610,7 @@ SCTP_STATIC int sctp_listen_start(struct sock *sk, int backlog) | |||
| 5933 | if (sctp_autobind(sk)) | 5610 | if (sctp_autobind(sk)) |
| 5934 | return -EAGAIN; | 5611 | return -EAGAIN; |
| 5935 | } else { | 5612 | } else { |
| 5936 | if (sctp_get_port(sk, inet_sk(sk)->num)) { | 5613 | if (sctp_get_port(sk, inet_sk(sk)->inet_num)) { |
| 5937 | sk->sk_state = SCTP_SS_CLOSED; | 5614 | sk->sk_state = SCTP_SS_CLOSED; |
| 5938 | return -EADDRINUSE; | 5615 | return -EADDRINUSE; |
| 5939 | } | 5616 | } |
| @@ -6104,14 +5781,14 @@ static void sctp_bucket_destroy(struct sctp_bind_bucket *pp) | |||
| 6104 | static inline void __sctp_put_port(struct sock *sk) | 5781 | static inline void __sctp_put_port(struct sock *sk) |
| 6105 | { | 5782 | { |
| 6106 | struct sctp_bind_hashbucket *head = | 5783 | struct sctp_bind_hashbucket *head = |
| 6107 | &sctp_port_hashtable[sctp_phashfn(inet_sk(sk)->num)]; | 5784 | &sctp_port_hashtable[sctp_phashfn(inet_sk(sk)->inet_num)]; |
| 6108 | struct sctp_bind_bucket *pp; | 5785 | struct sctp_bind_bucket *pp; |
| 6109 | 5786 | ||
| 6110 | sctp_spin_lock(&head->lock); | 5787 | sctp_spin_lock(&head->lock); |
| 6111 | pp = sctp_sk(sk)->bind_hash; | 5788 | pp = sctp_sk(sk)->bind_hash; |
| 6112 | __sk_del_bind_node(sk); | 5789 | __sk_del_bind_node(sk); |
| 6113 | sctp_sk(sk)->bind_hash = NULL; | 5790 | sctp_sk(sk)->bind_hash = NULL; |
| 6114 | inet_sk(sk)->num = 0; | 5791 | inet_sk(sk)->inet_num = 0; |
| 6115 | sctp_bucket_destroy(pp); | 5792 | sctp_bucket_destroy(pp); |
| 6116 | sctp_spin_unlock(&head->lock); | 5793 | sctp_spin_unlock(&head->lock); |
| 6117 | } | 5794 | } |
| @@ -6138,7 +5815,7 @@ static int sctp_autobind(struct sock *sk) | |||
| 6138 | /* Initialize a local sockaddr structure to INADDR_ANY. */ | 5815 | /* Initialize a local sockaddr structure to INADDR_ANY. */ |
| 6139 | af = sctp_sk(sk)->pf->af; | 5816 | af = sctp_sk(sk)->pf->af; |
| 6140 | 5817 | ||
| 6141 | port = htons(inet_sk(sk)->num); | 5818 | port = htons(inet_sk(sk)->inet_num); |
| 6142 | af->inaddr_any(&autoaddr, port); | 5819 | af->inaddr_any(&autoaddr, port); |
| 6143 | 5820 | ||
| 6144 | return sctp_do_bind(sk, &autoaddr, af->sockaddr_len); | 5821 | return sctp_do_bind(sk, &autoaddr, af->sockaddr_len); |
| @@ -6707,12 +6384,12 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk, | |||
| 6707 | /* Initialize sk's sport, dport, rcv_saddr and daddr for | 6384 | /* Initialize sk's sport, dport, rcv_saddr and daddr for |
| 6708 | * getsockname() and getpeername() | 6385 | * getsockname() and getpeername() |
| 6709 | */ | 6386 | */ |
| 6710 | newinet->sport = inet->sport; | 6387 | newinet->inet_sport = inet->inet_sport; |
| 6711 | newinet->saddr = inet->saddr; | 6388 | newinet->inet_saddr = inet->inet_saddr; |
| 6712 | newinet->rcv_saddr = inet->rcv_saddr; | 6389 | newinet->inet_rcv_saddr = inet->inet_rcv_saddr; |
| 6713 | newinet->dport = htons(asoc->peer.port); | 6390 | newinet->inet_dport = htons(asoc->peer.port); |
| 6714 | newinet->pmtudisc = inet->pmtudisc; | 6391 | newinet->pmtudisc = inet->pmtudisc; |
| 6715 | newinet->id = asoc->next_tsn ^ jiffies; | 6392 | newinet->inet_id = asoc->next_tsn ^ jiffies; |
| 6716 | 6393 | ||
| 6717 | newinet->uc_ttl = inet->uc_ttl; | 6394 | newinet->uc_ttl = inet->uc_ttl; |
| 6718 | newinet->mc_loop = 1; | 6395 | newinet->mc_loop = 1; |
| @@ -6751,13 +6428,13 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
| 6751 | newsp->hmac = NULL; | 6428 | newsp->hmac = NULL; |
| 6752 | 6429 | ||
| 6753 | /* Hook this new socket in to the bind_hash list. */ | 6430 | /* Hook this new socket in to the bind_hash list. */ |
| 6754 | head = &sctp_port_hashtable[sctp_phashfn(inet_sk(oldsk)->num)]; | 6431 | head = &sctp_port_hashtable[sctp_phashfn(inet_sk(oldsk)->inet_num)]; |
| 6755 | sctp_local_bh_disable(); | 6432 | sctp_local_bh_disable(); |
| 6756 | sctp_spin_lock(&head->lock); | 6433 | sctp_spin_lock(&head->lock); |
| 6757 | pp = sctp_sk(oldsk)->bind_hash; | 6434 | pp = sctp_sk(oldsk)->bind_hash; |
| 6758 | sk_add_bind_node(newsk, &pp->owner); | 6435 | sk_add_bind_node(newsk, &pp->owner); |
| 6759 | sctp_sk(newsk)->bind_hash = pp; | 6436 | sctp_sk(newsk)->bind_hash = pp; |
| 6760 | inet_sk(newsk)->num = inet_sk(oldsk)->num; | 6437 | inet_sk(newsk)->inet_num = inet_sk(oldsk)->inet_num; |
| 6761 | sctp_spin_unlock(&head->lock); | 6438 | sctp_spin_unlock(&head->lock); |
| 6762 | sctp_local_bh_enable(); | 6439 | sctp_local_bh_enable(); |
| 6763 | 6440 | ||
